Permalink
Browse files

Add day headings to home feed

  • Loading branch information...
adamdawkins committed Jan 23, 2019
1 parent dd3e9d5 commit 52f1e1e118471f7cdb3f56b0152c313405f87d5a
Showing with 8 additions and 1 deletion.
  1. +1 −0 app/controllers/posts_controller.rb
  2. +6 −0 app/views/posts/_day.html.erb
  3. +1 −1 app/views/posts/index.html.erb
@@ -8,6 +8,7 @@ def show

def index
@posts = Post.published
@posts_by_day = Post.published.group_by { |p| p.published_at.to_date }
end

private
@@ -0,0 +1,6 @@
<%
date = day[0].to_time
posts = day[1]
%>
<h3><%= date.strftime("#{date.day.ordinalize} %B %Y") %></h1>
<%= render posts %>
@@ -2,5 +2,5 @@
<%= render "shared/text_bio" %>
<h1>Latest</h1>
<p>You're seeing everything. You can view just my <%= link_to "articles", articles_path %> or <%= link_to "notes", notes_path %>.</p>
<%= render @posts %>
<%= render partial: "day", collection: @posts_by_day %>
</div>

0 comments on commit 52f1e1e

Please sign in to comment.