]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3529 Improve property sets
authorDavid Gageot <david@gageot.net>
Thu, 4 Oct 2012 10:51:46 +0000 (12:51 +0200)
committerDavid Gageot <david@gageot.net>
Thu, 4 Oct 2012 10:51:46 +0000 (12:51 +0200)
sonar-server/src/main/webapp/WEB-INF/app/models/property.rb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_set_instance.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PROPERTY_SET_DEFINITION.html.erb

index b7539045b46963912dee25d815aa9edc1b0abf4f..7c1594d508f67b095cf185bac50a58b53ac6ab38 100644 (file)
@@ -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
index 7a2fb8c8afa63c10a6e51af61e07fe9926dfb331..a510f678c4747b6cadc2b755fd45a45948c7f450 100644 (file)
@@ -1,3 +1,5 @@
+<% errors = [] -%>
+
 <tr class="multi_value <%= 'template' unless set_key -%>" style="<%= 'display:none' unless set_key -%>">
   <td><%= text_field_tag "property_sets[#{property.key}][]", set_key, :size => 50 -%></td>
 
@@ -6,7 +8,19 @@
     <% value = Property.value(key, resource_id) if set_key -%>
 
     <td><%= render "settings/type_#{field.type}", :property => field, :field => field, :value => value, :name => "#{property.key}[#{field.key}][]", :id => "input_#{h field.key}" -%></td>
+
+    <% errors << (render "settings/error", :key => key) if set_key -%>
   <% end -%>
 
   <td><a href="#" class="delete link-action"><%= message('delete') -%></a></td>
 </tr>
+
+<% unless errors.all?(&:blank?) -%>
+  <tr>
+    <td></td>
+    <% errors.each do |error| -%>
+      <td><%= error -%></td>
+    <% end -%>
+    <td></td>
+  </tr>
+<% end -%>
index 2e642af64aeb413db1114580513d17162d26dbba..243999d2137ab1e1da5e7095f3976b7670497d52 100644 (file)
@@ -5,7 +5,13 @@
   <tr>
     <th><%= message('key') -%></th>
     <% property.fields.each do |field| -%>
-      <th><%= field_name(property, field) -%></th>
+      <th>
+        <%= field_name(property, field) -%>
+        <% desc = field_description(property, field) -%>
+        <% unless desc.blank? %>
+          <p class="note"><%= desc -%></p>
+        <% end -%>
+      </th>
     <% end -%>
     <th></th>
   </tr>