]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4466 Fixed several display and labels issues
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Tue, 9 Jul 2013 07:29:41 +0000 (09:29 +0200)
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>
Tue, 9 Jul 2013 07:29:41 +0000 (09:29 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/java/org/sonar/server/permission/InternalPermissionTemplateService.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/permission_templates_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
sonar-server/src/test/java/org/sonar/server/permission/InternalPermissionTemplateServiceTest.java

index 5f59adfa5af2ed464b384729fb53987f19b6171d..ca77fe4f6ca5be00ac32d3cad08b9f966610f533 100644 (file)
@@ -2247,16 +2247,18 @@ projects_role.codeviewer.desc=Ability to view the source code of the project.
 # PERMISSION TEMPLATES
 #
 #------------------------------------------------------------------------------
-permission_templates=Permission templates
-permission_templates.page=Permission templates
+permission_templates=Permission Templates
+permission_templates.page=Permission Templates
 permission_template.new_template=New permission template
-permission_template.create_template=Create permission template
+permission_template.create_template=Create
 permission_template.delete_confirm_title=Delete permission template
 permission_template.do_you_want_to_delete_template=Are you sure that you want to delete this permission template?
-permission_template.delete_template=Delete permission template
+permission_template.delete_template=Delete
 permission_template.edit_template=Edit permission template
+permission_template.update_template=Update
 permission_template.edit_permissions=Edit permissions
-permission_template.update_permissions=Apply template changes
+permission_template.update_permissions=Save
+permission_template.no_results=No template to display
 
 
 #------------------------------------------------------------------------------
index db518e31d631a36c4d415f9220d2ddaf12b4b5ac..306771b55ee94342ae4c337b418c270e5491bf7f 100644 (file)
@@ -21,6 +21,7 @@
 package org.sonar.server.permission;
 
 import com.google.common.collect.Lists;
+import org.h2.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.sonar.api.ServerComponent;
@@ -136,8 +137,8 @@ public class InternalPermissionTemplateService implements ServerComponent {
   }
 
   private void validateTemplateName(Long templateId, String templateName) {
-    if(templateName == null) {
-      String errorMsg = "The name field is mandatory";
+    if(StringUtils.isNullOrEmpty(templateName)) {
+      String errorMsg = "Name can't be blank";
       LOG.error(errorMsg);
       throw new BadRequestException(errorMsg);
     }
index 299f3a9bad14f2692ee7357f6270df9a6c2baf0c..edc8624ef295ce60a9c72ecdb32fdc5e03ffdeda 100644 (file)
@@ -140,7 +140,7 @@ class PermissionTemplatesController < ApplicationController
   def edit_form
     @permission_template = Internal.permission_templates.selectPermissionTemplate(params[:name])
     render :partial => 'permission_templates/permission_template_form',
-           :locals => {:form_action => 'edit', :message_title => 'edit_template', :message_submit => 'edit_template'}
+           :locals => {:form_action => 'edit', :message_title => 'edit_template', :message_submit => 'update_template'}
   end
 
   #
index 187766f23a16a7d70526ad0e541b201197a423e5..2a7ba3eeee5326194f214beb90e449e57eb8bed6 100644 (file)
@@ -40,7 +40,7 @@
   <tbody>
   <% if @permission_templates.empty? %>
     <tr class="even">
-      <td colspan="4" align="left"><%= message('no_results') %></td>
+      <td colspan="6" align="left"><%= message('permission_template.no_results') %></td>
     </tr>
   <% end %>
   <% @permission_templates.each do |permission_template| %>
@@ -90,7 +90,7 @@
       </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' %>
+                    :id => "delete-template-#{u permission_template.name}", :class => 'open-modal link-action link-red' %>
       </td>
     </tr>
   <%
index 4d765bf46822691737c6ea881f9b937c3be042fb..1ea834643af88e453f0a172138e1eef20147cfa8 100644 (file)
@@ -79,6 +79,14 @@ public class InternalPermissionTemplateServiceTest {
     permissionTemplateService.createPermissionTemplate(DEFAULT_NAME, DEFAULT_DESC);
   }
 
+  @Test
+  public void should_reject_empty_name_on_creation() throws Exception {
+    expected.expect(BadRequestException.class);
+    expected.expectMessage("Name can't be blank");
+
+    permissionTemplateService.createPermissionTemplate("", DEFAULT_DESC);
+  }
+
   @Test
   public void should_delete_permission_template() throws Exception {
     when(permissionDao.selectTemplateByName(DEFAULT_NAME)).thenReturn(DEFAULT_TEMPLATE);