Fix ?page=1 param appearing after creating/editing forum post

It creates an extra unnecessary entry in back button history to go
through.
This commit is contained in:
Toks
2014-11-26 13:27:28 -05:00
parent 91270f4567
commit 60e1d1379d

View File

@@ -42,14 +42,16 @@ class ForumPostsController < ApplicationController
def create
@forum_post = ForumPost.create(params[:forum_post])
respond_with(@forum_post, :location => forum_topic_path(@forum_post.topic, :page => @forum_post.topic.last_page))
page = @forum_post.topic.last_page if @forum_post.topic.last_page > 1
respond_with(@forum_post, :location => forum_topic_path(@forum_post.topic, :page => page))
end
def update
@forum_post = ForumPost.find(params[:id])
check_privilege(@forum_post)
@forum_post.update_attributes(params[:forum_post])
respond_with(@forum_post, :location => forum_topic_path(@forum_post.topic, :page => @forum_post.forum_topic_page, :anchor => "forum_post_#{@forum_post.id}"))
page = @forum_post.forum_topic_page if @forum_post.forum_topic_page > 1
respond_with(@forum_post, :location => forum_topic_path(@forum_post.topic, :page => page, :anchor => "forum_post_#{@forum_post.id}"))
end
def destroy