- def hidecomment
- comment = DiaryComment.find(params[:comment])
- comment.update(:visible => false)
- redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry)
- end
-
- def unhidecomment
- comment = DiaryComment.find(params[:comment])
- comment.update(:visible => true)
- redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry)
- end
-
- def comments
- @title = t ".title", :user => @user.display_name
-
- conditions = { :user_id => @user }
-
- conditions[:visible] = true unless can? :unhidecomment, DiaryEntry
-
- @comment_pages, @comments = paginate(:diary_comments,
- :conditions => conditions,
- :order => "created_at DESC",
- :per_page => 20)
- @page = (params[:page] || 1).to_i
- end
-