summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-02-17 10:47:43 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-02-17 10:47:43 +0100
commit7f646b72d3c5dc7700c36188ece84ad6e205fc53 (patch)
treec129f3d20b1f3b820edeea1a802e1c6f8e7bfe51
parentb49a6af322e4e59da24084a3aa8a008395057b7c (diff)
downloadsonarqube-7f646b72d3c5dc7700c36188ece84ad6e205fc53.tar.gz
sonarqube-7f646b72d3c5dc7700c36188ece84ad6e205fc53.zip
SONAR-6152 Customize look&feel with new logo
-rw-r--r--server/sonar-web/src/main/hbs/nav/_nav-logo.hbs2
-rw-r--r--server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs9
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb16
-rw-r--r--sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java4
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java5
7 files changed, 38 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/hbs/nav/_nav-logo.hbs b/server/sonar-web/src/main/hbs/nav/_nav-logo.hbs
index c1e2da4ed8e..fcc91b8f24b 100644
--- a/server/sonar-web/src/main/hbs/nav/_nav-logo.hbs
+++ b/server/sonar-web/src/main/hbs/nav/_nav-logo.hbs
@@ -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'}}">
diff --git a/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs b/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs
index 0f696928574..19d5ee79444 100644
--- a/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs
+++ b/server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs
@@ -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">
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
index be4bf396542..29f5a5d9d2b 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
@@ -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?
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb
index 2225b7fa726..59860893d9d 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_navbar_conf_global.html.erb
@@ -25,6 +25,20 @@
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>
diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
index f5fab2fff61..b9b5fb61955 100644
--- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
+++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
@@ -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
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index cd2218dda4a..c683d372e66 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -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
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
index 14699e354f4..233e88c632a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/CoreProperties.java
@@ -55,6 +55,11 @@ public interface CoreProperties {
String SUBCATEGORY_DIFFERENTIAL_VIEWS = "differentialViews";
/**
+ * @since 5.1
+ */
+ String SUBCATEGORY_LOOKNFEEL = "looknfeel";
+
+ /**
* @since 4.0
*/
String SUBCATEGORY_L10N = "localization";