<% title "Edit News: #{@post.title}" %> <% def can_edit? mod? && current_user.confirmed? end %>

Edit post

<%= form_for @post do |f|%> <%= f.text_field :title, disabled: !can_edit? %> <%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content, options: {disabled: !can_edit?}} %>

<%= f.submit "Update Post", class: "btn blue left", disabled: !can_edit? %>

<% end %>

<%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right", disabled: !can_edit? %>

<% if !current_user.confirmed? %> You must confirm your email before you can edit blog posts. <% end %>