From ef4dab52347c62de1d7ff95b69b97f6f955ee7bb Mon Sep 17 00:00:00 2001 From: Yetrina Battad Date: Tue, 5 Sep 2023 11:44:47 +1000 Subject: [PATCH] fix: break long url text in map search link and url lists --- app/helpers/application_helper.rb | 4 ++-- app/helpers/field_helper.rb | 2 +- spec/helpers/field_helper_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 129d2df5..130f4588 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/helpers/field_helper.rb b/app/helpers/field_helper.rb index 1800c144..76cdca28 100644 --- a/app/helpers/field_helper.rb +++ b/app/helpers/field_helper.rb @@ -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 diff --git a/spec/helpers/field_helper_spec.rb b/spec/helpers/field_helper_spec.rb index d3178cf9..249dac38 100644 --- a/spec/helpers/field_helper_spec.rb +++ b/spec/helpers/field_helper_spec.rb @@ -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 'Text version:' + expect(list).to include 'Text version:' end end @@ -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 "View this map in Map Search" + expect(map_search_value).to eq 'View this map in Map Search' end context "when there is no value" do