Permalink
Browse files

Adds 'new post' link to posts index

  • Loading branch information...
1 parent 716a031 commit eca0cf9f499a2c6f2b109c73431f59a98eccb710 Javier Fonseca V committed Nov 21, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 app/views/posts/index.html.erb
@@ -1,10 +1,17 @@
<h1>All the posts!</h1>
<ul>
+ <% if @posts.empty? %>
+ <p>No one has written a blog post so far.</p>
+ <% end %>
<% @posts.each do |post| %>
<li>
<%= link_to(post.title, post) %> -
<%= post.user.full_name %> -
<%= time_ago_in_words(post.created_at) %> ago
</li>
<% end %>
-</ul>
+</ul>
+
+<% if user_signed_in? %>
+<%= link_to "New post", new_post_path %>
+<% end %>

0 comments on commit eca0cf9

Please sign in to comment.