diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-08-09 14:24:49 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-08-09 15:07:11 +0200 |
commit | 2c333f3a9d3946eacb665f872e171fd9893f1b92 (patch) | |
tree | 796d3d9af567040839b8b3f7477763ae3cec241c | |
parent | 694c48a99d735e8f815f1b1046635d19b9d5761d (diff) | |
download | sonarqube-2c333f3a9d3946eacb665f872e171fd9893f1b92.tar.gz sonarqube-2c333f3a9d3946eacb665f872e171fd9893f1b92.zip |
SONAR-4550 Order the global permissions in alphabetical order
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb index cb593534e2e..1fadb885b8f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb @@ -1,27 +1,40 @@ -<h1 class="marginbottom10"><%= message 'global_permissions.page' -%></h1> +<h1 class="marginbottom10"><%= h message 'global_permissions.page' -%></h1> -<table class="data width100" id="global-roles"> +<table class="data width100" id="global-permissions"> <thead> <tr > - <th><%= message('global_permissions.permission') -%></th> - <th width="30%"><%= message('global_permissions.users') -%></th> - <th width="30%"><%= message('global_permissions.groups') -%></th> + <th><%= h message('global_permissions.permission') -%></th> + <th width="30%"><%= h message('global_permissions.users') -%></th> + <th width="30%"><%= h message('global_permissions.groups') -%></th> </tr> </thead> <tbody> - <% Java::OrgSonarCorePermission::Permission::allGlobal.keySet.each do |global_permission_key| %> + <% + permission_keys = Java::OrgSonarCorePermission::Permission::allGlobal.keySet + key_to_name = permission_keys.inject({}) do |hash, key| + hash[key] = message("global_permissions.#{key}") + hash + end + %> + + <% + # Note that sorting by names should be case insensitive but it's not the case. It's not a problem in this page. + key_to_name.sort{|a,b| a[1]<=>b[1]}.each do |elem| + permission_key = elem[0] + permission_name = elem[1] + %> <tr class="<%= cycle('even', 'odd', :name => 'global_permission') -%>" > <td valign="top"> - <b><%= message("global_permissions.#{global_permission_key}") -%></b><br/> - <span class="small gray"><%= message("global_permissions.#{global_permission_key}.desc") -%></span> + <b><%= h permission_name -%></b><br/> + <span class="small gray"><%= h message("global_permissions.#{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_edit_roles_permission_form(message('select'), global_permission_key, nil, "select-users-#{global_permission_key}") %>)<br/> + <span id="users-<%= permission_key.parameterize -%>"><%= users(permission_key).map(&:name).join(', ') -%></span> + (<%= link_to_edit_roles_permission_form(message('select'), permission_key, nil, "select-users-#{permission_key}") -%>)<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_edit_groups_permission_form(message('select'), global_permission_key, nil, "select-groups-#{global_permission_key}") %>)<br/> + <span id="groups-<%= permission_key.parameterize -%>"><%= groups(permission_key).map{|g| group_name(g)}.join(', ') %></span> + (<%= link_to_edit_groups_permission_form(message('select'), permission_key, nil, "select-groups-#{permission_key}") -%>)<br/> </td> </tr> <% end %> |