Class: DmForum::ForumCommentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- DmForum::ForumCommentsController
- Includes:
- ActionView::RecordIdentifier, PermittedParams
- Defined in:
- app/controllers/dm_forum/forum_comments_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
——————————————————————————.
-
#destroy ⇒ Object
——————————————————————————.
-
#edit ⇒ Object
——————————————————————————.
-
#index ⇒ Object
/posts /users/1/posts /forums/1/posts /forums/1/topics/1/posts ——————————————————————————.
-
#show ⇒ Object
——————————————————————————.
-
#update ⇒ Object
——————————————————————————.
Methods included from PermittedParams
#forum_category_params, #forum_comment_params, #forum_params, #forum_site_params, #forum_topic_params
Methods included from ForumHelper
#edited_on_tag, #feed_icon_tag, #forum_comment_user_state, #forum_crumbs, #forum_topic_icon, #last_active, #modify_history, #recent_forum_activity, #recent_topic_activity, #topic_title_link, #voice_count
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/dm_forum/forum_comments_controller.rb', line 34 def create @forum_comment = ForumComment.create_comment(@forum_topic, params[:forum_comment][:body], current_user) if @forum_comment.new_record? redirect_to forum_forum_topic_path(@forum, @forum_topic) else current_user.following.follow(@forum_topic) flash[:notice] = 'Comment successfully created.' redirect_to(forum_forum_topic_path(@forum, @forum_topic, {:anchor => dom_id(@forum_comment), :page => @forum_topic.last_page})) end end |
#destroy ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/dm_forum/forum_comments_controller.rb', line 56 def destroy @forum_comment.destroy if @forum.forum_topics.exists?(@forum_topic) redirect_to forum_forum_topic_path(@forum, @forum_topic) else redirect_to @forum end end |
#edit ⇒ Object
30 31 |
# File 'app/controllers/dm_forum/forum_comments_controller.rb', line 30 def edit end |
#index ⇒ Object
/posts /users/1/posts /forums/1/posts /forums/1/topics/1/posts
16 17 18 19 20 21 22 |
# File 'app/controllers/dm_forum/forum_comments_controller.rb', line 16 def index @followed = user_signed_in? && params[:followed] @q = params[:q] ? params[:q].purify : nil @posts = (@parent ? @parent.forum_comments : ForumSite.site.forum_comments).search(@q, :page => page_number) @followed_posts = user_signed_in? ? (@parent ? @parent.forum_comments : ForumSite.site.forum_comments).search_followed(current_user.id, @q, :page => page_number) : nil @users = @user ? {@user.id => @user} : User.index_from(@posts) end |
#show ⇒ Object
25 26 27 |
# File 'app/controllers/dm_forum/forum_comments_controller.rb', line 25 def show redirect_to forum_forum_topic_path(@forum, @forum_topic) end |
#update ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'app/controllers/dm_forum/forum_comments_controller.rb', line 46 def update if @forum_comment.update_attributes(forum_comment_params) flash[:notice] = 'Post was successfully updated.' redirect_to(forum_forum_topic_path(@forum, @forum_topic, {:anchor => dom_id(@forum_comment), :page => @forum_topic.comment_page(@forum_comment)})) else render :action => :edit end end |