diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-11-03 12:09:07 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-11-03 12:09:19 +0100 |
commit | a0d25f507507367e957260d8e357286b736b423e (patch) | |
tree | 4530a83ca74475fb599b085801d2dfaef7b465d4 /sonar-server | |
parent | 4a255dabb7b8cd29326c81480078e4c7011cd10d (diff) | |
download | sonarqube-a0d25f507507367e957260d8e357286b736b423e.tar.gz sonarqube-a0d25f507507367e957260d8e357286b736b423e.zip |
SONAR-2963 fix l10n labels + fix vertical alignment
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb | 24 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb | 10 |
2 files changed, 16 insertions, 18 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb index 57108dc01e9..5c688d42a8e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb @@ -27,44 +27,42 @@ class SettingsController < ApplicationController def index access_denied unless is_admin? - load_properties(false) + load_properties(nil) @category ||= 'general' end def update + project=nil if params[:resource_id] project=Project.by_key(params[:resource_id]) access_denied unless (project && is_admin?(project)) - resource_id=project.id else access_denied unless is_admin? - resource_id=nil end - load_properties(true) + load_properties(project) if @category && @properties_per_category[@category] @properties_per_category[@category].each do |property| value=params[property.key()] - persisted_property = Property.find(:first, :conditions => {:prop_key=> property.key(), :resource_id => resource_id, :user_id => nil}) - + persisted_property = Property.find(:first, :conditions => {:prop_key=> property.key(), :resource_id => (project ? project.id : nil), :user_id => nil}) if persisted_property if value.empty? - Property.delete_all('prop_key' => property.key(), 'resource_id' => resource_id, 'user_id' => nil) + Property.delete_all('prop_key' => property.key(), 'resource_id' => (project ? project.id : nil), 'user_id' => nil) elsif persisted_property.text_value != value.to_s persisted_property.text_value = value.to_s persisted_property.save! end elsif !value.blank? - Property.create(:prop_key => property.key(), :text_value => value.to_s, :resource_id => resource_id) + Property.create(:prop_key => property.key(), :text_value => value.to_s, :resource_id => (project ? project.id : nil)) end end java_facade.reloadConfiguration() flash[:notice] = 'Parameters updated' end - if resource_id - redirect_to :controller => 'project', :action => 'settings', :id => resource_id, :category => @category + if project + redirect_to :controller => 'project', :action => 'settings', :id => project.id, :category => @category else redirect_to :controller => 'settings', :action => 'index', :category => @category end @@ -72,11 +70,13 @@ class SettingsController < ApplicationController private - def load_properties(all=true) + def load_properties(project) @category=params[:category] @properties_per_category={} definitions = java_facade.getPropertyDefinitions() - definitions.getProperties().select {|property| property.global}.each do |property| + definitions.getProperties().select {|property| + (project.nil? && property.global) || (project && project.module? && property.module()) || (project && project.project? && property.project()) + }.each do |property| category = definitions.getCategory(property.key()) @properties_per_category[category]||=[] @properties_per_category[category]<<property diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb index ec7db02725e..354a6ed9561 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb @@ -106,12 +106,10 @@ <% textarea = text_area_tag property.key(), value, :size => "100x10" %> <span id="<%= span_id %>"><%= (value.length < 50) ? textfield : textarea %></span> - <% unless property.defaultValue().blank? %> - <% if @project %> - <span class="note">Default : <%= h Property.value(property.key(), nil, property.defaultValue()) -%></span> - <% else %> - <span class="note">Default : <%= h property.defaultValue() -%></span> - <% end %> + <% + default_prop_value = (@project ? Property.value(property.key(), nil, property.defaultValue()) : property.defaultValue()) + unless default_prop_value.blank? %> + <span class="note">Default : <%= h default_prop_value -%></span> <% end %> </p> </td> |