]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4498 Use modal windows in the "Roles" page to select groups/users
authorJulien Lancelot <julien.lancelot@gmail.com>
Mon, 15 Jul 2013 06:33:56 +0000 (08:33 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Mon, 15 Jul 2013 17:36:29 +0000 (19:36 +0200)
12 files changed:
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_groups.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/_edit_users.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/roles/_edit_groups.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/roles/_edit_users.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_default_project_groups.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_default_project_users.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb

index e6e567d880d393b8d6141b7658db9323c4206cef..8badcd35be4c81654930e0d27f44e6a5feb1e6f1 100644 (file)
@@ -2242,7 +2242,7 @@ global_permissions.dryRunScan.desc=Ability to execute local (dry run) analyses w
 
 #------------------------------------------------------------------------------
 #
-# PROJECTS ROLES
+# PROJECTS PERMISSIONS
 #
 #------------------------------------------------------------------------------
 projects_role.criteria.name=Name contains
@@ -2250,11 +2250,11 @@ projects_role.criteria.key=Key contains
 projects_role.role=Role Membership For New
 projects_role.users=Users
 projects_role.groups=Groups
-projects_role.admin=Role: Administrators
+projects_role.admin=Administrators
 projects_role.admin.desc=Ability to perform administration tasks for the project by accessing its settings.
-projects_role.user=Role: Users
+projects_role.user=Users
 projects_role.user.desc=Ability to browse the measures and to create/edit issues on the project.
-projects_role.codeviewer=Role: Code Viewers
+projects_role.codeviewer=Code Viewers
 projects_role.codeviewer.desc=Ability to view the source code of the project.
 projects_role.apply_template=Apply permission template
 projects_role.apply_template.form.title=Apply permission template
index df7403e2f323d734b71537a5ef8f3a0a7288c409..a7b55db8ebc0d016b9b1edb66d5cde5254a2551b 100644 (file)
@@ -50,21 +50,13 @@ class RolesController < ApplicationController
   def edit_users
     @project=Project.by_key(params[:resource]) if params[:resource].present?
     @role = params[:role]
+    render :partial => 'edit_users'
   end
 
   def edit_groups
     @project=Project.by_key(params[:resource]) if params[:resource].present?
     @role = params[:role]
-  end
-
-  def edit_default_project_groups
-    bad_request('Missing role') if params[:role].blank?
-    bad_request('Missing qualifier') if params[:qualifier].blank?
-  end
-
-  def edit_default_project_users
-    bad_request('Missing role') if params[:role].blank?
-    bad_request('Missing qualifier') if params[:qualifier].blank?
+    render :partial => 'edit_groups'
   end
 
   def apply_template_form
@@ -78,7 +70,7 @@ class RolesController < ApplicationController
   def set_users
     bad_request('Missing role') if params[:role].blank?
     UserRole.grant_users(params[:users], params[:role], params[:resource])
-    redirect
+    render :text => '', :status => 200
   end
 
   def set_groups
index a5d0a387401731413ab98ff9053d0c059b7fffb6..fce1c8391369387c8c18233d77323611f632b0b2 100644 (file)
@@ -4,9 +4,10 @@
   <input type="hidden" name="permission" value="<%= @permission -%>"/>
   <fieldset>
     <div class="modal-head">
-      <h2><%= message("permission_template.edit_permissions") -%></h2>
+      <h2><%= message('permission_template.edit_permissions') -%></h2>
     </div>
     <div class="modal-body">
+      <div id="permission-template-error" class="permission-template error" style="display:none;" />
       <table>
         <tbody>
         <tr>
@@ -37,7 +38,7 @@
       </table>
     </div>
     <div class="modal-foot">
-      <input type="submit" onclick="SelectBox.select_all('to');" value="<%= h message("permission_template.update_permissions") -%>" id="submit-permission-template-update"/>
+      <input type="submit" onclick="SelectBox.select_all('to');" value="<%= h message('permission_template.update_permissions') -%>" id="submit-permission-template-update"/>
       <a href="#" onclick="return closeModalWindow()" id="cancel-update-template"><%= h message('cancel') -%></a>
     </div>
   </fieldset>
@@ -52,9 +53,9 @@
     },
     error: function (xhr, textStatus, errorThrown) {
       var htmlClass = 'permission-template';
-      $j('input[id^="submit-permission-template"]').removeAttr('disabled');
-      $j('.' + htmlClass + '.errors').show();
-      $j('.' + htmlClass + '.errors').html(xhr.responseText);
+      $j('input[id="submit-permission-template-update"]').removeAttr('disabled');
+      $j('.' + htmlClass + '.error').show();
+      $j('.' + htmlClass + '.error').html(xhr.responseText);
     }
   });
 </script>
index 9a2b7256cba6bddc3e324694569598a5ec45491f..9125985ed90b6f4c1ea2b14158e89959f3365a8c 100644 (file)
@@ -7,6 +7,7 @@
       <h2><%= message('permission_template.edit_permissions') -%></h2>
     </div>
     <div class="modal-body">
+      <div id="permission-template-error" class="permission-template error" style="display:none;" />
       <table>
         <tbody>
         <tr>
 <script>
   SelectBox.init('from');
   SelectBox.init('to');
+
   $j("#permission-template-form").modalForm({
     success: function (data) {
       window.location.reload();
     },
     error: function (xhr, textStatus, errorThrown) {
       var htmlClass = 'permission-template';
-      $j('input[id^="submit-permission-template"]').removeAttr('disabled');
-      $j('.' + htmlClass + '.errors').show();
-      $j('.' + htmlClass + '.errors').html(xhr.responseText);
+      $j('input[id="submit-permission-template-update"]').removeAttr('disabled');
+      $j('.' + htmlClass + '.error').show();
+      $j('.' + htmlClass + '.error').html(xhr.responseText);
     }
   });
 </script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_edit_groups.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_edit_groups.html.erb
new file mode 100644 (file)
index 0000000..d1d58d4
--- /dev/null
@@ -0,0 +1,67 @@
+<%
+  granted_groups=groups(@role, params[:resource])
+  ungranted_groups=all_groups - granted_groups
+%>
+<div>
+  <form id="permission-groups-form" action="<%= url_for :action => 'set_groups' -%>" method="post">
+    <input name="resource" value="<%= params[:resource] -%>" type="hidden"/>
+    <input name="role" value="<%= @role -%>" type="hidden"/>
+    <fieldset>
+      <div class="modal-head">
+        <h2><%= @project ? 'Edit permissions for: ' + h(@project.name) : "System #{role_name(@role)}" -%></h2>
+      </div>
+      <div class="modal-body">
+        <div id="permission-groups-error" class="permission-groups error" style="display:none;" />
+          <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>
+                </td>
+              </tr>
+            </tbody>
+          </table>
+      </div>
+      <div class="modal-foot">
+        <input type="submit" onclick="SelectBox.select_all('to');" value="<%= h message('save') -%>" id="submit-permission-groups-update"/>
+        <a href="#" onclick="return closeModalWindow()" id="cancel-update-permission-groups"><%= h message('cancel') -%></a>
+      </div>
+    </fieldset>
+  </form>
+  <script>
+    SelectBox.init('from');
+    SelectBox.init('to');
+
+    $j("#permission-groups-form").modalForm({
+      success: function (data) {
+        window.location.reload();
+      },
+      error: function (xhr, textStatus, errorThrown) {
+        var htmlClass = 'permission-groups';
+        $j('input[id="submit-permission-groups-update"]').removeAttr('disabled');
+        $j('.' + htmlClass + '.error').show();
+        $j('.' + htmlClass + '.error').html(xhr.responseText);
+      }
+    });
+  </script>
+</div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_edit_users.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_edit_users.html.erb
new file mode 100644 (file)
index 0000000..b5f8cd1
--- /dev/null
@@ -0,0 +1,64 @@
+<%
+   granted_users=users(@role, params[:resource])
+   ungranted_users=(all_users - granted_users)
+%>
+<form id="permission-users-form" action="<%= url_for :action => 'set_users' -%>" method="post">
+  <input name="resource" value="<%= params[:resource] -%>" type="hidden"/>
+  <input name="role" value="<%= @role -%>" type="hidden" />
+  <fieldset>
+    <div class="modal-head">
+      <h2><%= @project ? 'Edit permissions for: ' + h(@project.name) : "System #{role_name(@role)}" -%></h2>
+    </div>
+    <div class="modal-body">
+      <div id="permission-users-error" class="permission-users error" style="display:none;" />
+      <table>
+        <tbody>
+          <tr>
+            <td style="padding: 5px 0;" valign="top">
+              <h2>Add Users</h2>
+              <select name="from" id="from" size="30" style="margin: 5px 0; width: 300px;" multiple="multiple">
+                <% ungranted_users.each do |user| %>
+                  <option value="<%= user.id -%>"><%= user.name -%></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>Permission: <%=  @project ? role_name(@role) : global_role_name(@role) -%></h2>
+
+              <select name="users[]" id="to" size="30" multiple="multiple" style="margin: 5px 0; width: 300px;">
+                <%= options_from_collection_for_select(granted_users, "id", "name") %>
+              </select><br>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+    <div class="modal-foot">
+      <input type="submit" onclick="SelectBox.select_all('to');" value="<%= h message('save') -%>" id="submit-permission-users-update"/>
+      <a href="#" onclick="return closeModalWindow()" id="cancel-update-permission-users"><%= h message('cancel') -%></a>
+    </div>
+  </fieldset>
+</form>
+<script>
+  SelectBox.init('from');
+  SelectBox.init('to');
+
+  $j("#permission-users-form").modalForm({
+    success: function (data) {
+      window.location.reload();
+    },
+    error: function (xhr, textStatus, errorThrown) {
+      var htmlClass = 'permission-users';
+      $j('input[id="submit-permission-users-update"]').removeAttr('disabled');
+      $j('.' + htmlClass + '.error').show();
+      $j('.' + htmlClass + '.error').html(xhr.responseText);
+    }
+  });
+</script>
+
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_default_project_groups.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_default_project_groups.html.erb
deleted file mode 100644 (file)
index 8d4a200..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<%
-  granted_groups=default_project_group_names(params[:role], params[:qualifier])
-  all_groups = ['Anyone'].concat(Api::Utils.insensitive_sort(Group.all.map{|group| group.name}))
-  ungranted_groups=all_groups - granted_groups
-%>
-<div class="subtitle">&raquo; <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>">Back</a></div>
-<h1>Role Membership For New <%= message("qualifiers.#{params[:qualifier]}") -%></h1>
-<br/>
-<div>
-  <form action="<%= url_for :action => 'set_default_project_groups' -%>" method="POST">
-    <input name="role" value="<%= params[:role] -%>" type="hidden"/>
-    <input name="redirect" value="projects" 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="<%= h group -%>"><%= 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: <%= role_name(params[:role]) -%></h2>
-
-            <select name="groups[]" id="to" size="20" multiple="multiple" style="margin: 5px 0; width: 300px;">
-              <% granted_groups.each do |group| %>
-                <option value="<%= h group -%>"><%= 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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_default_project_users.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_default_project_users.html.erb
deleted file mode 100644 (file)
index 9108ff5..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<%
-  granted_users=default_project_users(params[:role], params[:qualifier])
-  ungranted_users=all_users - granted_users
-%>
-<div class="subtitle">&raquo; <a href="<%= url_for :action => params[:redirect], :q => params[:q], :qualifier => params[:qualifier] -%>">Back</a></div>
-<h1>Role Membership For New <%= message("qualifiers.#{params[:qualifier]}") -%></h1>
-<br/>
-<div>
-  <form action="<%= url_for :action => 'set_default_project_users' -%>" method="POST">
-    <input name="role" value="<%= params[:role] -%>" type="hidden"/>
-    <input name="redirect" value="projects" 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 Users</h2>
-            <select name="from" id="from" size="20" style="margin: 5px 0; width: 300px;" multiple="multiple">
-              <% ungranted_users.each do |user| %>
-                <option value="<%= h user.login -%>"><%= h user.name -%></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: <%= role_name(params[:role]) -%></h2>
-
-            <select name="logins[]" id="to" size="20" multiple="multiple" style="margin: 5px 0; width: 300px;">
-              <% granted_users.each do |user| %>
-                <option value="<%= h user.login -%>"><%= h user.name -%></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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_groups.html.erb
deleted file mode 100644 (file)
index 7a258bc..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<%
-  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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/edit_users.html.erb
deleted file mode 100644 (file)
index 08f655b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<%
-  granted_users=users(@role, params[:resource])
-  ungranted_users=(all_users - granted_users)
-  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 id="main_content">
-  <form action="<%= url_for :action => 'set_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" />
-    <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 Users</h2>
-            <select name="from" id="from" size="30" style="margin: 5px 0; width: 300px;" multiple="multiple">
-              <% ungranted_users.each do |user| %>
-                <option value="<%= user.id -%>"><%= user.name -%></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="users[]" id="to" size="30" multiple="multiple" style="margin: 5px 0; width: 300px;">
-              <%= options_from_collection_for_select(granted_users, "id", "name") %>
-            </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>
index ff6e336ee74c15fe764f9c64af1312280bfc9f09..de6f010ae2f3582882cf42b8293eb1af2a90a012 100644 (file)
         <span class="small gray"><%= message('global_permissions.' + global_permission_key + '.desc') -%></span></td>
       <td valign="top" style="word-break:break-all;width:30%;">
         <span><%= users(global_permission_key).map(&:name).join(', ') -%></span>
-        (<%= link_to "select", {:action => 'edit_users', :role => global_permission_key, :redirect => 'global'}, :class => 'link-action', :id => "select-users-#{global_permission_key}" -%>)
+        (<%= link_to message('select'), {:action => :edit_users, :role => global_permission_key},
+                     :id => "select-users-#{global_permission_key}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
       </td>
       <td valign="top" style="word-break:break-all;width:30%;">
         <span><%= groups(global_permission_key).map{|g| group_name(g)}.join(', ') %></span>
-        (<%= link_to "select", {:action => 'edit_groups', :role => global_permission_key, :redirect => 'global'}, :class => 'link-action', :id => "select-groups-#{global_permission_key}" -%>)
+        (<%= link_to message('select'), {:action => :edit_groups, :role => global_permission_key},
+                     :id => "select-groups-#{global_permission_key}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
       </td>
     </tr>
     <% end %>
index d2bea8d3bfe65d64b9f3a431a68ced22b65aabe0..8fc851b830b5337347586429c2d1d20a27f37f5b 100644 (file)
            groups=Api::Utils.insensitive_sort(project.group_roles.select { |gr| gr.role=='admin' }.map { |gr| group_name(gr.group) })
         %>
         <span id="u-admin-<%= u project.kee -%>"><%= users.join(', ') %></span>
-        (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=admin&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action" id="selectu-admin-<%= u project.kee -%>">select users</a>)<br/>
+        (<%= link_to message('select users'), {:action => :edit_users, :role => 'admin', :resource => project.id},
+                     :id => "selectu-admin-#{u project.kee}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
         <span id="g-admin-<%= u project.kee -%>"><%= groups.join(', ') %></span>
-        (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=admin&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action" id="selectg-admin-<%= u project.kee -%>">select groups</a>)
+        (<%= link_to message('select groups'), {:action => :edit_groups, :role => 'admin', :resource => project.id},
+                     :id => "selectg-admin-#{u project.kee}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
       </td>
       <td valign="top">
         <%
            groups=Api::Utils.insensitive_sort(project.group_roles.select { |gr| gr.role=='user' }.map { |gr| group_name(gr.group) })
         %>
         <span id="u-user-<%= u project.kee -%>"><%= users.join(', ') %></span>
-        (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=user&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action" id="selectu-user-<%= u project.kee -%>">select users</a>)<br/>
+        (<%= link_to message('select users'), {:action => :edit_users, :role => 'user', :resource => project.id},
+                     :id => "selectu-user-#{u project.kee}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
         <span id="g-user-<%= u project.kee -%>"><%= groups.join(', ') %></span>
-        (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=user&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action" id="selectg-user-<%= u project.kee -%>">select groups</a>)
+        (<%= link_to message('select groups'), {:action => :edit_groups, :role => 'user', :resource => project.id},
+                     :id => "selectg-user-#{u project.kee}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
       </td>
       <td valign="top">
         <%
            groups=Api::Utils.insensitive_sort(project.group_roles.select { |gr| gr.role=='codeviewer' }.map { |gr| group_name(gr.group) })
         %>
         <span id="u-codeviewer-<%= u project.kee -%>"><%= users.join(', ') %></span>
-        (<a href="<%= ApplicationController.root_context -%>/roles/edit_users?redirect=projects&role=codeviewer&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action" id="selectu-codeviewer-<%= u project.kee -%>">select users</a>)<br/>
+        (<%= link_to message('select users'), {:action => :edit_users, :role => 'codeviewer', :resource => project.id},
+                     :id => "selectu-codeviewer-#{u project.kee}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
         <span id="g-codeviewer-<%= u project.kee -%>"><%= groups.join(', ') %></span>
-        (<a href="<%= ApplicationController.root_context -%>/roles/edit_groups?redirect=projects&role=codeviewer&resource=<%= project.id -%>&q=<%= u params[:q] -%>&qualifier=<%= @qualifier -%>&page=<%= params[:page] -%>" class="link-action" id="selectg-codeviewer-<%= u project.kee -%>">select groups</a>)
+        (<%= link_to message('select groups'), {:action => :edit_groups, :role => 'codeviewer', :resource => project.id},
+                     :id => "selectg-codeviewer-#{u project.kee}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)<br/>
       </td>
     </tr>
   <%