Skip to content

Commit

Permalink
Style the dropdown help text
Browse files Browse the repository at this point in the history
Co-authored-by: James R. Griffin III <jrgriffiniii@users.noreply.github.com>
Co-authored-by: Trey Pendragon <tpendragon@users.noreply.github.com>
Co-authored-by: Eliot Jordan <eliotjordan@users.noreply.github.com>
  • Loading branch information
4 people committed Nov 13, 2023
1 parent f18ee93 commit d54e235
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@import 'components/browse';
@import 'components/buttons';
@import 'components/dropdown';
@import 'components/dropdown-help-text';
@import 'components/facets';
@import 'components/font-face';
@import 'components/footer';
Expand Down
5 changes: 5 additions & 0 deletions app/assets/stylesheets/components/dropdown-help-text.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dropdown-help-text {
margin-left: 10px;
font-size: 0.8em;
font-style: italic;
}
2 changes: 1 addition & 1 deletion app/components/orangelight/dropdown_help_text_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def before_render
return if options.any?

with_options(@choices.map do |option|
text = "#{option[:label]}: #{option[:helptext]}"
text = "<div>#{option[:label]}</div><div id='#{option[:value]}' class='dropdown-help-text'>#{option[:helptext]}</div>".html_safe
value = option[:value]
{ text:, url: helpers.url_for(@search_state.params_for_search(@param => value)), selected: @selected == value }
end)
Expand Down
4 changes: 3 additions & 1 deletion spec/system/search_algorithms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
expect(page).to have_text('1. Огонек : роман')

click_button('Rank by default')
expect(page).to have_text("move documents about engineering to the top")
within('#engineering.dropdown-help-text') do
expect(page).to have_text("move documents about engineering to the top")
end
click_link('engineering')
expect(page).to have_button('Rank by engineering')
expect(page).to have_text('1. Reconstructing the Vitruvian Scorpio: An Engineering Analysis')
Expand Down

0 comments on commit d54e235

Please sign in to comment.