summaryrefslogtreecommitdiff
path: root/app/views/blogposts/new.html.erb
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/blogposts/new.html.erb')
-rw-r--r--app/views/blogposts/new.html.erb16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/views/blogposts/new.html.erb b/app/views/blogposts/new.html.erb
index b923002..64a69c4 100644
--- a/app/views/blogposts/new.html.erb
+++ b/app/views/blogposts/new.html.erb
@@ -1,9 +1,19 @@
<% title "New Blog Post" %>
+<%
+ def can_create?
+ admin? && current_user.confirmed?
+ end
+%>
+
<h1>New Post</h1>
<%= form_for @post do |f|%>
- <%= f.text_field :title, placeholder: "Title" %>
- <%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content} %>
- <p><%= f.submit "Create Post", class: "btn blue left" %></p>
+ <%= f.text_field :title, placeholder: "Title", disabled: !can_create? %>
+ <%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content, options: {disabled: !can_create?}} %>
+ <p><%= f.submit "Create Post", class: "btn blue left", disabled: !can_create? %></p>
<div class="clear"></div>
+
+ <% if !current_user.confirmed? %>
+ <span class='red-alert'>You must confirm your email before you can create new blog posts.</span>
+ <% end %>
<% end %>