<% title "New Blog Post" %> <% def can_create? admin? && current_user.confirmed? end %>

New Post

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

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

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