Created
November 16, 2010 15:15
-
-
Save sterrym/701914 to your computer and use it in GitHub Desktop.
app/views/partials/_blog_post.html.erb
This file contains hidden or 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
<% | |
# _counter is defined only if we pass :collection to the partial | |
if defined?(blog_post_counter) | |
showing_individual_post = false | |
else | |
showing_individual_post = true | |
blog_post_counter = 0 | |
end | |
%> | |
<div id="blog_post_<%= blog_post.id %>" class="blog_post"> | |
<div class="date"><%= blog_post.published_at.strftime("%B %d, %Y %I:%M%p") %></div> | |
<h2><%= link_to h(blog_post.name), href = _blog_post_path(blog_post) %></h2> | |
<% if blog_post.attachment %> | |
<div class="image"> | |
<%= image_tag blog_post.attachment.file_path %> | |
</div> | |
<% end %> | |
<div class="body"> | |
<% if showing_individual_post or blog_post.summary.blank? %> | |
<%= blog_post.body %> | |
<% else %> | |
<%= blog_post.summary %> | |
<p class="read_more"> | |
<%= link_to 'Read More »', href %> | |
</p> | |
<% end %> | |
</div> | |
<div class="meta"> | |
<% unless blog_post.category_id.blank? %> | |
Posted in <%= link_to h(blog_post.category_name), _blog_path(blog_post.blog, 'posts_in_category', :category => blog_post.category_name) %> | |
<strong>|</strong> | |
<% end %> | |
<% if blog_post.tags.any? %> | |
Tags: | |
<span class="tags"> | |
<%= blog_post.tags.map{|t| link_to(h(t.name), _blog_path(blog_post.blog, 'posts_with_tag', :tag => t.name)) }.join(", ") %> | |
</span> | |
<strong>|</strong> | |
<% end %> | |
<%#= link_to h(pluralize(blog_post.comments.published.count, "Comment")), "#{_blog_post_path(blog_post)}#comments" %> | |
</div> | |
</div> |
This file contains hidden or 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
<% page_title @page_title || @blog.name %> | |
<h1><%= @page_title || @blog.name %></h1> | |
<%= render :partial => "partials/blog_post", :collection => @blog_posts %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment