Move diary comments index action to comments controller
This commit is contained in:
parent
63a323dbe3
commit
6624beff11
9 changed files with 120 additions and 79 deletions
27
app/controllers/diary_comments_controller.rb
Normal file
27
app/controllers/diary_comments_controller.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
class DiaryCommentsController < ApplicationController
|
||||
include UserMethods
|
||||
include PaginationMethods
|
||||
|
||||
layout "site"
|
||||
|
||||
before_action :authorize_web
|
||||
before_action :set_locale
|
||||
before_action :check_database_readable
|
||||
|
||||
authorize_resource
|
||||
|
||||
before_action :lookup_user, :only => :index
|
||||
|
||||
allow_thirdparty_images :only => :index
|
||||
|
||||
def index
|
||||
@title = t ".title", :user => @user.display_name
|
||||
|
||||
comments = DiaryComment.where(:user => @user)
|
||||
comments = comments.visible unless can? :unhidecomment, DiaryEntry
|
||||
|
||||
@params = params.permit(:display_name, :before, :after)
|
||||
|
||||
@comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user])
|
||||
end
|
||||
end
|
|
@ -10,10 +10,10 @@ class DiaryEntriesController < ApplicationController
|
|||
|
||||
authorize_resource
|
||||
|
||||
before_action :lookup_user, :only => [:show, :comments]
|
||||
before_action :lookup_user, :only => :show
|
||||
before_action :check_database_writable, :only => [:new, :create, :edit, :update, :comment, :hide, :hidecomment, :subscribe, :unsubscribe]
|
||||
|
||||
allow_thirdparty_images :only => [:new, :create, :edit, :update, :index, :show, :comments]
|
||||
allow_thirdparty_images :only => [:new, :create, :edit, :update, :index, :show]
|
||||
|
||||
def index
|
||||
if params[:display_name]
|
||||
|
@ -241,17 +241,6 @@ class DiaryEntriesController < ApplicationController
|
|||
redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry)
|
||||
end
|
||||
|
||||
def comments
|
||||
@title = t ".title", :user => @user.display_name
|
||||
|
||||
comments = DiaryComment.where(:user => @user)
|
||||
comments = comments.visible unless can? :unhidecomment, DiaryEntry
|
||||
|
||||
@params = params.permit(:display_name, :before, :after)
|
||||
|
||||
@comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue