aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-07-09 18:06:09 +0200
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-07-09 18:06:09 +0200
commit4a2646e9747e845ca840c3e627206b7788b4a60e (patch)
tree7b67744e326c174a2c0271773566399cbd3a1504
parentf6e5025bc585659aebf9c37bef91d038b6959305 (diff)
downloadsonarqube-4a2646e9747e845ca840c3e627206b7788b4a60e.tar.gz
sonarqube-4a2646e9747e845ca840c3e627206b7788b4a60e.zip
SONAR-4467 Added 'default' column in permission templates display table
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb5
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb18
2 files changed, 17 insertions, 6 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb
index 6fa03c175a4..164a7ea91bb 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb
@@ -48,9 +48,10 @@ class PermissionTemplatesController < ApplicationController
@root_qualifiers = get_root_qualifiers
@default_templates = {}
+ default_template_property = Property.by_key("sonar.permission.template.default")
@root_qualifiers.each do |qualifier|
- default_template_property = Property.by_key("sonar.permission.template.#{qualifier}.default")
- @default_templates[qualifier] = default_template_property.text_value unless default_template_property.nil?
+ qualifier_template = Property.by_key("sonar.permission.template.#{qualifier}.default")
+ @default_templates[qualifier] = qualifier_template ? qualifier_template.text_value : default_template_property.text_value
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
index 208d1af468a..53b16888363 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
@@ -10,7 +10,7 @@
<% @root_qualifiers.each do |qualifier| %>
<%= label_tag("default_template_#{qualifier}", "Default permission template for #{message('qualifier.' + qualifier)}:") %>
- <%= select_tag("default_template_#{qualifier}", options_for_select(@permission_templates_options, @default_templates[qualifier] ? @default_templates[qualifier].to_i : -1)) %>
+ <%= select_tag("default_template_#{qualifier}", options_for_select(@permission_templates_options, @default_templates[qualifier])) %>
<% end %>
<br/>
<br/>
@@ -33,6 +33,7 @@
<th class="left">Administrators</th>
<th class="left">Users</th>
<th class="left">Code viewers</th>
+ <th class="left" width="8%"><%= message('default') -%></th>
<th class="right" width="5%" colspan="2"><%= message('operations') -%></th>
</tr>
</thead>
@@ -40,7 +41,7 @@
<tbody>
<% if @permission_templates.empty? %>
<tr class="even">
- <td colspan="6" align="left"><%= message('permission_template.no_results') %></td>
+ <td colspan="7" align="left"><%= message('permission_template.no_results') %></td>
</tr>
<% end %>
<% @permission_templates.each do |permission_template| %>
@@ -84,13 +85,22 @@
(<%= link_to message('select groups'), {:action => :edit_groups, :name => permission_template.name, :permission => 'codeviewer'},
:id => "selectg-codeviewer-#{u permission_template.name}", :class => 'open-modal link-action', 'modal-width' => '760px' %>)
</td>
+ <td>
+ <% if @default_templates.values.include?(permission_template.id.to_s)
+ qualifier = @default_templates.invert[permission_template.id.to_s]
+ %>
+ <%= image_tag 'tick.png', :id => "is_active_#{u permission_template.name}" %><span class="small gray">(Default for <%= message('qualifier.' + qualifier) %>)</span>
+ <% end %>
+ </td>
<td align="right">
<%= link_to message('edit'), {:action => :edit_form, :name => permission_template.name},
:id => "edit-template-#{u permission_template.name}", :class => 'open-modal link-action' %>
</td>
<td align="right">
- <%= link_to message('delete'), {:action => :delete_form, :name => permission_template.name},
- :id => "delete-template-#{u permission_template.name}", :class => 'open-modal link-action link-red' %>
+ <% unless @default_templates.values.include?(permission_template.id.to_s) %>
+ <%= link_to message('delete'), {:action => :delete_form, :name => permission_template.name},
+ :id => "delete-template-#{u permission_template.name}", :class => 'open-modal link-action link-red' %>
+ <% end %>
</td>
</tr>
<%