From: Jean-Baptiste Vilain Date: Wed, 24 Jul 2013 15:06:01 +0000 (+0200) Subject: SONAR-3392 Faster display of the modal window used to apply permission templates X-Git-Tag: 3.7~18 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8a755efd4325f2ae020ef82f39c7b73781becce4;p=sonarqube.git SONAR-3392 Faster display of the modal window used to apply permission templates --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb index 3b68aac03b5..0ccae067312 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb @@ -81,26 +81,25 @@ class RolesController < ApplicationController # GET /roles/apply_template_form?criteria def apply_template_form @permission_templates = Internal.permission_templates.selectAllPermissionTemplates().sort_by {|t| t.name.downcase}.collect {|pt| [pt.name, pt.key]} + @names = params[:names] + @keys = params[:keys] + @qualifiers = params[:qualifiers] || 'TRK' + @results_count = params[:results_count].to_i || 0 - params['qualifiers'] ||= 'TRK' - params['pageSize'] = -1 - - query_result = Internal.component_api.find(params) - components = query_result.components().to_a - - @projects_ids = components.collect{|component| component.getId()} - @qualifier = params[:qualifiers] - - render :partial => 'apply_template_form', - :locals => {:project_name => components.size == 1 ? components[0].name : nil, - :empty => @projects_ids.nil? || @projects_ids.size == 0} + render :partial => 'apply_template_form' end # POST /roles/apply_template?criteria def apply_template verify_post_request require_parameters :template_key + + params['pageSize'] = -1 + components = Internal.component_api.find(params).components().to_a + + params['components'] = components.collect{|component| component.getId()}.join(',') Internal.permissions.applyPermissionTemplate(params) + redirect_to :action => 'projects' end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb index 58e2a63cbb6..5062a63e056 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb @@ -1,18 +1,20 @@
- <% unless empty %> - + <% unless @results_count == 0 %> + + + <% end %>