From e7b2d1008d7ac6d6bbb5a176378944417797bb59 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 14 Jun 2024 18:06:15 +0000 Subject: [PATCH] Bug 28453: Update pagination subroutine to generate Bootstrap markup This patch modifies Output.pm to change the HTML it generates when creating pagination bars. The changes allow the pagination menu to be styled like Bootstrap pagination, making them consistent with the pagination on catalog search results. To test, apply the patch and rebuild the staff interface CSS (https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client). - Test pages where the pagination_bar subroutine is called: - Authorities -> Authority search results. - Cataloging -> Cataloging search results. - Cataloging -> MARC Editor -> Edit tag which is configured to use the unimarc_field_210c value builder. - Reports -> Saved SQL reports -> Results. - Tools -> Comments. - Lists -> List contents. The pagination bar markup was removed from the templates for these pages because it wasn't being used: - Administration -> Patron attribute types. - Administration -> Record matching rules. - Tools -> Tags. Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind Signed-off-by: Jonathan Druart --- C4/Output.pm | 54 +++++++------------ .../prog/css/src/staff-global.scss | 36 ------------- .../prog/en/modules/admin/matching-rules.tt | 2 - .../en/modules/admin/patron-attr-types.tt | 2 - .../modules/authorities/searchresultlist.tt | 8 ++- .../prog/en/modules/cataloguing/addbooks.tt | 16 +++--- .../value_builder/unimarc_field_210c.tt | 16 +++--- .../modules/reports/guided_reports_start.tt | 8 +-- .../prog/en/modules/reviews/reviewswaiting.tt | 6 ++- .../prog/en/modules/virtualshelves/shelves.tt | 10 +++- 10 files changed, 63 insertions(+), 95 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index d8ea0bfb521..90fbad510b2 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -110,21 +110,17 @@ sub pagination_bar { # navigation bar useful only if more than one page to display ! if ( $nb_pages > 1 ) { - + $pagination_bar = '
    '; # link to first page? if ( $current_page > 1 ) { $pagination_bar .= - "\n" . ' ' - . '' - . '<<' . ''; - } - else { - $pagination_bar .= - "\n" . ' <<'; + . ' First' . ''; } # link on previous page ? @@ -132,16 +128,12 @@ sub pagination_bar { my $previous = $current_page - 1; $pagination_bar .= - "\n" . ' ' - . ''; - } - else { - $pagination_bar .= - "\n" . ' <'; + . '" rel="prev">' . ' Previous' . ''; } my $min_to_display = $current_page - $pages_around; @@ -160,25 +152,25 @@ sub pagination_bar { and $last_displayed_page != $page_number - 1 ) { $pagination_bar .= - "\n" . ' ...'; + "\n" . '
  • ...
  • '; } if ( $page_number == $current_page ) { $pagination_bar .= - "\n" . ' ' - . '' + "\n" . '' + . '
  • ' . $page_number - . ''; + . '
  • '; } else { $pagination_bar .= - "\n" . ' ' - . '' - . $page_number . ''; + . $page_number . ''; } $last_displayed_page = $page_number; } @@ -189,31 +181,25 @@ sub pagination_bar { my $next = $current_page + 1; $pagination_bar .= "\n" - . ' '; - } - else { - $pagination_bar .= - "\n" . ' >'; + . '" rel="next">' . 'Next ' . ''; } # link to last page? if ( $current_page != $nb_pages ) { $pagination_bar .= "\n" - . ' ' - . '>>' . ''; - } - else { - $pagination_bar .= - "\n" . ' >>'; + . 'Last ' . ''; } + + $pagination_bar .= "\n" . '
'; } return $pagination_bar; diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 878634a08a4..b59fb34640a 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -694,42 +694,6 @@ div { } } - &.pages { - margin: .5em 0; - - a { - font-weight: bold; - padding: 1px 5px; - text-decoration: none; - - &:link, - &:visited { - background-color: #EEEEEE; - color: #3366CC; - } - - &:hover, - &:active { - background-color: #FFC; - } - } - - .current, - .currentPage { - background-color: #E6FCB7; - color: #666; - font-weight: bold; - padding: 1px 5px; - } - - .inactive { - background-color: #F3F3F3; - color: #BCBCBC; - font-weight: bold; - padding: 1px 5px; - } - } - .browse { margin: .5em 0; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt index 83657ed0371..a0ca863a1bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tt @@ -483,8 +483,6 @@ [% ELSE %]

There are no saved matching rules.

[% END # /IF ( available_matching_rules ) %] - -
[% pagination_bar | $raw %]
[% END # /IF ( display_list ) %] [% IF ( matching_rule_form ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt index 57748196e1d..4d49677eb95 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt @@ -390,8 +390,6 @@

There are no saved patron attribute types.

[% END %] -
[% pagination_bar | $raw %]
- [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt index 2461371da07..f430630bff8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -54,7 +54,9 @@ [% END %] [% IF ( total ) %] -
[% pagination_bar | $raw %]
+

Results [% from | html %] to [% to | html %] of [% total | html %] @@ -141,7 +143,9 @@ [% INCLUDE 'authority-detail-modal.inc' %] -

[% pagination_bar | $raw %]
+ [% ELSE %] No results found diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt index 9e4b2c6fb39..092a0e6b6c4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -94,11 +94,13 @@ [% IF ( total ) %]

Records found in the catalog

-
- [% total | html %] result(s) found in catalog, - [% breeding_count | html %] result(s) found in reservoir -
-
[% pagination_bar | $raw %]
+
+ [% total | html %] result(s) found in catalog, + [% breeding_count | html %] result(s) found in reservoir +
+
@@ -186,7 +188,9 @@ [% END # /FOREACH resultsloo %]
-
[% pagination_bar | $raw %]
+
[% ELSE # IF total %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt index f1b9cd0edab..62697213147 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c.tt @@ -48,10 +48,11 @@ [% IF ( total ) %] -

Authority search results

-
- [% pagination_bar | $raw %] -
[% END %] +

Authority search results

+ + [% END %]

[% IF ( total ) %]  Results [% from | html %] to [% to | html %] of [% total | html %]

@@ -85,9 +86,10 @@ [% END %] - [% IF ( total ) %]

- [% pagination_bar | $raw %] -
+ [% IF ( total ) %] + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index cdba5aad888..61552c24042 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -1155,9 +1155,9 @@ [% END # /IF batch operations || ( unlimited_total > 10 && limit <= 1000 ) %] -
+
+ [% END # UNLESS ( errors ) %] [% END # IF ( execute ) %] @@ -1237,7 +1237,9 @@ [% END %] -
[% pagination_bar | $raw %]
+ [% INCLUDE 'chart.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt index 41613af4674..9e0c230763c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt @@ -123,7 +123,11 @@ [% END %] -
[% pagination_bar | $raw %]
+ + + [% ELSE %] [% IF ( status ) %]

No comments have been approved.

[% ELSE %]

No comments to moderate.

[% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 926afb5c1fc..e23a28855fa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -242,7 +242,11 @@ [% IF itemsloop %] [% SET contents = shelf.get_contents %] [% IF ( contents.count ) %]

This list contains [% contents.count | html %] titles

[% END %] -
[% pagination_bar | $raw %]
+ + +
[% INCLUDE 'csrf-token.inc' %] @@ -388,7 +392,9 @@ -
[% pagination_bar | $raw %]
+
[% END # /IF itemsloop %] [% END # /IF op == 'view' %] -- 2.34.1