From 2f76e1ac12434b07392f870df173a56020febe9d 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 | 66 +++++++++++++------ .../prog/css/src/staff-global.scss | 38 +---------- .../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, 62 insertions(+), 71 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index 14892c29b25..cba1e07b348 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 878634a08a4..e5fcb63d96e 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; } @@ -4895,4 +4859,4 @@ div .suggestion_note { display: block; } } -} +} \ No newline at end of file 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 e816bcfec93..99488fe6561 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 2b916c26917..e3717155293 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 3894e37fe06..0ac1f5ecc52 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 fe45a4a184d..a07d43361a8 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 72f3f6320d3..38159288f37 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 5d294db2ec6..623cd1b0995 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 a8889cc45ec..051d46433aa 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 5bed02084e9..91d4d06ede7 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' %] -- 2.39.5