-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating fragment caching and compartmentalizing partials.
- Loading branch information
Russell Branca
committed
Feb 16, 2010
1 parent
38803db
commit cf0fdcb
Showing
22 changed files
with
264 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
!*.gitignore | ||
public/uploads | ||
public/cache/* | ||
!public/cache/.gitignore | ||
tmp | ||
.DS_Store | ||
public/system | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
#col_left | ||
- if @featured_items.present? | ||
= render :partial => 'shared/featured_items', :locals => { :featured_items => @featured_items } | ||
= render :partial => 'shared/featured_items' | ||
= render :partial => 'shared/stories' | ||
|
||
#col_right | ||
= render :partial => 'shared/sidebar/top_stories', :locals => { :top_stories => @top_stories } | ||
= render :partial => 'shared/sidebar/top_discussed_stories', :locals => { :most_discussed_stories => @most_discussed_stories } | ||
= render :partial => 'shared/sidebar/top_users', :locals => { :top_users => @top_users } | ||
= render :partial => 'shared/sidebar/newest_users', :locals => { :newest_users => @newest_users } | ||
= render :partial => 'shared/sidebar/top_stories' | ||
= render :partial => 'shared/sidebar/top_discussed_stories' | ||
= render :partial => 'shared/sidebar/top_users' | ||
= render :partial => 'shared/sidebar/newest_users' | ||
= render :partial => 'shared/sidebar/active_users' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
#col_left | ||
- if @featured_items.present? | ||
= render :partial => 'shared/featured_items', :locals => { :featured_items => @featured_items } | ||
= render :partial => 'shared/featured_items' | ||
= render :partial => 'shared/stories' | ||
|
||
#col_right | ||
= render :partial => 'shared/sidebar/top_stories', :locals => { :top_stories => @top_stories } | ||
= render :partial => 'shared/sidebar/top_discussed_stories', :locals => { :most_discussed_stories => @most_discussed_stories } | ||
= render :partial => 'shared/sidebar/top_users', :locals => { :top_users => @top_users } | ||
= render :partial => 'shared/sidebar/newest_users', :locals => { :newest_users => @newest_users } | ||
= render :partial => 'shared/sidebar/top_stories' | ||
= render :partial => 'shared/sidebar/top_discussed_stories' | ||
= render :partial => 'shared/sidebar/top_users' | ||
= render :partial => 'shared/sidebar/newest_users' | ||
= render :partial => 'shared/sidebar/active_users' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
#featurePanel.clearfix | ||
.panelBar.clearfix | ||
%h2 Featured Content | ||
#featuredStories | ||
- section1 = featured_items.children.first | ||
- section2 = featured_items.children.second | ||
- case featured_items.featured_type | ||
- when 'template_1' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
- when 'template_2' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
- secondary1 = section1.children.second.featurable | ||
- secondary2 = section1.children.third.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
.related_story | ||
.bullet_list | ||
%ul | ||
%li= link_to secondary1.featured_title, secondary1.featured_url | ||
%li= link_to secondary2.featured_title, secondary2.featured_url | ||
- cache :featured_items do | ||
- featured_items ||= FeaturedItem.find_root_by_item_name('featured_template') | ||
- if featured_items.present? | ||
#featurePanel.clearfix | ||
.panelBar.clearfix | ||
%h2 Featured Content | ||
#featuredStories | ||
- section1 = featured_items.children.first | ||
- section2 = featured_items.children.second | ||
- case featured_items.featured_type | ||
- when 'template_1' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
- when 'template_2' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
- secondary1 = section1.children.second.featurable | ||
- secondary2 = section1.children.third.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
.related_story | ||
.bullet_list | ||
%ul | ||
%li= link_to secondary1.featured_title, secondary1.featured_url | ||
%li= link_to secondary2.featured_title, secondary2.featured_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
#featurePanel.clearfix | ||
.panelBar.clearfix | ||
%h2 Featured Content | ||
#featuredStories | ||
- section1 = featured_items.children.first | ||
- section2 = featured_items.children.second | ||
- case featured_items.featured_type | ||
- when 'template_1' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
- when 'template_2' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
- secondary1 = section1.children.second.featurable | ||
- secondary2 = section1.children.third.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
.related_story | ||
.bullet_list | ||
%ul | ||
%li= link_to secondary1.featured_title, secondary1.featured_url | ||
%li= link_to secondary2.featured_title, secondary2.featured_url | ||
- cache :featured_items do | ||
- featured_items ||= FeaturedItem.find_root_by_item_name('featured_template') | ||
- if featured_items.present? | ||
#featurePanel.clearfix | ||
.panelBar.clearfix | ||
%h2 Featured Content | ||
#featuredStories | ||
- section1 = featured_items.children.first | ||
- section2 = featured_items.children.second | ||
- case featured_items.featured_type | ||
- when 'template_1' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
- when 'template_2' | ||
.featured_story.clearfix | ||
- primary1 = section1.children.first.featurable | ||
- secondary1 = section1.children.second.featurable | ||
- secondary2 = section1.children.third.featurable | ||
#story_1_image.thumb= link_to image_tag(primary1.featured_image_url), primary1.featured_url | ||
.storyBlockWrap | ||
%h1#story_1_title= link_to primary1.featured_title, primary1.featured_url | ||
%p#story_1_caption= primary1.featured_blurb | ||
.related_story | ||
.bullet_list | ||
%ul | ||
%li= link_to secondary1.featured_title, secondary1.featured_url | ||
%li= link_to secondary2.featured_title, secondary2.featured_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
.panel_1 | ||
.panelBar.clearfix | ||
%h2= t('.stories_title') | ||
.subtitle | ||
%span= t('.stories_subtitle') | ||
.storyList | ||
.list_stories.clearfix | ||
%ul | ||
- @contents.each do |content| | ||
%li | ||
.thumb | ||
- if content.content_image.present? | ||
%img{:alt => "story image", :src => content.content_image.url} | ||
.storyBlockWrap | ||
%p.storyHead= link_to content.title, story_path(content) | ||
%p.storyCaption= linked_story_caption content | ||
.profilePic= local_linked_profile_pic content.user | ||
.storyBlockMeta | ||
%p= t('.stories_posted_by', :fb_name => local_linked_profile_name(content.user), :date => time_ago_in_words(content.created_at)) | ||
%p | ||
%span.btn_left== #{link_to t('.stories_like'), like_story_path(content.id), :class => "voteLink"} #{content.votes.size} | ||
%span.btn_mid== #{link_to t('.stories_comments'), story_path(content, :anchor => "commentListTop")} #{content.comments_count} | ||
%span.btn_right= t('.stories_share') | ||
- unless @no_paginate | ||
.clearfix | ||
= will_paginate @contents | ||
%br | ||
- cache :stories_list do | ||
- contents ||= Content.paginate :page => params[:page], :per_page => 10, :order => "created_at desc" | ||
- no_paginate ||= false | ||
.panel_1 | ||
.panelBar.clearfix | ||
%h2= t('.stories_title') | ||
.subtitle | ||
%span= t('.stories_subtitle') | ||
.storyList | ||
.list_stories.clearfix | ||
%ul | ||
- contents.each do |content| | ||
%li | ||
.thumb | ||
- if content.content_image.present? | ||
%img{:alt => "story image", :src => content.content_image.url} | ||
.storyBlockWrap | ||
%p.storyHead= link_to content.title, story_path(content) | ||
%p.storyCaption= linked_story_caption content | ||
.profilePic= local_linked_profile_pic content.user | ||
.storyBlockMeta | ||
%p= t('.stories_posted_by', :fb_name => local_linked_profile_name(content.user), :date => time_ago_in_words(content.created_at)) | ||
%p | ||
%span.btn_left== #{link_to t('.stories_like'), like_story_path(content.id), :class => "voteLink"} #{content.votes.size} | ||
%span.btn_mid== #{link_to t('.stories_comments'), story_path(content, :anchor => "commentListTop")} #{content.comments_count} | ||
%span.btn_right= t('.stories_share') | ||
- unless no_paginate | ||
.clearfix | ||
= will_paginate contents | ||
%br |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
.panel_1 | ||
.panelBar.clearfix | ||
%h2= t('.stories_title') | ||
.subtitle | ||
%span= t('.stories_subtitle') | ||
.storyList | ||
.list_stories.clearfix | ||
%ul | ||
- @contents.each do |content| | ||
%li | ||
.thumb | ||
- if content.content_image.present? | ||
%img{:alt => "story image", :src => content.content_image.url} | ||
.storyBlockWrap | ||
%p.storyHead= link_to content.title, story_path(content) | ||
%p.storyCaption= linked_story_caption content | ||
.profilePic= local_linked_profile_pic content.user | ||
.storyBlockMeta | ||
%p= t('.stories_posted_by', :fb_name => local_linked_profile_name(content.user), :date => time_ago_in_words(content.created_at)) | ||
%p | ||
%span.btn_left== #{link_to t('.stories_like'), like_story_path(content.id), :class => "voteLink"} #{content.votes.size} | ||
%span.btn_mid== #{link_to t('.stories_comments'), story_path(content, :anchor => "commentListTop")} #{content.comments_count} | ||
%span.btn_right= t('.stories_share') | ||
- unless @no_paginate | ||
.clearfix | ||
= will_paginate @contents | ||
%br | ||
- cache :stories_list do | ||
- contents ||= Content.paginate :page => params[:page], :per_page => 10, :order => "created_at desc" | ||
- no_paginate ||= false | ||
.panel_1 | ||
.panelBar.clearfix | ||
%h2= t('.stories_title') | ||
.subtitle | ||
%span= t('.stories_subtitle') | ||
.storyList | ||
.list_stories.clearfix | ||
%ul | ||
- contents.each do |content| | ||
%li | ||
.thumb | ||
- if content.content_image.present? | ||
%img{:alt => "story image", :src => content.content_image.url} | ||
.storyBlockWrap | ||
%p.storyHead= link_to content.title, story_path(content) | ||
%p.storyCaption= linked_story_caption content | ||
.profilePic= local_linked_profile_pic content.user | ||
.storyBlockMeta | ||
%p= t('.stories_posted_by', :fb_name => local_linked_profile_name(content.user), :date => time_ago_in_words(content.created_at)) | ||
%p | ||
%span.btn_left== #{link_to t('.stories_like'), like_story_path(content.id), :class => "voteLink"} #{content.votes.size} | ||
%span.btn_mid== #{link_to t('.stories_comments'), story_path(content, :anchor => "commentListTop")} #{content.comments_count} | ||
%span.btn_right= t('.stories_share') | ||
- unless no_paginate | ||
.clearfix | ||
= will_paginate contents | ||
%br |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
-# @expects: local 'active_users' | ||
- active_users ||= User.last_active | ||
- cache :active_users do | ||
- active_users ||= User.last_active | ||
|
||
.panel_2 | ||
.panelBar.clearfix | ||
%h2= t('.title') | ||
%br | ||
.list_stories.clearfix | ||
%ul | ||
- active_users.each do |user| | ||
%li | ||
.profilePic= local_linked_profile_pic user | ||
== #{link_to user.name, user_path(user)} active #{time_ago_in_words user.last_active} ago | ||
.panel_2 | ||
.panelBar.clearfix | ||
%h2= t('.title') | ||
%br | ||
.list_stories.clearfix | ||
- unless active_users.empty? | ||
%ul | ||
- active_users.each do |user| | ||
%li | ||
.profilePic= local_linked_profile_pic user | ||
== #{link_to user.name, user_path(user)} active #{time_ago_in_words user.last_active} ago | ||
- else | ||
%p No currently active users. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
-# @expects: local 'newest_users' | ||
- unless newest_users.empty? | ||
.panel_2 | ||
.panelBar.clearfix | ||
%h2= t('.newest_users_title') | ||
%br | ||
.list_stories.clearfix | ||
%ul | ||
- newest_users.each do |user| | ||
%li | ||
.profilePic= local_linked_profile_pic user | ||
== #{link_to user.name, user_path(user)} registered #{time_ago_in_words user.created_at} ago | ||
- cache :newest_users do | ||
- newest_users ||= User.newest | ||
- unless newest_users.empty? | ||
.panel_2 | ||
.panelBar.clearfix | ||
%h2= t('.newest_users_title') | ||
%br | ||
.list_stories.clearfix | ||
%ul | ||
- newest_users.each do |user| | ||
%li | ||
.profilePic= local_linked_profile_pic user | ||
== #{link_to user.name, user_path(user)} registered #{time_ago_in_words user.created_at} ago |
Oops, something went wrong.