Skip to content

Commit

Permalink
[webui] Fix description expanding on request page
Browse files Browse the repository at this point in the history
The html id of the js expander handler was not matching the actual element id, which
broke the expander feature for requests.
This patch fixes it and also renames the id from 'description_text' to 'description-text'
to match most common html naming conventions.
  • Loading branch information
bgeuken committed Mar 31, 2016
1 parent 39f5e43 commit 9b39fa8
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/api/app/helpers/webui/webui_helper.rb
Expand Up @@ -206,11 +206,11 @@ def force_utf8_and_transform_nonprintables(text)

def description_wrapper(description)
if description.blank?
content_tag(:p, id: 'description_text') do
content_tag(:p, id: 'description-text') do
content_tag(:i, 'No description set')
end
else
content_tag(:pre, description, id: 'description_text', class: 'plain')
content_tag(:pre, description, id: 'description-text', class: 'plain')
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/webui/request/show.html.erb
Expand Up @@ -3,7 +3,7 @@
<% @crumb_list = ["Request #{@id}"] %>
<%= content_for :ready_function do %>
$('#description').expander({slicePoint: 300, expandText: '[+]', expandPrefix: ' ', userCollapseText: '[-]',});
$('#description-text').expander({slicePoint: 300, expandText: '[+]', expandPrefix: ' ', userCollapseText: '[-]',});
<% end %>

<div id="request_navigation_box" style="position: absolute; right: 0.3em;">
Expand Down
4 changes: 2 additions & 2 deletions src/api/spec/helpers/webui/webui_helper_spec.rb
Expand Up @@ -170,9 +170,9 @@
describe '#remove_dialog_tag' do
it "generates a 'pre' element and uses it's parameter as text field" do
expect(description_wrapper('some description')).to eq(
'<pre id="description_text" class="plain">some description</pre>')
'<pre id="description-text" class="plain">some description</pre>')
expect(description_wrapper('some other description')).to eq(
'<pre id="description_text" class="plain">some other description</pre>')
'<pre id="description-text" class="plain">some other description</pre>')
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/api/test/functional/webui/maintenance_workflow_test.rb
Expand Up @@ -57,7 +57,7 @@ def test_full_maintenance_workflow

find(:link, 'open request').click
first('.request_link').click
find(:id, 'description_text').text.must_equal 'I want the update'
find(:id, 'description-text').text.must_equal 'I want the update'
find(:id, 'action_display_0').must_have_text ('Release in BaseDistro2.0:LinkedUpdateProject')
fill_in 'reason', with: 'really? ok'
find(:id, 'accept_request_button').click
Expand Down Expand Up @@ -112,7 +112,7 @@ def test_full_maintenance_workflow

find(:link, 'open request').click
first('.request_link').click
find(:id, 'description_text').text.must_equal 'I have a additional fix'
find(:id, 'description-text').text.must_equal 'I have a additional fix'
find(:link, 'Merge with existing incident').click
# set to not existing incident
fill_in 'incident_project', with: '2'
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/webui/package_create_test.rb
Expand Up @@ -32,7 +32,7 @@ def create_package new_package
flash_message.must_equal message_prefix + 'was created successfully'
flash_message_type.must_equal :info
new_package[:description] = 'No description set' if new_package[:description].empty?
assert_equal new_package[:description].gsub(%r{\s+}, ' '), find(:id, 'description_text').text
assert_equal new_package[:description].gsub(%r{\s+}, ' '), find(:id, 'description-text').text
elsif new_package[:expect] == :invalid_name
flash_message.must_equal "Invalid package name: '#{new_package[:name]}'"
flash_message_type.must_equal :alert
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/webui/package_edit_test.rb
Expand Up @@ -21,7 +21,7 @@ def package_title # src/api/spec/controllers/webui/package_controller_spec.rb
# ============================================================================
#
def package_description # src/api/spec/controllers/webui/package_controller_spec.rb
find(:id, 'description_text').text
find(:id, 'description-text').text
end

# ============================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/webui/patchinfo_controller_test.rb
Expand Up @@ -91,7 +91,7 @@ def test_create_patchinfo_with_desc_and_sum
page.must_have_text "This update was submitted from #{current_user}"
page.must_have_text "and rated as low"

assert_equal find(:id, "description_text").text, description
assert_equal find(:id, "description-text").text, description
page.must_have_selector("#zypp_false")
page.must_have_selector("#reboot_false")
page.must_have_selector("#relogin_false")
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/webui/project_controller_test.rb
Expand Up @@ -239,7 +239,7 @@ def test_request_project_repository_target_removal
login_adrian to: project_show_path(project: 'home:adrian:hasrepotoremove')
find('#tab-requests a').click # The project tab "Requests"
find('.request_link').click # Should be the first and only request for this project
find(:id, 'description_text').text.must_equal "I don't like the repo"
find(:id, 'description-text').text.must_equal "I don't like the repo"
fill_in 'reason', with: 'really? ok'
find(:id, 'accept_request_button').click
visit project_show_path(project: 'home:adrian:hasrepotoremove')
Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/webui/project_edit_test.rb
Expand Up @@ -20,7 +20,7 @@ def project_title
# will probably get trimmed and stripped when displayed.
#
def project_description
find(:id, 'description_text').text
find(:id, 'description-text').text
end

# ============================================================================
Expand Down
4 changes: 2 additions & 2 deletions src/api/test/functional/webui/request_controller_test.rb
Expand Up @@ -37,7 +37,7 @@ def test_can_request_role_addition_for_projects
click_button 'Ok'
requestid = current_path.gsub(%r{\/request\/show\/(\d*)}, '\1').to_i
page.must_have_text 'Iggy Pop (Iggy) wants the role bugowner for project home:tom'
find('#description_text').must_have_text 'I can fix bugs too.'
find('#description-text').must_have_text 'I can fix bugs too.'
page.must_have_selector(:xpath, "//input[@name='revoked']")
page.must_have_text('In state new')

Expand All @@ -59,7 +59,7 @@ def test_can_request_role_addition_for_packages
click_button 'Ok'
requestid = current_path.gsub(%r{\/request\/show\/(\d*)}, '\1').to_i
find('#action_display_0').must_have_text 'Iggy Pop (Iggy) wants the role maintainer for package Apache / apache2'
find('#description_text').must_have_text 'I can fix bugs too.'
find('#description-text').must_have_text 'I can fix bugs too.'
page.must_have_selector(:xpath, "//input[@name='revoked']")
page.must_have_text('In state new')

Expand Down

0 comments on commit 9b39fa8

Please sign in to comment.