Skip to content

Commit

Permalink
adding additional sharing informations to other posts
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoLnx committed Sep 29, 2011
1 parent 2733a26 commit 9f8f7dc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/controllers/other_posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ def show
location = params[:location]
friendly_title = params[:id]
@post = Post.find(:location => location, :friendly_title => friendly_title)

@post_url = other_post_url(@post.location,@post.friendly_title)
prepare_to_render_show_with @post

prepare_to_render_show_with @post, @post_url

@pagehead = PageHead.new :keywords => @post.keywords.join(','),
:description => @post.description,
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/posts_base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
class PostsBaseController < ApplicationController
private
def prepare_to_render_show_with(post)
def prepare_to_render_show_with(post,post_url)
@comments = Comment.find_all_by_post_id(post.id)
@comment = Comment.new

@sharing_head = Infrastructure::SharingServicesHead.new(
:post => post,
:request => request,
:url => post_url
)
prepare_for_layout
end
end
8 changes: 1 addition & 7 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,14 @@ def show
friendly_id = params[:id]
@post = Post.find(:friendly_id => friendly_id, :location => LOCATION)
@post_url = post_url(@post.friendly_id)
prepare_to_render_show_with @post
prepare_to_render_show_with @post, @post_url

@pagehead = PageHead.new(
:keywords => @post.keywords.join(','),
:description => @post.description,
:title_complement => @post.title,
:robots => @robots_metatag
)

@sharing_head = Infrastructure::SharingServicesHead.new(
:post => @post,
:request => request,
:url => @post_url
)
end

def feed
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/without_layout/other_posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ def show
location = params[:location]
friendly_title = params[:id]
@post = Post.find(:location => location, :friendly_title => friendly_title)
@post_url = post_url @post.friendly_id

prepare_to_render_show_with @post
prepare_to_render_show_with @post, @post_url

render 'posts/show'
response.headers['title'] = @post.title
Expand Down
8 changes: 2 additions & 6 deletions app/controllers/without_layout/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ def show
@post = Post.find id
@post_url = post_url(@post.friendly_id)

@sharing_head = Infrastructure::SharingServicesHead.new(
:post => @post,
:request => request,
:url => @post_url
)
prepare_to_render_show_with @post
prepare_to_render_show_with @post, @post_url

render 'posts/show.html.erb'
response.content_type = "application/json"
response.body = {
Expand Down

0 comments on commit 9f8f7dc

Please sign in to comment.