Merge pull request #154 from neotericdesign/refactor-post

Refactor post
This commit is contained in:
Joe Sak 2011-12-08 09:54:09 -08:00
commit 5efcadcc80
10 changed files with 57 additions and 46 deletions

View file

@ -2,9 +2,7 @@ module BlogPostsHelper
def blog_archive_list
posts = BlogPost.live.select('published_at').all_previous
return nil if posts.blank?
html = '<section id="blog_archive_list"><h2>'
html << t('archives', :scope => 'blog.shared')
html << '</h2><nav><ul>'
html = ''
links = []
super_old_links = []
@ -34,7 +32,6 @@ module BlogPostsHelper
html << link_to(text, archive_blog_posts_path(:year => year))
html << "</li>"
end
html << '</ul></nav></section>'
html.html_safe
end

View file

@ -9,7 +9,12 @@
<%= f.label :title -%>
<%= f.text_field :title, :class => 'larger widest' -%>
</div>
<div class="field">
<p>
<%= f.check_box :draft %>
<%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
</p>
</div>
<div class='field'>
<div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
<ul id='page_parts'>
@ -59,10 +64,7 @@
:id => 'toggle_advanced_options',
:title => t('.toggle_advanced_options') %>
</p>
<span id='draft_field'>
<%= f.check_box :draft %>
<%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
</span>
</div>
<div id='more_options' style="display:none;">
<div class="hemisquare">

View file

@ -6,6 +6,9 @@
<%= " by #{post.author.username}" if post.author.present? %>
</span>
</span>
<% if post.draft? %>
<span class="label notice">Draft</span>
<% end %>
<span class='actions'>
<%= link_to refinery_icon_tag("application_go.png"), blog_post_url(post),
:title => t('.view_live_html'),

View file

@ -1,31 +0,0 @@
<% flash.each do |key, value| %>
<div id='flash' class="flash flash_<%= key %>">
<%= value %>
</div>
<% end %>
<article id="blog_post">
<header>
<h1><%= @blog_post.title %></h1>
<section class='details'>
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
<%= t('created_at', :scope => 'blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
</time>
<%= "#{t('by', :scope => 'blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
<% if (categories = @blog_post.categories).any? %>
<aside class='filed_in'>
<%= t('filed_in', :scope => 'blog.posts.show') %>
<% categories.each_with_index do |category, index| %>
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
<% end %>
</aside>
<% end %>
</section>
</header>
<%= @blog_post.body.html_safe %>
<% if BlogPost::ShareThis.enabled? %>
<span class="st_sharethis" displayText="ShareThis"></span>
<% end %>
</article>
<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%>
<%= render 'nav' if next_or_previous?(@blog_post) %>

View file

@ -13,7 +13,7 @@
<%= render :partial => "/blog/shared/categories" %>
<%= render :partial => "/blog/shared/tags" %>
<%= render :partial => "/blog/shared/rss_feed" %>
<%= blog_archive_list %>
<%= render :partial => "/blog/shared/archive_list" %>
<% end %>
<%= render :partial => "/shared/content_page" %>

View file

@ -17,7 +17,7 @@
<%= render :partial => "/blog/shared/categories" %>
<%= render :partial => "/blog/shared/tags" %>
<%= render :partial => "/blog/shared/rss_feed" %>
<%= blog_archive_list %>
<%= render :partial => "/blog/shared/archive_list" %>
<% end %>
<%= render :partial => "/shared/content_page" %>

View file

@ -1,6 +1,37 @@
<% content_for :body_content_left do %>
<div id="show_blog_post">
<%= render 'post' %>
<% flash.each do |key, value| %>
<div id='flash' class="flash flash_<%= key %>">
<%= value %>
</div>
<% end %>
<article id="blog_post">
<header>
<h1><%= @blog_post.title %></h1>
<section class='details'>
<time datetime="<%=l @blog_post.published_at.to_date, :format => :default %>" class='posted_at'>
<%= t('created_at', :scope => 'blog.shared.posts', :when => l(@blog_post.published_at.to_date, :format => :short)) %>
</time>
<%= "#{t('by', :scope => 'blog.posts.show')} #{@blog_post.author.username}" if @blog_post.author.present? %>.
<% if (categories = @blog_post.categories).any? %>
<aside class='filed_in'>
<%= t('filed_in', :scope => 'blog.posts.show') %>
<% categories.each_with_index do |category, index| %>
<%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
<% end %>
</aside>
<% end %>
</section>
</header>
<%= @blog_post.body.html_safe %>
<% if BlogPost::ShareThis.enabled? %>
<span class="st_sharethis" displayText="ShareThis"></span>
<% end %>
</article>
<%= render :partial => '/shared/draft_page_message' unless @blog_post.nil? or @blog_post.live? -%>
<%= render 'nav' if next_or_previous?(@blog_post) %>
</div>
<% if BlogPost.comments_allowed? %>
@ -50,9 +81,9 @@
<% content_for :body_content_right do %>
<%= render :partial => "/blog/shared/categories" %>
<%= render :partial => "/blog/shared/tags" %>
<%= render :partial => "/blog/shared/posts" %>
<%= render :partial => "/blog/shared/related_posts" %>
<%= render :partial => "/blog/shared/rss_feed" %>
<%= blog_archive_list %>
<%= render :partial => "/blog/shared/archive_list" %>
<% end %>
<%= render :partial => "/shared/content_page", :locals => { :remove_automatic_sections => true } %>

View file

@ -15,7 +15,7 @@
<%= render :partial => "/blog/shared/categories" %>
<%= render :partial => "/blog/shared/tags" %>
<%= render :partial => "/blog/shared/rss_feed" %>
<%= blog_archive_list %>
<%= render :partial => "/blog/shared/archive_list" %>
<% end %>
<%= render :partial => "/shared/content_page" %>

View file

@ -0,0 +1,9 @@
<%
archive_posts = blog_archive_list
%>
<% if archive_posts.present? %>
<h2><%= t('archives', :scope => 'blog.shared') %></h2>
<ul>
<%= archive_posts %>
</ul>
<% end %>