diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-12-12 16:45:05 +0100 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-12-12 17:58:19 +0100 |
commit | 087df4135ce0089a2c96711f6bf2cdcdf921f361 (patch) | |
tree | cfd80665e751996184b50a00b4f01b60effc0222 | |
parent | a4bb86aa2c00cf675c1f93eb4d49ee45e48f6306 (diff) | |
download | sonarqube-087df4135ce0089a2c96711f6bf2cdcdf921f361.tar.gz sonarqube-087df4135ce0089a2c96711f6bf2cdcdf921f361.zip |
SONAR-1929 Add localization to name & description of dashboards
4 files changed, 27 insertions, 1 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/HotspotsDashboard.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/HotspotsDashboard.java index b091e1900b0..04369cb8ab2 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/HotspotsDashboard.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/dashboards/HotspotsDashboard.java @@ -45,7 +45,7 @@ public class HotspotsDashboard extends AbstractDashboard implements Dashboard { @Override public String getName() { - return "Hotspots [NEW]"; + return "Hotspots"; } @Override diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index 09a250d8db9..6fecff23723 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -445,6 +445,19 @@ property.category.server_id=Server ID #------------------------------------------------------------------------------ # +# DASHBOARDS +# +#------------------------------------------------------------------------------ + +dashboard.sonar-main-dashboard.name=Dashboard +dashboard.sonar-main-dashboard.description=Default dashboard + +dashboard.sonar-hotspots-dashboard.name=Hotspots [NEW!!] +dashboard.sonar-hotspots-dashboard.description=Most useful hotspots widgets + + +#------------------------------------------------------------------------------ +# # WIDGETS # #------------------------------------------------------------------------------ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb index 22bfe87eb5a..d0868c84a84 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb @@ -168,6 +168,7 @@ class DashboardsController < ApplicationController def load_dashboard_from_params(dashboard) dashboard.name=params[:name] + dashboard.kee=dashboard.name.strip.downcase.sub(/\s+/, '_') dashboard.description=params[:description] dashboard.shared=(params[:shared].present? && is_admin?) dashboard.user_id=current_user.id diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb index 2fc8b509b05..1a136f86081 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/dashboard.rb @@ -31,6 +31,18 @@ class Dashboard < ActiveRecord::Base validates_length_of :column_layout, :maximum => 20, :allow_blank => false, :allow_nil => false validates_uniqueness_of :name, :scope => :user_id + def name + default_name = read_attribute(:name) + default_name = Api::Utils.message('dashboard.' + read_attribute(:kee) + '.name', :default => default_name) if read_attribute(:kee) + default_name + end + + def description + default_description = read_attribute(:description) + default_description = Api::Utils.message('dashboard.' + read_attribute(:kee) + '.description', :default => default_description) if read_attribute(:kee) + default_description + end + def shared? read_attribute(:shared) || false end |