1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<% title "Manage Forums" %>
<%
def can_edit?
admin? && current_user.confirmed?
end
%>
<h1>Manage Forums</h1>
<div class="item-group">
<div class="header">
Forums
</div>
<div class="items bold">
<% @group.forums.each do |forum| %>
<%= link_to forum.name, edit_forum_path(forum), class: "item" %>
<% end %>
<div class="item"><%= link_to "Add Forum", new_forum_path(forumgroup: @group), class: "btn blue" %></div>
</div>
</div>
<hr>
<h1>Edit Forum Group</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @group do |f|%>
<table>
<tr>
<td><%= f.label :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", 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" }, { 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 }, { disabled: !can_edit? } %></td>
</tr>
</table>
<p><%= f.submit "Update group", class: "btn blue left", disabled: !can_edit? %></p>
<% end %>
<p><%= button_to "Delete group", @group, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not 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 forum groups.</span>
<% end %>
|