summaryrefslogtreecommitdiff
path: root/app/views/forumgroups/new.html.erb
blob: 70cf4dc8a1fc862f9ab3bbf0945486fb5f0a2730 (plain)
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
<% title "New Forum: #{@group.name}" %>

<%
  def can_create?
    admin? && current_user.confirmed?
  end
%>

<h1>New 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_create? %></td>
    </tr>
    <tr>
      <td><%= f.label :position %></td>
      <td><%= f.number_field :position, placeholder: "Position", disabled: !can_create? %></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_create? } %></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_create? } %></td>
    </tr>
  </table>
  <p><%= f.submit "Create group", 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 forum groups.</span>
  <% end %>
<% end %>