Add API data to show/index views

This commit is contained in:
BrokenEagle
2020-01-04 01:51:37 +00:00
parent e8a96c1a2a
commit 223a6df5d8
60 changed files with 337 additions and 34 deletions

View File

@@ -43,7 +43,7 @@ class ArtistsController < ApplicationController
end
def show
@artist = Artist.find(params[:id])
@current_item = @artist = Artist.find(params[:id])
@post_set = PostSets::Artist.new(@artist)
respond_with(@artist)
end

View File

@@ -19,7 +19,7 @@ class BansController < ApplicationController
end
def show
@ban = Ban.find(params[:id])
@current_item = @ban = Ban.find(params[:id])
respond_with(@ban)
end

View File

@@ -15,7 +15,7 @@ class BulkUpdateRequestsController < ApplicationController
end
def show
@bulk_update_request = BulkUpdateRequest.find(params[:id])
@current_item = @bulk_update_request = BulkUpdateRequest.find(params[:id])
respond_with(@bulk_update_request)
end

View File

@@ -24,7 +24,7 @@ class DmailsController < ApplicationController
end
def show
@dmail = Dmail.find(params[:id])
@current_item = @dmail = Dmail.find(params[:id])
check_privilege(@dmail)
@dmail.mark_as_read!
respond_with(@dmail)

View File

@@ -8,7 +8,7 @@ class FavoriteGroupsController < ApplicationController
end
def show
@favorite_group = FavoriteGroup.find(params[:id])
@current_item = @favorite_group = FavoriteGroup.find(params[:id])
check_read_privilege(@favorite_group)
@post_set = PostSets::FavoriteGroup.new(@favorite_group, params[:page])
respond_with(@favorite_group)

View File

@@ -32,6 +32,7 @@ class ForumTopicsController < ApplicationController
end
def show
@current_item = @forum_topic
if request.format == Mime::Type.lookup("text/html")
@forum_topic.mark_as_read!(CurrentUser.user)
end

View File

@@ -37,7 +37,7 @@ class PoolsController < ApplicationController
def show
limit = params[:limit].presence || CurrentUser.user.per_page
@pool = Pool.find(params[:id])
@current_item = @pool = Pool.find(params[:id])
@posts = @pool.posts.paginate(params[:page], limit: limit, count: @pool.post_count)
respond_with(@pool)
end

View File

@@ -19,7 +19,7 @@ class PostsController < ApplicationController
end
def show
@post = Post.find(params[:id])
@current_item = @post = Post.find(params[:id])
@comments = @post.comments
@comments = @comments.includes(:creator)

View File

@@ -3,7 +3,7 @@ class TagAliasesController < ApplicationController
respond_to :html, :xml, :json, :js
def show
@tag_alias = TagAlias.find(params[:id])
@current_item = @tag_alias = TagAlias.find(params[:id])
respond_with(@tag_alias)
end

View File

@@ -3,7 +3,7 @@ class TagImplicationsController < ApplicationController
respond_to :html, :xml, :json, :js
def show
@tag_implication = TagImplication.find(params[:id])
@current_item = @tag_implication = TagImplication.find(params[:id])
respond_with(@tag_implication)
end

View File

@@ -3,7 +3,7 @@ class TagsController < ApplicationController
respond_to :html, :xml, :json
def edit
@tag = Tag.find(params[:id])
@current_item = @tag = Tag.find(params[:id])
check_privilege(@tag)
respond_with(@tag)
end
@@ -26,7 +26,7 @@ class TagsController < ApplicationController
end
def show
@tag = Tag.find(params[:id])
@current_item = @tag = Tag.find(params[:id])
respond_with(@tag)
end

View File

@@ -29,7 +29,7 @@ class UploadsController < ApplicationController
end
def show
@upload = Upload.find(params[:id])
@current_item = @upload = Upload.find(params[:id])
respond_with(@upload) do |format|
format.html do
if @upload.is_completed? && @upload.post_id

View File

@@ -14,7 +14,7 @@ class UserFeedbacksController < ApplicationController
end
def show
@user_feedback = UserFeedback.visible.find(params[:id])
@current_item = @user_feedback = UserFeedback.visible.find(params[:id])
respond_with(@user_feedback)
end

View File

@@ -14,7 +14,7 @@ class UserNameChangeRequestsController < ApplicationController
end
def show
@change_request = UserNameChangeRequest.find(params[:id])
@current_item = @change_request = UserNameChangeRequest.find(params[:id])
check_privileges!(@change_request)
respond_with(@change_request)
end

View File

@@ -43,7 +43,7 @@ class UsersController < ApplicationController
end
def show
@user = User.find(params[:id])
@current_item = @user = User.find(params[:id])
respond_with(@user, methods: @user.full_attributes)
end

View File

@@ -8,7 +8,7 @@ class WikiPageVersionsController < ApplicationController
end
def show
@wiki_page_version = WikiPageVersion.find(params[:id])
@current_item = @wiki_page_version = WikiPageVersion.find(params[:id])
respond_with(@wiki_page_version)
end

View File

@@ -30,7 +30,7 @@ class WikiPagesController < ApplicationController
def show
@wiki_page, found_by = WikiPage.find_by_id_or_title(params[:id])
@current_item = @wiki_page
if request.format.html? && @wiki_page.blank? && found_by == :title
@wiki_page = WikiPage.new(title: params[:id])
respond_with @wiki_page, status: 404