app/views/posts/index.html.haml
- posts.each do |post|
%article
%header
%h1= post.title
= gravatar_for(post.user, size: 20)
%span= post.user.username
%time{datetime: post.created_at.strftime("%F")}= post.created_at.strftime("%d, %b %Y")
=raw RDiscount.new(post.body, :smart).to_html
- if user_signed_in? && current_user.admin?
%nav.admin-menu
= link_to "Edit Post", edit_post_path(post), class: "button admin_button"
= link_to "Delete Post", post_path(post), method: :delete, confirm: "Are you REALLY sure?", class: "button admin_button"