]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6152 Customize look&feel with new logo
authorStas Vilchik <vilchiks@gmail.com>
Tue, 17 Feb 2015 09:47:43 +0000 (10:47 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 17 Feb 2015 09:47:43 +0000 (10:47 +0100)
server/sonar-web/src/main/hbs/nav/_nav-logo.hbs
server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs
server/sonar-web/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb
sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
sonar-core/src/main/resources/org/sonar/l10n/core.properties
sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java

index c1e2da4ed8e2d7f2f8100a57e8a7a08263d56217..fcc91b8f24bd59fe9f2da0378bcad0ff051a62bb 100644 (file)
@@ -1 +1 @@
-<img src="{{link '/images/logo.svg'}}" title="{{t 'layout.sonar.slogan'}}">
+<img src="{{link '/images/logo.svg'}}" alt="{{t 'layout.sonar.slogan'}}" title="{{t 'layout.sonar.slogan'}}">
index 0f696928574c7358062975b5d86319b8de0a63ba..19d5ee7944482a261041c6ab2efbf9155f2f03aa 100644 (file)
@@ -1,6 +1,13 @@
 <div class="container">
   <div class="navbar-header">
-    <a class="navbar-brand" href="{{link '/'}}">{{> '_nav-logo'}}</a>
+    <a class="navbar-brand" href="{{link '/'}}">
+      {{#if logoUrl}}
+        <img src="{{logoUrl}}" {{#if logoWidth}}width="{{logoWidth}}"{{/if}} height="30"
+             alt="{{t 'layout.sonar.slogan'}}" title="{{t 'layout.sonar.slogan'}}">
+      {{else}}
+        {{> '_nav-logo'}}
+      {{/if}}
+    </a>
   </div>
 
   <ul class="nav navbar-nav">
index be4bf396542b8e798adc879e6f2e29e9942f5b94..29f5a5d9d2bbeed99ed992a34a8d2accba8273e0 100644 (file)
@@ -80,6 +80,10 @@ module SettingsHelper
     end
   end
 
+  def property_by_key(key)
+    Property.by_key(key)
+  end
+
   # for backward-compatibility with properties that do not define the type TEXT
   def property_type(property, value)
     unless property.fields.blank?
index 2225b7fa72695b713f5fe1c0af40cba9b859ddc3..59860893d9df4098410f10ad7c673956ba1717c0 100644 (file)
         name: '<%= escape_javascript message(page.getId() + '.page', :default => page.getTitle()) -%>'
       }<% if index < pages.size - 1 -%>, <% end %>
       <% end %>
-    ]
+    ],
+    <%
+      logo_url = property_by_key('sonar.lf.logoUrl')
+      logo_width = property_by_key('sonar.lf.logoWidthPx')
+    %>
+    <%
+      if logo_url
+    %>
+    logoUrl: '<%= escape_javascript property_value(logo_url) -%>',
+    <% end %>
+    <%
+      if logo_width
+    %>
+    logoWidth: '<%= escape_javascript property_value(logo_width) -%>'
+    <% end %>
   });
 </script>
index f5fab2fff613c9cfd2834b23692350da0968ed7d..b9b5fb619559e2602760ba42b10d168f6fec5fb5 100644 (file)
@@ -48,11 +48,15 @@ public class CorePropertyDefinitions {
         .deprecatedKey("sonar.branding.image")
         .name("Logo URL")
         .description("URL to logo image. Any standard format is accepted.")
+        .category(CoreProperties.CATEGORY_GENERAL)
+        .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
         .build(),
       PropertyDefinition.builder("sonar.lf.logoWidthPx")
         .deprecatedKey("sonar.branding.image.width")
         .name("Width of image in pixels")
         .description("Width in pixels, according that the height of image is constrained to 30px.")
+        .category(CoreProperties.CATEGORY_GENERAL)
+        .subCategory(CoreProperties.SUBCATEGORY_LOOKNFEEL)
         .build(),
 
       // BATCH
index cd2218dda4a2c5e19bbdf8bad6b45aa81725ea9f..c683d372e6627d84373dea7e720577a17fffc2d8 100644 (file)
@@ -978,6 +978,7 @@ property.category.general.duplications=Duplications
 property.category.general.differentialViews=Differential Views
 property.category.general.localization=Localization
 property.category.general.databaseCleaner=Database Cleaner
+property.category.general.looknfeel=Look & Feel
 property.category.security=Security
 property.category.security.encryption=Encryption
 property.category.java=Java
index 14699e354f48b79c2b841a59b96d806b9ae422a6..233e88c632aa01b44294c1dc1cd904bed9614381 100644 (file)
@@ -54,6 +54,11 @@ public interface CoreProperties {
    */
   String SUBCATEGORY_DIFFERENTIAL_VIEWS = "differentialViews";
 
+  /**
+   * @since 5.1
+   */
+  String SUBCATEGORY_LOOKNFEEL = "looknfeel";
+
   /**
    * @since 4.0
    */