diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-09-20 11:27:41 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-09-20 11:27:41 +0200 |
commit | 7fe48fc80737fb3a2511c7a517d07ca00da7ea48 (patch) | |
tree | cc0876ef38e40fafddb1a919dac8b929fd89dea5 /sonar-server/src/main | |
parent | f1cad62d502b4b13c67819065c31097e551e3517 (diff) | |
download | sonarqube-7fe48fc80737fb3a2511c7a517d07ca00da7ea48.tar.gz sonarqube-7fe48fc80737fb3a2511c7a517d07ca00da7ea48.zip |
SONAR-4521 Ability to apply a permission template at project level
Diffstat (limited to 'sonar-server/src/main')
4 files changed, 84 insertions, 73 deletions
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 e948e83a566..6502fb9203c 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 @@ -2,13 +2,13 @@ <%= render :partial => 'roles/tabs', :locals => {:selected_tab=>'Permission templates'} %> <br/> -<div class="line-block"> - <ul style="float: right" class="horizontal"> - <li style="padding-top: 3px; padding-right: 10px;"> +<div class="line-block marginbottom10"> + <ul class="operations"> + <li> <%= link_to message('permission_template.set_default_templates'), {:action => :default_templates_form, :qualifiers => @root_qualifiers}, :id => 'configure-defaults-permission-template', :class => 'open-modal link-action' %> </li> - <li class="marginleft10 add"> + <li class="last"> <%= link_to message('create'), {:action => :create_form}, :id => 'create-link-permission-template', :class => 'open-modal link-action' %> </li> </ul> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb index 776982f3f63..d07def1f516 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project_roles/index.html.erb @@ -1,41 +1,51 @@ -<h1 class="marginbottom10">Project Permissions</h1> +<h1>Project Permissions</h1> + +<div class="line-block marginbottom10"> + <ul class="operations"> + <li class="last"> + <%= link_to message('projects_role.apply_template'), {:controller => :roles, :action => :apply_template_form, :components => [@project.id], :names => @project.name, + :results_count => 1}, + :id => "apply-template-#{u @project.kee}", :class => 'open-modal link-action' %> + </li> + </ul> +</div> + <table class="data width100"> <thead> - <tr> - <th> </th> - <th> - <%= message('projects_role.user') -%><br/> - <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.user.desc') -%></span> - </th> - <th> - <%= message('projects_role.admin') -%><br/> - <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.admin.desc') -%></span> - </th> - <th> - <%= message('projects_role.codeviewer') -%><br/> - <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.codeviewer.desc') -%></span> - </th> - </tr> + <tr> + <th> </th> + <th> + <%= message('projects_role.user') -%><br/> + <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.user.desc') -%></span> + </th> + <th> + <%= message('projects_role.admin') -%><br/> + <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.admin.desc') -%></span> + </th> + <th> + <%= message('projects_role.codeviewer') -%><br/> + <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.codeviewer.desc') -%></span> + </th> + </tr> </thead> <tbody> - <tr class="even"> - <td valign="top"><b>Users</b></td> - - <% ['user', 'admin', 'codeviewer'].each do |permission| -%> + <tr class="even"> + <td valign="top"><b>Users</b></td> + <% ['user', 'admin', 'codeviewer'].each do |permission| -%> <td valign="top"> <span id="<%= permission -%>-role-users"><%= users(permission, @project.id).map(&:name).join(', ') %></span> (<%= link_to_edit_roles_permission_form(message('select'), permission, @project.id, "select-#{permission}-edit-users") %>)<br/> </td> - <% end %> - </tr> - <tr class="odd"> - <td valign="top"><b>Groups</b></td> - <% ['admin', 'user', 'codeviewer'].each do |permission| -%> + <% end %> + </tr> + <tr class="odd"> + <td valign="top"><b>Groups</b></td> + <% ['admin', 'user', 'codeviewer'].each do |permission| -%> <td valign="top"> <span id="<%= permission -%>-role-groups"><%= groups(permission, @project.id).map{|g| group_name(g)}.join(', ') %></span> (<%= link_to_edit_groups_permission_form(message('select'), permission, @project.id, "select-#{permission}-edit-groups") %>)<br/> </td> - <% end %> - </tr> + <% end %> + </tr> </tbody> </table> 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 db00f0fd6d6..d61a95becc9 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,10 +1,8 @@ <form id="apply-template-form" method="post" action="<%= ApplicationController.root_context -%>/roles/apply_template"> - <% unless @results_count == 0 %> - <input type="hidden" name="names" id="apply-template-names" value="<%= @names %>"/> - <input type="hidden" name="keys" id="apply-template-keys" value="<%= @keys %>"/> - <input type="hidden" name="qualifiers" id="apply-template-qualifiers" value="<%= @qualifiers %>"/> - <input type="hidden" name="components" id="apply-template-components" value="<%= @components %>"/> - <% end %> + <input type="hidden" name="names" id="apply-template-names" value="<%= @names %>"/> + <input type="hidden" name="keys" id="apply-template-keys" value="<%= @keys %>"/> + <input type="hidden" name="qualifiers" id="apply-template-qualifiers" value="<%= @qualifiers %>"/> + <input type="hidden" name="components" id="apply-template-components" value="<%= @components %>"/> <fieldset> <div class="modal-head"> <% if @components %> @@ -13,30 +11,33 @@ <h2><%= message('projects_role.apply_template') -%></h2> <% end %> </div> - <div class="modal-body"> - <div class="modal-error"/> - <% if @results_count == 0 %> + <% if @results_count > 0 %> + <div class="modal-body"> + <div class="modal-error"/> + <div class="modal-field"> + <%= label_tag 'template_key', 'Permission Template' %> + <%= select_tag('template_key', options_for_select(@permission_templates, -1), :style => 'width: 250px;') %> + <% unless @results_count == 1 %> + <span style="float:right" class="note">(<%= "#{@results_count} #{message('qualifier.' + @qualifiers)}s" %>)</span><br/> + <% end %> + </div> + </div> + <div class="modal-foot"> + <span id="apply-template-loading-image" class="loading-image hidden"><%= image_tag 'loading.gif' %></span> + <input type="submit" value="<%= message('apply') -%>" id="apply-template-submit" class="apply-template" onclick="return displayLoadingImage()" /> + <a href="#" onclick="return closeModalWindow()" id="apply-template-cancel"><%= message('cancel') -%></a> + </div> + <% else %> + <div class="modal-body"> <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;') %> - <% unless @results_count == 1 %> - <span style="float:right" class="note">(<%= "#{@results_count} #{message('qualifier.' + @qualifiers)}s" %>)</span><br/> - <% end %> - </div> - <% end %> - </div> - <div class="modal-foot"> - <% unless @results_count == 0 %> - <span id="apply-template-loading-image" class="loading-image 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> + </div> + <div class="modal-foot"> + <a href="#" onclick="return closeModalWindow()" id="apply-template-cancel"><%= message('cancel') -%></a> + </div> + <% end %> </fieldset> </form> <script> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb index 55b52473254..8d01e85034d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb @@ -43,22 +43,22 @@ <table class="data width100" id="projects"> <thead> - <tr> - <th> </th> - <th> - <%= message('projects_role.user') -%><br/> - <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.user.desc') -%></span> - </th> - <th> - <%= message('projects_role.admin') -%><br/> - <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.admin.desc') -%></span> - </th> - <th> - <%= message('projects_role.codeviewer') -%><br/> - <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.codeviewer.desc') -%></span> - </th> - <th></th> - </tr> + <tr> + <th> </th> + <th> + <%= message('projects_role.user') -%><br/> + <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.user.desc') -%></span> + </th> + <th> + <%= message('projects_role.admin') -%><br/> + <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.admin.desc') -%></span> + </th> + <th> + <%= message('projects_role.codeviewer') -%><br/> + <span class="small gray" style="font-size: 11px; font-weight: normal;"><%= message('projects_role.codeviewer.desc') -%></span> + </th> + <th> </th> + </tr> </thead> <%= paginate_java(@query_result.paging, :colspan => 4, :id => 'project-roles-foot', :include_loading_icon => true) { |label, page_id| |