aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb
blob: 7a258bc5218b2786e924f8f9fd19b9693ae1db49 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<%
  granted_groups=groups(@role, params[:resource])
  ungranted_groups=all_groups - granted_groups
  if @project
     title='Role Membership For: ' + h(@project.name)
   else
     title="#{global_role_name(@role)}"
   end
%>
<div class="subtitle">&raquo; <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>">Back</a></div>
<h1><%= title %></h1>
<br/>
<div>
  <form action="<%= url_for :action => 'set_groups' -%>" method="post">
    <input name="resource" value="<%= params[:resource] -%>" type="hidden"/>
    <input name="role" value="<%= @role -%>" type="hidden"/>
    <input name="redirect" value="<%= params[:redirect] -%>" type="hidden"/>
    <input name="q" value="<%= params[:q] -%>" type="hidden" />
    <input name="qualifier" value="<%= params[:qualifier] -%>" type="hidden" />
    <input name="page" value="<%= params[:page] -%>" type="hidden" />
    <table>
      <tbody>
        <tr>
          <td style="padding: 5px 0;" valign="top">
            <h2>Add Groups</h2>
            <select name="from" id="from" size="20" style="margin: 5px 0; width: 300px;" multiple="multiple">
              <% ungranted_groups.each do |group| %>
                <option value="<%= group ? group.id : '' -%>"><%= group_name(group) -%></option>
              <% end %>
            </select>
          </td>
          <td style="padding: 0 10px;" align="center">
            <button id="select_right" onclick="SelectBox.move('from', 'to');SelectBox.sort('to');SelectBox.redisplay('to');return false;">select >></button><br>
            <button id="select_right_all" onclick="SelectBox.move_all('from', 'to');return false;">select all >></button><br><br>
            <button id="select_left" onclick="SelectBox.move('to', 'from');return false;"><< unselect</button><br>
            <button id="select_left_all" onclick="SelectBox.move_all('to', 'from');return false;"><< unselect all</button>
          </td>
          <td class="box" style="padding: 5px 10px;" valign="top">
            <h2>Role: <%= @project ? role_name(@role) : global_role_name(@role) -%></h2>

            <select name="groups[]" id="to" size="20" multiple="multiple" style="margin: 5px 0pt; width: 300px;">
              <% granted_groups.each do |group| %>
                <option value="<%= group ? group.id : '' -%>"><%= group_name(group) -%></option>
              <% end %>
            </select><br>

            <div style="padding: 5px 0;">
              <input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
              <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>"><%= message 'cancel' -%></a>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </form>
  <script>
    SelectBox.init('from');
    SelectBox.init('to');
  </script>
</div>