Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: break long url text in map search link and url lists #718

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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