]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4453 Adjusted labels and presentation for bulk permission changes
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Wed, 17 Jul 2013 07:54:36 +0000 (09:54 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Wed, 17 Jul 2013 07:54:36 +0000 (09:54 +0200)
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/roles/_apply_template_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb

index 54e5ec460266c71c5dce7d38571186a7ffe9a9f9..7887d6ab3883274cc64bedcfea3794e9dd6d0d97 100644 (file)
@@ -2257,8 +2257,10 @@ projects_role.user=Users
 projects_role.user.desc=Ability to browse the measures and to create/edit issues on the project.
 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.bulk_change=Bulk Change
 projects_role.apply_template.form.title=Apply permission template
+projects_role.no_projects=There are currently no results to apply the permission template to.
+
 
 
 #------------------------------------------------------------------------------
index b0eb5c091d4c4ec09fa6a6e1c7dff85199706654..5fb870f2d37d9beed8b0a3cd15d1a93897527f7b 100644 (file)
@@ -77,7 +77,6 @@ class RolesController < ApplicationController
 
   # GET /roles/apply_template_form?projects=<projects>&qualifier=<qualifier>
   def apply_template_form
-    bad_request('There are currently no results to apply the permission template to') if params[:projects].blank?
     @permission_templates = Internal.permission_templates.selectAllPermissionTemplates().collect {|pt| [pt.name, pt.key]}
     render :partial => 'apply_template_form', :locals => {:components => params[:projects], :qualifier => params[:qualifier] || 'TRK'}
   end
index 4f76e4f951987b61c746f8d88b7f60bbfe83328b..659ff4d47efdf8bd21557b58f2e07296ded005dc 100644 (file)
@@ -1,19 +1,31 @@
 <form id="apply-template-form" method="post" action="<%= ApplicationController.root_context -%>/roles/apply_template">
-  <input type="hidden" name="components" id="apply-template-components" value="<%= components.join(',') %>"/>
+  <% unless components.nil? %>
+    <input type="hidden" name="components" id="apply-template-components" value="<%= components.join(',') %>"/>
+  <% end %>
   <fieldset>
     <div class="modal-head">
       <h2><%= message('projects_role.apply_template.form.title', {:params => ''}) -%></h2>
     </div>
     <div class="modal-body">
       <div class="apply-template errors error" style="display:none;"/>
-      <div class="modal-field">
-        <span><%= "Select the template to apply to #{components.size} #{message('qualifier.' + qualifier)}(s):" %></span><br/>
-        <%= select_tag('template_key', options_for_select(@permission_templates, -1)) %>
-      </div>
+      <% if components.nil? %>
+        <div class="info">
+          <img src="<%= ApplicationController.root_context -%>/images/information.png" style="vertical-align: text-bottom"/>
+          <%= message 'projects_role.no_projects' -%>
+        </div>
+      <% else %>
+        <div class="modal-field">
+          <%= label_tag 'template_key', 'Permission template:' %>
+          <%= select_tag('template_key', options_for_select(@permission_templates, -1), :style => 'width: 250px;') %>
+          <span style="float:right" class="note">(<%= "#{components.size} #{message('qualifier.' + qualifier)}(s)" %>)</span><br/>
+        </div>
+      <% end %>
     </div>
     <div class="modal-foot">
-      <span id="apply-template-loading-image" class="hidden"><%= image_tag 'loading.gif' %></span>
-      <input type="submit" value="<%= message('apply') -%>" id="apply-template-submit" class="apply-template" onclick="return displayLoadingImage()" />
+      <% unless components.nil? %>
+        <span id="apply-template-loading-image" class="hidden"><%= image_tag 'loading.gif' %></span>
+        <input type="submit" value="<%= message('apply') -%>" id="apply-template-submit" class="apply-template" onclick="return displayLoadingImage()" />
+      <% end %>
       <a href="#" onclick="return closeModalWindow()" id="apply-template-cancel"><%= message('cancel') -%></a>
     </div>
   </fieldset>
index 8fc851b830b5337347586429c2d1d20a27f37f5b..5eab3af0fb9773f5198530941c1a234889d6734f 100644 (file)
@@ -31,7 +31,7 @@
 <div id="project-roles-operations" style="float: right;">
   <ul class="operations">
     <li class="last">
-      <%= link_to message('projects_role.apply_template'), {:action => :apply_template_form, :projects => @projects.collect {|proj| proj.id}, :qualifier => @qualifier},
+      <%= link_to message('projects_role.bulk_change'), {:action => :apply_template_form, :projects => @projects.collect {|proj| proj.id}, :qualifier => @qualifier},
                    :id => 'apply-template-modal', :class => 'open-modal link-action' %>
     </li>
   </ul>