From 8e786de62da9869c93eb9d7232f19e2ff5d1c2d3 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Fri, 18 Jan 2013 11:18:04 +0100 Subject: [PATCH] SONAR-3991 Add html class for Selenium test --- .../main/webapp/WEB-INF/app/helpers/application_helper.rb | 4 +++- .../WEB-INF/app/views/dashboard/_widget_properties.html.erb | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index 5f271aadbe1..54d0dcbbdf5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -544,6 +544,7 @@ module ApplicationHelper # ==== Options # * :width - The width suffixed with unit, for example '300px' or '100%'. Default is '250px' # * :html_id - The id of the HTML element. Default is the name. + # * :html_class - The class of the HTML element. Default is empty. # * :qualifiers - Array of resource qualifiers to filter. # * :resource_type_property -Filter on resource types on which the property is enabled, for example 'supportsGlobalDashboards'. # * :selected_resource - 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 = "" + html = "" js = "$j('##{html_id}').select2({#{js_options.map { |k, v| "#{k}:#{v}" }.join(',')}});" resource = options[:selected_resource] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb index 72970d01683..b1d3cc3e57e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb @@ -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}" + } -%> <% end %> @@ -34,7 +36,7 @@ - <%= 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 %> <%= message('cancel') -%> <% end %> -- 2.39.5