Skip to content

Commit

Permalink
fix: break long url text in map search link and url lists
Browse files Browse the repository at this point in the history
  • Loading branch information
yetti committed Sep 5, 2023
1 parent 0b417a1 commit ef4dab5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def makelink(document:, href:, text:, classes: "", extended_info: false, longtex
if text.present? && href.present?
# if an eResources link, route to offsite handler
result << if entry.present?
link_to(text, offsite_catalog_path(id: document.id, url: href))
link_to(text, offsite_catalog_path(id: document.id, url: href), class: "text-break")
else
link_to(text, href)
link_to(text, href, class: "text-break")
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/field_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def notes(document:, field:, config:, value:, context:)
def map_search(document:, field:, config:, value:, context:)
if value.present?
# rubocop:disable Rails/OutputSafety
link_to("View this map in Map Search", value.first.html_safe)
link_to("View this map in Map Search", value.first.html_safe, class: "text-break")
# rubocop:enable Rails/OutputSafety
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/field_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let(:value) { [{text: "Text version:", href: "http://purl.access.gpo.gov/GPO/LPS9877"}] }

it "generates a link to the item" do
expect(list).to include '<a href="http://purl.access.gpo.gov/GPO/LPS9877">Text version:</a>'
expect(list).to include '<a class="text-break" href="http://purl.access.gpo.gov/GPO/LPS9877">Text version:</a>'
end
end

Expand Down Expand Up @@ -293,7 +293,7 @@
let(:value) { ["https://mapsearch.nla.gov.au/?type=map&mapClassifications=all&geolocation=all&text=113030"] }

it "generates a link to Map Search" do
expect(map_search_value).to eq "<a href=\"https://mapsearch.nla.gov.au/?type=map&mapClassifications=all&geolocation=all&text=113030\">View this map in Map Search</a>"
expect(map_search_value).to eq '<a class="text-break" href="https://mapsearch.nla.gov.au/?type=map&mapClassifications=all&geolocation=all&text=113030">View this map in Map Search</a>'
end

context "when there is no value" do
Expand Down

0 comments on commit ef4dab5

Please sign in to comment.