From 92bba4ec085fdacff1d141093256f59d8b6b3234 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 4 Mar 2021 13:57:32 +0000 Subject: [PATCH] Bug 27830: OPAC library list does not use AddressFormat This patch adds a new include file for displaying library addresses according to the AddressFormat system preference. It differs from the include file used for patrons in the staff interface because library addresses don't use streetnumber or road types. To test, apply the patch and rebuild the OPAC CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Make sure you have fill address information entered for at least one library. - In the OPAC, view the "Libraries" page. - Check that the format of the library addresses is correct when using any of the three address formats: de, fr, and us. Signed-off-by: David Nind Signed-off-by: Katrin Fischer --- koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss | 4 + .../en/includes/display-library-address.inc | 114 +++++++++++++++++++++ .../opac-tmpl/bootstrap/en/modules/opac-library.tt | 45 +++----- 3 files changed, 130 insertions(+), 33 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss index e960e87aea..391a10f296 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss +++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss @@ -2622,4 +2622,8 @@ $star-selected: #EDB867; } } +.branchaddress { + margin-bottom: 1rem; +} + @import "responsive"; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc new file mode 100644 index 0000000000..4b0e39e638 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/display-library-address.inc @@ -0,0 +1,114 @@ +[%~ USE Koha ~%] +[%~ USE raw ~%] +[%~ BLOCK 'display-library-address' ~%] + [%~ SET line_break = "
" ~%] + [%~ IF no_line_break %][% SET line_break = " " %][% END ~%] + [%~ IF Koha.Preference( 'AddressFormat' ) ~%] + [%~ PROCESS "display-library-address-${ Koha.Preference( 'AddressFormat' ) }" ~%] + [%~ ELSE ~%] + [%~ PROCESS 'display-library-address-us' ~%] + [%~ END ~%] +[%~ END ~%] + +[%~ BLOCK 'display-library-address-us' ~%] + [%~ IF ( library.branchaddress1 or library.branchaddress2 ) ~%] + + [%~ IF ( library.branchaddress1 ) ~%] +
+ [% library.branchaddress1 | html %] +
+ [%~ END ~%] + [%~ IF ( library.branchaddress2 ) ~%] +
+ [%~ library.branchaddress2 |html ~%] +
+ [%~ END ~%] + [%~ IF ( library.branchaddress3 ) ~%] + + [%~ library.branchaddress3 | html ~%] + + [% line_break | $raw %] + [%~ END ~%] +
+ [%~ END ~%] + [%~ IF ( library.branchcity ) ~%] +
+ + [%~ library.branchcity |html ~%] + + [%~ IF ( library.branchstate ) %] + + , [% library.branchstate |html ~%] + + [%~ END ~%] + [%~ IF ( library.branchzip ) %] + + [%~ " " _ library.branchzip |html ~%] + + [%~ END ~%] + [%~ IF ( library.branchcountry ) %] +
+ [% library.branchcountry |html ~%] +
+ [%~ END ~%] +
+ [%~ END ~%] +[%~ END ~%] + +[%~ BLOCK 'display-library-address-de' ~%] + [%~ IF ( library.branchaddress1 or library.branchaddress2 ) ~%] + + [%~ IF ( library.branchaddress1 ) ~%] +
+ [%~ library.branchaddress1 | html ~%] +
+ [%~ END ~%] + [%~ IF ( library.branchaddress2 ) ~%] +
+ [%~ library.branchaddress2 | html ~%] +
+ [%~ END ~%] + [%~ IF ( library.branchaddress3 ) ~%] + + [%~ library.branchaddress3 | html ~%] + + [% line_break | $raw %] + [%~ END ~%] +
+ [%~ END ~%] + [%~ IF ( library.branchcity ) ~%] +
+ [%~ IF ( library.branchzip ) ~%][%~ library.branchzip | html %] [% END ~%][%~ library.branchcity | html ~%][%~ IF ( library.branchstate ) ~%][% line_break | $raw %][%~ library.branchstate | html ~%][%~ END ~%] + [%~ IF ( library.branchcountry ) ~%][% line_break | $raw %][%~ library.branchcountry | html ~%][%~ END ~%] +
+ [%~ END ~%] +[%~ END ~%] + +[%~ BLOCK 'display-library-address-fr' ~%] + [%~ IF ( library.branchaddress1 or library.branchaddress2 ) ~%] + [%~ IF ( library.branchaddress1 ) ~%] + + [%~ library.branchaddress1 | html ~%] + + [% line_break | $raw %] + [%~ END ~%] + [%~ IF ( library.branchaddress2 ) ~%] + + [%~ library.branchaddress2 | html ~%] + + [% line_break | $raw %] + [%~ END ~%] + [%~ IF ( library.branchaddress3 ) ~%] + + [%~ library.branchaddress3 | html ~%] + + [% line_break | $raw %] + [%~ END ~%] + [%~ END ~%] + [%~ IF ( library.branchcity ) ~%] + + [%~ IF ( library.branchzip ) ~%][%~ library.branchzip | html %] [% END ~%][%~ library.branchcity | html ~%][%~ IF ( library.branchstate ) ~%][% line_break | $raw %][%~ library.branchstate | html ~%][%~ END ~%] + [%~ IF ( library.branchcountry ) ~%][% line_break | $raw %][%~ library.branchcountry | html ~%][%~ END ~%] + + [%~ END ~%] +[%~ END ~%] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt index 66f131e61a..2a2506e853 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE Koha %] +[% PROCESS 'display-library-address.inc' %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( library ) %] @@ -28,40 +29,18 @@ [% END %] [% BLOCK library_info %] - <div property="address" typeof="PostalAddress"> - <span property="streetAddress"> - [% IF ( library.branchaddress1 ) %] - [% library.branchaddress1 | html %] - [% END %] - [% IF ( library.branchaddress2 ) %] - <br />[% library.branchaddress2 | html %] - [% END %] - [% IF ( library.branchaddress3 ) %] - <br />[% library.branchaddress3 | html %] - [% END %] - </span><br> - [% IF ( library.branchcity ) %] - <span property="addressLocality">[% library.branchcity | html %]</span> - [% END %] - [% IF ( library.branchstate ) %] - <span property="addressRegion">[% library.branchstate | html %]</span> - [% END %] - [% IF ( library.branchzip ) %] - <span property="postalCode">[% library.branchzip | html %]</span> - [% END %] - [% IF ( library.branchcountry ) %] - <br /><span property="addressCountry">[% library.branchcountry | html %]</span> - [% END %] - [% IF ( library.branchphone ) %] - <p>Phone: <a href="tel:[% library.branchphone | url %]" property="telephone">[% library.branchphone | html %]</a></p> - [% END %] - [% IF ( library.branchfax ) %] - <p>Fax: <span property="faxNumber">[% library.branchfax | html %]</span></p> - [% END %] - [% IF ( library.branchurl ) %] - <p><a href="[% library.branchurl | url %]" property="url">[% library.branchurl | html %]</a></p> - [% END %] + <div class="branchaddress" property="address" typeof="PostalAddress"> + [% PROCESS 'display-library-address' %] </div> <!-- /div property=address --> + [% IF ( library.branchphone ) %] + <p>Phone: <a href="tel:[% library.branchphone | url %]" property="telephone">[% library.branchphone | html %]</a></p> + [% END %] + [% IF ( library.branchfax ) %] + <p>Fax: <span property="faxNumber">[% library.branchfax | html %]</span></p> + [% END %] + [% IF ( library.branchurl ) %] + <p><a href="[% library.branchurl | url %]" property="url">[% library.branchurl | html %]</a></p> + [% END %] [% END %] <div class="main"> -- 2.11.0