Skip to content

Commit

Permalink
[webui] fix javascript quoting with rails 3.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo authored and lbt committed Jan 2, 2013
1 parent 595a955 commit c6a321d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
15 changes: 10 additions & 5 deletions src/webui-testsuite/lib/OBSpages/ProjectPage.rb
Expand Up @@ -66,14 +66,19 @@ def open_tab tab
assert @available_tabs.include? tab

tab_xpath =
"//div[@id='content']//div[@class='box-header header-tabs']//li/a"
if @advanced_tabs.include? tab then
if @driver.include? :xpath => tab_xpath + "[text()='Advanced']" then
@driver[ :xpath => tab_xpath + "[text()='Advanced']" ].click
"//div[@id='#{@tabs_id}']//li/a"
if @advanced_tabs.include? tab
trigger = @driver.find_elements(:css => "#advanced_tabs_trigger")
if !trigger.first.nil? && trigger.first.displayed?
trigger.first.click
wait.until do
t = @driver.find_element( :xpath => tab_xpath + "[text()='#{tab}']" )
t && t.displayed?
end
end
end

@driver[ :xpath => tab_xpath + "[text()='" + tab + "']" ].click
@driver[ :xpath => tab_xpath + "[text()='#{tab}']" ].click
$page = @available_tabs[tab].new_ready @driver
end

Expand Down
4 changes: 2 additions & 2 deletions src/webui/app/views/package/_tabs.html.erb
@@ -1,7 +1,7 @@
<% content_for :ready_function do %>
$("#advanced_tabs_trigger").click(function() {
$("#advanced_tabs").show();
$("#advanced_tabs_trigger").remove();
$("#advanced_list_item").hide();
});
<% end %>
Expand All @@ -27,7 +27,7 @@
$("#advanced_tabs").show();
<% end %>
<% else %>
<li><a href="#" id="advanced_tabs_trigger">Advanced</a></li>
<li id="advanced_list_item"><a href="#" id="advanced_tabs_trigger">Advanced</a></li>
<% end %>
</ul>
<% unless @spider_bot -%>
Expand Down
4 changes: 2 additions & 2 deletions src/webui/app/views/project/_tabs.html.erb
@@ -1,7 +1,7 @@
<% content_for :ready_function do %>
$("#advanced_tabs_trigger").click(function() {
$("#advanced_tabs").show();
$("#advanced_tabs_trigger").remove();
$("#advanced_list_item").hide();
});
<% end %>
Expand Down Expand Up @@ -33,7 +33,7 @@
$("#advanced_tabs").show();
<% end %>
<% else %>
<li><a href="#" id="advanced_tabs_trigger">Advanced</a></li>
<li id="advanced_list_item"><a href="#" id="advanced_tabs_trigger">Advanced</a></li>
<% end %>
</ul>
<div id="advanced_tabs" class="hidden">
Expand Down
12 changes: 6 additions & 6 deletions src/webui/app/views/shared/_buildresult_box.html.erb
Expand Up @@ -50,9 +50,9 @@
$.ajax({
url: '<%= url_for(:controller => controller, :action => 'rpmlint_result') %>',
data: {
<%= "'project': '" + project + "'," unless not defined?(project) %>
<%= "'package': '" + package + "'," unless not defined?(package) %>
<%= "'index': '" + index.to_s + "'," unless not defined?(index) %>
<%= raw("'project': '#{project}',") if defined?(project) %>
<%= raw("'package': '#{package}',") if defined?(package) %>
<%= raw("'index': '#{index}',") if defined?(index) %>
},
success: function(data) {
$('#result_display_<%= index %>_1').html(data);
Expand All @@ -79,9 +79,9 @@
$.ajax({
url: '<%= url_for(:controller => controller, :action => 'buildresult') %>',
data: {
<%= "'project': '" + project + "'," unless not defined?(project) %>
<%= "'package': '" + package + "'," unless not defined?(package) %>
<%= "'index': '" + index.to_s + "'," unless not defined?(index) %>
<%= raw("'project': '#{project}',") if defined?(project) %>
<%= raw("'package': '#{package}',") if defined?(package) %>
<%= raw("'index': '#{index}',") if defined?(index) %>
},
success: function(data) {
$('#result_display_<%= index %>_0').html(data);
Expand Down
10 changes: 5 additions & 5 deletions src/webui/app/views/shared/_select_requests.html.erb
Expand Up @@ -13,11 +13,11 @@
data: {
'states': $('#request_state_select')[0].value,
'types': $('#request_type_select')[0].value,
<%= "'user': '" + userid.to_s + "'," unless not defined?(userid) %>
<%= "'project': '" + project.to_s + "'," unless not defined?(project) %>
<%= "'package': '" + package.to_s + "'," unless not defined?(package) %>
<%= "'subprojects': 'true'," if defined?(subprojects) && subprojects %>
<%= "'no_target': 'true'," if no_target %>
<%= raw("'user': '#{userid}',") if defined?(userid) %>
<%= raw("'project': '#{project}',") if defined?(project) %>
<%= raw("'package'': '#{package}',") if defined?(package) %>
<%= raw("'subprojects': 'true',") if defined?(subprojects) && subprojects %>
<%= raw("'no_target': 'true',") if no_target %>
},
success: function(data) {
$('#request_display').html(data);
Expand Down

0 comments on commit c6a321d

Please sign in to comment.