]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4454 Make it possible to apply a permission template to a single project
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Wed, 17 Jul 2013 14:07:06 +0000 (16:07 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Wed, 17 Jul 2013 14:07:06 +0000 (16:07 +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 29a875ae924bba3eb765983a1c35abc14210df47..3660170fa6252c1344d01c9fa5bb1f1860bb692d 100644 (file)
@@ -2259,7 +2259,8 @@ projects_role.user.desc=Ability to browse the measures and to create/edit issues
 projects_role.codeviewer=Code Viewers
 projects_role.codeviewer.desc=Ability to view the source code of the project.
 projects_role.bulk_change=Bulk Change
-projects_role.apply_template.form.title=Apply permission template
+projects_role.apply_template=Apply permission template
+projects_role.apply_template_to_xxx=Apply permission template to {0}
 projects_role.no_projects=There are currently no results to apply the permission template to.
 
 
@@ -2281,6 +2282,7 @@ permission_template.update_template=Update
 permission_template.edit_permissions=Edit permissions
 permission_template.update_permissions=Save
 permission_template.no_results=No template to display
+permission_template.set_default_templates=Set default templates
 
 
 #------------------------------------------------------------------------------
index 5fb870f2d37d9beed8b0a3cd15d1a93897527f7b..dd144499d784916ddab7d31ccca0cef69198519c 100644 (file)
@@ -78,7 +78,7 @@ class RolesController < ApplicationController
   # GET /roles/apply_template_form?projects=<projects>&qualifier=<qualifier>
   def apply_template_form
     @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'}
+    render :partial => 'apply_template_form', :locals => {:components => params[:projects], :project_name => params[:project_name], :qualifier => params[:qualifier] || 'TRK'}
   end
 
   # POST /roles/apply_template?criteria
index 659ff4d47efdf8bd21557b58f2e07296ded005dc..b7c04c22d0677de41f1701774172ab326811c6b3 100644 (file)
@@ -4,7 +4,11 @@
   <% end %>
   <fieldset>
     <div class="modal-head">
-      <h2><%= message('projects_role.apply_template.form.title', {:params => ''}) -%></h2>
+    <% if params[:project_name] %>
+      <h2><%= message('projects_role.apply_template_to_xxx', :params => params[:project_name]) -%></h2>
+    <% else %>
+      <h2><%= message('projects_role.apply_template') -%></h2>
+    <% end %>
     </div>
     <div class="modal-body">
       <div class="apply-template errors error" style="display:none;"/>
@@ -17,7 +21,9 @@
         <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/>
+          <% unless params[:project_name] %>
+            <span style="float:right" class="note">(<%= "#{components.size} #{message('qualifier.' + qualifier)}(s)" %>)</span><br/>
+          <% end %>
         </div>
       <% end %>
     </div>
index 5eab3af0fb9773f5198530941c1a234889d6734f..7d744cd31208d8bbe670201889559aeb163516e7 100644 (file)
@@ -44,6 +44,7 @@
     <th><%= message('projects_role.admin') -%></th>
     <th><%= message('projects_role.user') -%></th>
     <th><%= message('projects_role.codeviewer') -%></th>
+    <th></th>
   </tr>
   </thead>
 
         (<%= 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>
+      <td align="right">
+        <%= link_to message('projects_role.apply_template'), {:action => :apply_template_form, :projects => [project.id], :project_name => project.name, :qualifier => @qualifier},
+                    :id => "apply-template-modal-#{project.id}", :class => 'open-modal link-action' %>
+      </td>
     </tr>
   <%
      end %>