Added post anchors and show post.

when a new post is created, the page is now scrolled to is via its
anchor

created a show post route, and view.

added a post number to post view, with link.

need to change displayed post number from post id, to reply #
This commit is contained in:
2013-01-25 03:33:48 -05:00
parent 1e05402d18
commit 7da52114ca
6 changed files with 32 additions and 11 deletions

View File

@@ -1,9 +1,17 @@
class PostsController < ApplicationController
include ApplicationHelper
load_and_authorize_resource :topic
load_and_authorize_resource :post, :through => :topic, :shallow => true
before_filter :check_for_cancel#, :only[:create, :update]
def show
@topic = @post.topic
@my_blockquote = block_quote
end
def new
if params[:quote]
quote_post = Post.find(params[:quote])
@@ -18,7 +26,7 @@ class PostsController < ApplicationController
@post.user ||= current_user
if @post.save
flash[:notice] = "Post was successfully created."
redirect_to topic_path(@post.topic, :page => @post.topic.posts.page.per(10).num_pages)
redirect_to topic_path(@post.topic, :page => @post.topic.posts.page.per(10).num_pages, :anchor => @post.id)
else
render :action => 'new'
end