diff options
author | David Gageot <david@gageot.net> | 2012-09-21 10:36:32 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-09-21 10:36:52 +0200 |
commit | 5ed96f67bee59912b459e13ad611fc19cea0a89f (patch) | |
tree | bd0ffa68150c3b94ac582a3ca982036ade26a3ca /sonar-server/src | |
parent | b44d326f80ee44dc972aaa371c9d5722cfefcef2 (diff) | |
download | sonarqube-5ed96f67bee59912b459e13ad611fc19cea0a89f.tar.gz sonarqube-5ed96f67bee59912b459e13ad611fc19cea0a89f.zip |
SONAR-3754 Restore property validation
Diffstat (limited to 'sonar-server/src')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb | 3 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb | 7 |
2 files changed, 8 insertions, 2 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 50282117749..69206f8d16a 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 @@ -39,13 +39,14 @@ class SettingsController < ApplicationController load_properties() + @updated_properties = {} @definitions.map(&:key).each do |key| value = params[key] if value.blank? Property.clear(key, resource_id) else - Property.set(key, value, resource_id) + @updated_properties[key] = Property.set(key, value, resource_id) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb index 7719dc2d209..cb3ee1a3b31 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb @@ -36,10 +36,15 @@ </div> <button class="add_value"><%= message('settings.add') -%></button> <br/> - <% else -%> + <% else -%> <%= render "settings/type_#{property_type(property, value)}", :property => property, :value => value -%> <% end -%> + <% p = @updated_properties[property.key] if @updated_properties -%> + <% if p && !p.valid? -%> + <div class="error"><%= p.validation_error_message -%></div> + <% end -%> + <% default_prop_value = (@resource ? Property.value(property.key, nil, property.defaultValue) : property.defaultValue) -%> <% unless default_prop_value.blank? -%> <div class="note">Default: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%></div> |