]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3991 Add html class for Selenium test
authorJulien Lancelot <julien.lancelot@gmail.com>
Fri, 18 Jan 2013 10:18:04 +0000 (11:18 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Fri, 18 Jan 2013 10:18:04 +0000 (11:18 +0100)
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb

index 5f271aadbe192e58983db229d13843ce8516d973..54d0dcbbdf58ec1a37a2f734fff755941e3118b6 100644 (file)
@@ -544,6 +544,7 @@ module ApplicationHelper
   # ==== Options
   # * <tt>:width</tt> - The width suffixed with unit, for example '300px' or '100%'. Default is '250px'
   # * <tt>:html_id</tt> - The id of the HTML element. Default is the name.
+  # * <tt>:html_class</tt> - The class of the HTML element. Default is empty.
   # * <tt>:qualifiers</tt> - Array of resource qualifiers to filter.
   # * <tt>:resource_type_property</tt> -Filter on resource types on which the property is enabled, for example 'supportsGlobalDashboards'.
   # * <tt>:selected_resource</tt> - the resource that is selected by default.
@@ -554,6 +555,7 @@ module ApplicationHelper
   def resource_select_tag(name, options={})
     width=options[:width]
     html_id=options[:html_id]||name
+    html_class=options[:html_class]||''
 
     ws_url="#{ApplicationController::root_context}/api/resources/search?f=s2&"
     if options[:qualifiers]
@@ -583,7 +585,7 @@ module ApplicationHelper
     js_options['ajax']='{' + ajax_options.map { |k, v| "#{k}:#{v}" }.join(',') + '}'
     js_options.merge!(options[:select2_options]) if options[:select2_options]
 
-    html = "<input type='hidden' id='#{html_id}' name='#{name}'/>"
+    html = "<input type='hidden' id='#{html_id}' class='#{html_class}' name='#{name}'/>"
     js = "$j('##{html_id}').select2({#{js_options.map { |k, v| "#{k}:#{v}" }.join(',')}});"
 
     resource = options[:selected_resource]
index 72970d01683eecf31f7f4db3ecd6a80974de0b03..b1d3cc3e57ea189a158a371038a11c7b56e062e5 100644 (file)
@@ -15,7 +15,9 @@
               :resource_type_property => 'supportsGlobalDashboards',
               :selected_resource => widget.resource,
               :width => '250px',
-              :html_id => "widget-#{widget.id}-select-prj-#{widget.key.parameterize}"} -%>
+              :html_id => "widget-#{widget.id}-select-prj-#{widget.key.parameterize}",
+              :html_class => "widget-select-prj-#{widget.key.parameterize}"
+          } -%>
         </td>
       </tr>
     <% end %>
@@ -34,7 +36,7 @@
 
     <tr>
       <td colspan="2">
-        <%= submit_tag message('save'), :id => "widget-save-#{widget.key.parameterize}" -%>
+        <%= submit_tag message('save'), :id => "widget-#{widget.id}-save-#{widget.key.parameterize}", :class => "widget-save-#{widget.key.parameterize}" -%>
         <% if widget.configured %>
           <a href="#" onClick="portal.cancelEditWidget(<%= widget.id -%>);return false;"><%= message('cancel') -%></a>
         <% end %>