summaryrefslogtreecommitdiff
path: root/app/views/forums/edit.html.erb
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/forums/edit.html.erb')
-rw-r--r--app/views/forums/edit.html.erb24
1 files changed, 17 insertions, 7 deletions
diff --git a/app/views/forums/edit.html.erb b/app/views/forums/edit.html.erb
index 571b3b7..8b01b45 100644
--- a/app/views/forums/edit.html.erb
+++ b/app/views/forums/edit.html.erb
@@ -1,5 +1,11 @@
<% title "Edit Forum: #{@forum.name}" %>
+<%
+ def can_edit?
+ admin? && current_user.confirmed?
+ end
+%>
+
<%= link_to "(Edit) #{@forum.group.name}", edit_forumgroup_path(@forum.group) %> → <%= @forum.name %>
<h1>Edit Forum</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
@@ -7,26 +13,30 @@
<table>
<tr>
<td><%= f.label :name %></td>
- <td><%= f.text_field :name, placeholder: "Name" %></td>
+ <td><%= f.text_field :name, placeholder: "Name", disabled: !can_edit? %></td>
</tr>
<tr>
<td><%= f.label :position %></td>
- <td><%= f.number_field :position, placeholder: "Position" %></td>
+ <td><%= f.number_field :position, placeholder: "Position", disabled: !can_edit? %></td>
</tr>
<tr>
<td><%= f.label :role_read_id, "Min. read role" %></td>
- <td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td>
+ <td><%= f.select :role_read_id, role_selection, { include_blank: "None" }, { disabled: !can_edit? } %></td>
</tr>
<tr>
<td><%= f.label :role_write_id, "Min. write role" %></td>
- <td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
+ <td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_edit? } %></td>
</tr>
<tr>
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
- <td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td>
+ <td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)", disabled: !can_edit? %></td>
</tr>
</table>
- <p><%= f.submit "Update forum", class: "btn blue left" %></p>
+ <p><%= f.submit "Update forum", class: "btn blue left", disabled: !can_edit? %></p>
<% end %>
-<p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right" %></p>
+<p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right", disabled: !can_edit? %></p>
<div class="clear"></div>
+
+<% if !current_user.confirmed? %>
+ <span class='red-alert'>You must confirm your email before you can edit forums.</span>
+<% end %>