From 194e962f659f8949496b510d8ed0988c34c374f1 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Thu, 4 Oct 2012 12:51:46 +0200 Subject: [PATCH] SONAR-3529 Improve property sets --- .../src/main/webapp/WEB-INF/app/models/property.rb | 4 ++-- .../app/views/settings/_set_instance.html.erb | 14 ++++++++++++++ .../_type_PROPERTY_SET_DEFINITION.html.erb | 8 +++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb index b7539045b46..7c1594d508f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb @@ -186,14 +186,14 @@ class Property < ActiveRecord::Base def validate_property if java_definition validation_result = java_definition.validate(text_value) - errors.add_to_base(validation_result.getErrorKey()) unless validation_result.isValid() + errors.add_to_base(validation_result.errorKey) unless validation_result.isValid() end end def validate_field if java_field_definition validation_result = java_field_definition.validate(text_value) - errors.add_to_base(validation_result.getErrorKey()) unless validation_result.isValid() + errors.add_to_base(validation_result.errorKey) unless validation_result.isValid() end end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_set_instance.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_set_instance.html.erb index 7a2fb8c8afa..a510f678c47 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_set_instance.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_set_instance.html.erb @@ -1,3 +1,5 @@ +<% errors = [] -%> + <%= text_field_tag "property_sets[#{property.key}][]", set_key, :size => 50 -%> @@ -6,7 +8,19 @@ <% value = Property.value(key, resource_id) if set_key -%> <%= render "settings/type_#{field.type}", :property => field, :field => field, :value => value, :name => "#{property.key}[#{field.key}][]", :id => "input_#{h field.key}" -%> + + <% errors << (render "settings/error", :key => key) if set_key -%> <% end -%> <%= message('delete') -%> + +<% unless errors.all?(&:blank?) -%> + + + <% errors.each do |error| -%> + <%= error -%> + <% end -%> + + +<% end -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PROPERTY_SET_DEFINITION.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PROPERTY_SET_DEFINITION.html.erb index 2e642af64ae..243999d2137 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PROPERTY_SET_DEFINITION.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PROPERTY_SET_DEFINITION.html.erb @@ -5,7 +5,13 @@ <%= message('key') -%> <% property.fields.each do |field| -%> - <%= field_name(property, field) -%> + + <%= field_name(property, field) -%> + <% desc = field_description(property, field) -%> + <% unless desc.blank? %> +

<%= desc -%>

+ <% end -%> + <% end -%> -- 2.39.5