aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb
blob: b0be2583ba569c8c14c025a1973e70651a1731cb (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
<%
  granted_users=users(@role, params[:resource])
  ungranted_users=(all_users - granted_users)
  if @project
     title=h(@project.name)
   elsif @role.starts_with?('default-')
     title="Default project #{role_name(@role)}"
   else
     title="Global #{role_name(@role)}"
   end
%>
<div class="subtitle">&raquo; <a href="<%= url_for :action => params[:redirect] -%>">Back</a></div>
<h1><%= title  %></h1>
<br/>
<div id="main_content">
  <form action="<%= url_for :action => 'grant_users' -%>" 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" />
    <table>
      <tbody>
        <tr>
          <td style="padding: 5px 0pt;" valign="top">
            <h2>Ungranted users</h2>
            <select name="from" id="from" size="30" style="margin: 5px 0pt; width: 300px;" multiple="multiple">
              <% ungranted_users.sort.each do |user| %>
                <option value="<%= user.id -%>"><%= user.name -%></option>
              <% end %>
            </select>
          </td>
          <td style="padding: 0pt 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: <%= role_name(@role) -%></h2>

            <select name="users[]" id="to" size="30" multiple="multiple" style="margin: 5px 0pt; width: 300px;">
              <%= options_from_collection_for_select(granted_users, "id", "name") %>
            </select><br>

            <div style="padding: 5px 0pt;">
              <input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </form>
  <script>
    SelectBox.init('from');
    SelectBox.init('to');
  </script>
</div>