From 2685ac2c6ca86621790ee2b00f36959a65df3bc0 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 Signed-off-by: Katrin Fischer --- C4/Output.pm | 66 +++++++++++++------ .../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 | 4 +- .../prog/en/modules/cataloguing/addbooks.tt | 4 +- .../value_builder/unimarc_field_210c.tt | 4 +- .../modules/reports/guided_reports_start.tt | 4 +- .../prog/en/modules/reviews/reviewswaiting.tt | 3 +- .../prog/en/modules/virtualshelves/shelves.tt | 6 +- 10 files changed, 61 insertions(+), 70 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index 14892c29b2..cba1e07b34 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -109,13 +109,19 @@ 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" . ' <<'; + "\n" + . '' + . '
  • ' + . ' First' + . '
  • '; } # link on previous page ? @@ -123,9 +129,15 @@ sub pagination_bar { my $previous = $current_page - 1; $pagination_bar .= - "\n" . ' ' . ''; - } else { - $pagination_bar .= "\n" . ' <'; + "\n" + . '' + . '
  • '; } my $min_to_display = $current_page - $pages_around; @@ -143,20 +155,26 @@ sub pagination_bar { if ( defined $last_displayed_page and $last_displayed_page != $page_number - 1 ) { - $pagination_bar .= "\n" . ' ...'; + $pagination_bar .= "\n" . '
  • ...
  • '; } if ( $page_number == $current_page ) { - $pagination_bar .= "\n" . ' ' . '' . $page_number . ''; + $pagination_bar .= + "\n" + . '' + . '
  • ' + . $page_number + . '
  • '; } else { $pagination_bar .= "\n" - . ' ' - . '' - . $page_number . ''; + . $page_number + . ''; } $last_displayed_page = $page_number; } @@ -166,19 +184,29 @@ sub pagination_bar { if ( $current_page < $nb_pages ) { my $next = $current_page + 1; - $pagination_bar .= - "\n" . ' '; - } else { - $pagination_bar .= "\n" . ' >'; + $pagination_bar .= "\n" + . '
  • '; } # link to last page? if ( $current_page != $nb_pages ) { - $pagination_bar .= - "\n" . ' ' . '>>' . ''; - } else { - $pagination_bar .= "\n" . ' >>'; + $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 8491ee604a..7cf5f1237d 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 e816bcfec9..99488fe656 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 @@ -611,8 +611,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 2b916c2691..e371715529 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 @@ -384,8 +384,6 @@ [% ELSE %]

There are no saved patron attribute types.

[% END %] - -
[% pagination_bar | $raw %]
[% END %] [% END %] [% MACRO jsinclude BLOCK %] 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 3894e37fe0..0ac1f5ecc5 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,7 @@ [% END %] [% IF ( total ) %] -
[% pagination_bar | $raw %]
+

Results [% from | html %] to [% to | html %] of [% total | html %]

@@ -146,7 +146,7 @@ [% INCLUDE 'authority-detail-modal.inc' %] -
[% pagination_bar | $raw %]
+ [% ELSE %] No results found [% END %] 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 fe45a4a184..a07d43361a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt @@ -102,7 +102,7 @@ [% total | html %] result(s) found in catalog, [% breeding_count | html %] result(s) found in reservoir -
[% pagination_bar | $raw %]
+
@@ -196,7 +196,7 @@ [% END # /FOREACH resultsloo %]
-
[% pagination_bar | $raw %]
+
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 72f3f6320d..38159288f3 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 @@ -50,7 +50,7 @@ [% IF ( total ) %]

Authority search results

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

[% IF ( total ) %] @@ -86,7 +86,7 @@ [% END %] [% IF ( total ) %] -

[% pagination_bar | $raw %]
+ [% 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 5d294db2ec..623cd1b099 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 @@ -1246,7 +1246,7 @@ [% END # /IF batch operations || ( unlimited_total > 10 && limit <= 1000 ) %] -
[% pagination_bar | $raw %]
+ [% END # UNLESS ( errors ) %] [% END # IF ( execute ) %] @@ -1357,7 +1357,7 @@ [% END %] -
[% pagination_bar | $raw %]
+ [% INCLUDE 'chart.inc' %] [% END #/IF ( execute ) %] 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 a8889cc45e..051d46433a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reviews/reviewswaiting.tt @@ -116,7 +116,8 @@ [% 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 8267123aa5..4eee7f44e8 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,9 @@ [% 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' %] @@ -410,7 +412,7 @@ -
[% pagination_bar | $raw %]
+
[% END # /IF itemsloop %] [% END # /IF op == 'view' %]