Bug 28453 - Update pagination subroutine to generate Bootstrap markup
Summary: Update pagination subroutine to generate Bootstrap markup
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on: 35402
Blocks:
  Show dependency treegraph
 
Reported: 2021-05-25 16:22 UTC by Owen Leonard
Modified: 2025-01-16 14:25 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement updates how pagination bars are generated and displayed in the staff interface for these areas, so that they are consistent with the pagination for catalog search results: - Authorities > Authority search results - Cataloging > Cataloging search results - Cataloging > MARC Editor > Tags that uses the unimarc_field_210c value builder - Reports > Saved SQL reports > Report 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
Version(s) released in:
Circulation function:


Attachments
Bug 28453: Update pagination subroutine to generate Bootstrap markup (16.84 KB, patch)
2021-10-06 18:46 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: Update pagination subroutine to generate Bootstrap markup (15.81 KB, patch)
2021-10-25 14:37 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: DO NOT PUSH - FOR MARC21 TESTING ONLY (2.55 KB, patch)
2021-10-25 14:37 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: Update pagination subroutine to generate Bootstrap markup (15.86 KB, patch)
2021-10-25 19:29 UTC, David Nind
Details | Diff | Splinter Review
Bug 28453: DO NOT PUSH - FOR MARC21 TESTING ONLY (2.60 KB, patch)
2021-10-25 19:29 UTC, David Nind
Details | Diff | Splinter Review
Bug 28453: (follow-up) Make pagination labels translatable (3.71 KB, patch)
2021-11-02 11:25 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: Update pagination subroutine to generate Bootstrap markup (16.78 KB, patch)
2024-09-05 14:24 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: DO NOT PUSH - FOR MARC21 TESTING ONLY (2.60 KB, patch)
2024-09-05 14:24 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: (follow-up) Make pagination labels translatable (3.13 KB, patch)
2024-09-05 14:24 UTC, Owen Leonard
Details | Diff | Splinter Review
Pagination bar screenshots - after the patches (PDF) (347.65 KB, application/pdf)
2024-09-06 19:56 UTC, David Nind
Details
Bug 28453: Update pagination subroutine to generate Bootstrap markup (16.83 KB, patch)
2024-12-06 19:50 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: DO NOT PUSH - FOR MARC21 TESTING ONLY (2.60 KB, patch)
2024-12-06 19:50 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: (follow-up) Make pagination labels translatable (3.13 KB, patch)
2024-12-06 19:50 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: Update pagination subroutine to generate Bootstrap markup (16.88 KB, patch)
2024-12-08 16:53 UTC, David Nind
Details | Diff | Splinter Review
Bug 28453: DO NOT PUSH - FOR MARC21 TESTING ONLY (2.60 KB, patch)
2024-12-08 16:53 UTC, David Nind
Details | Diff | Splinter Review
Bug 28453: (follow-up) Make pagination labels translatable (3.18 KB, patch)
2024-12-08 16:53 UTC, David Nind
Details | Diff | Splinter Review
Bug 28453: Update pagination subroutine to generate Bootstrap markup (16.29 KB, patch)
2025-01-16 14:00 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: DO NOT PUSH - FOR MARC21 TESTING ONLY (1.52 KB, patch)
2025-01-16 14:00 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: (follow-up) Make pagination labels translatable (3.18 KB, patch)
2025-01-16 14:00 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28453: Update pagination subroutine to generate Bootstrap markup (16.38 KB, patch)
2025-01-16 14:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28453: (follow-up) Make pagination labels translatable (3.25 KB, patch)
2025-01-16 14:25 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2021-05-25 16:22:28 UTC
Many places in Koha use a subroutine in Output.pm, "pagination_bar" to generate pagination menus. These end up looking very different from some other pagination menus in Koha, particularly the one on the catalog search results page.

Bug 18008 proposed to move more of the markup-generation into the template, which I think is the right solution. That bug has been stalled for a while now, so I'd like to make an interim change until that can get some attention again.
Comment 1 Owen Leonard 2021-10-06 18:46:34 UTC Comment hidden (obsolete)
Comment 2 David Nind 2021-10-25 00:11:18 UTC
Things noted from testing:

- Administration -> Record matching rules: with 30 entries the pagination bar didn't appear (both before and after the patch was applied) - I'm assuming it should have kicked in at 20?

- Cataloging -> MARC Editor -> Tag using unimarc_field_210c value builder: this worked after patch applied (before the patch was applied I couldn't get any results). However, when you click on the controls for anything after page 1, it says no results (even when there are more than 20 results).

- Tools > Comments: The pagination only appears at the bottom - should this be added at the top as well?
Comment 3 Owen Leonard 2021-10-25 14:37:22 UTC Comment hidden (obsolete)
Comment 4 Owen Leonard 2021-10-25 14:37:25 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2021-10-25 14:41:21 UTC
(In reply to David Nind from comment #2)
> - Administration -> Record matching rules

This was an error in my test plan. It is one of the pages which had unused pagination markup in the template.

> - Cataloging -> MARC Editor -> Tag using unimarc_field_210c value builder:
> this worked after patch applied

I'm glad you caught this because I made a "temporary" change which ended up in the patch. In order to test using my MARC21 data I altered the search to use PERSO_NAME instead of EDITORS. This is now in the DO NOT PUSH patch which will enable testing of the pagination bar if you have PERSO_NAME authorities.

> - Tools > Comments: The pagination only appears at the bottom - should this
> be added at the top as well?

I thought the same, but I didn't want to make any additions in this patch.
Comment 6 David Nind 2021-10-25 19:29:47 UTC Comment hidden (obsolete)
Comment 7 David Nind 2021-10-25 19:29:52 UTC Comment hidden (obsolete)
Comment 8 David Nind 2021-10-25 19:30:32 UTC
Thanks Owen for fixing and clarifying - signed off now!
Comment 9 Katrin Fischer 2021-11-01 12:54:27 UTC
I am sorry, but I believe there are some translation issues hiding here.

In Output.pm:
+              . '<i class="fa fa-fw fa-angle-double-left"></i> First' . '</a></li>';
+              . '" rel="prev">' . '<i class="fa fa-fw fa-angle-left"></i> Previous' . '</a></li>';
. '" rel="next">' . 'Next <i class="fa fa-fw fa-angle-right"></i>' . '</a></li>';
Comment 10 Owen Leonard 2021-11-02 11:25:25 UTC Comment hidden (obsolete)
Comment 11 Jonathan Druart 2021-12-13 14:20:06 UTC
Owen, it seems that you needs to adjust the two occurrences at the OPAC as well:

opac/opac-authorities-home.pl:        pagination_bar => pagination_bar(

opac/opac-shelves.pl:                    pagination_bar => pagination_bar(
opac/opac-shelves.pl:        pagination_bar => pagination_bar(
Comment 12 Owen Leonard 2024-09-05 14:24:49 UTC Comment hidden (obsolete)
Comment 13 Owen Leonard 2024-09-05 14:24:51 UTC Comment hidden (obsolete)
Comment 14 Owen Leonard 2024-09-05 14:24:53 UTC Comment hidden (obsolete)
Comment 15 David Nind 2024-09-06 19:35:09 UTC
I have tested again.

The only issue I'm having is with the unimarc_field_210c value builder. I can't get it to generate any results, both before and after the patch.

I ended up testing on a UNIMARC instance without the DO NOT PUSH patch:
1. Edit KTD .env file and change KOHA_MARC_FLAVOUR=unimarc
2. Start up KTD as normal: ktd up
3. Change the default framework so that 210$c uses the unimarc_field_210c.pl value builder (in the default KTD setup it is using unimarc_field_210c-bis.pl - this is mapped to biblioitems.publishercode)
4. Edit any record
5. Select the tag editor for 210$c
6. Try several combinations to get some search results (I used search terms that worked with normal authority searching) - I had no luck. Examples
   . a
   . c
   . france 
   . Catel

Maybe this is already broken or not working as it should?

From previous testing (comment #2) it looks like it did work.
Comment 16 David Nind 2024-09-06 19:56:47 UTC
Created attachment 171150 [details]
Pagination bar screenshots - after the patches (PDF)

When testing, I noticed some inconsistencies in how the pagination is displayed - compared to the standard catalog search results.

I've attached a document with screenshots after the patches are applied, for easier comparison.

For a future bug.

- Standard catalog search results:
  . The pagination bar is displayed after the action buttons, and above the table of search results - in the section with the white background.

- Authority record search results:
  . The pagination bar is displayed in the section with the white background, above the table of search results.
  . The number of search results is displayed after the pagination bar - "Results 1 to 20 of 246".

- Cataloguing search results:
  . The pagination bar is displayed in the section with the white background, above the table of search results.
  . The number of results is displayed before the pagination bar - "74 result(s) found in catalog, 0 result(s) found in reservoir".

- Cataloguing - unimarc_field_210c value builder:
  . Not getting any results before and after the patch.

- Saved SQL reports - results from running a report:
  . This is for the pagination bar for the results of a report (the list of saved reports uses DataTables).
  . The pagination bar is displayed in the section with the white background, above the table of search results.
  . The number of results is displayed before the pagination bar - "Total number of results: 863 (20 shown) ".

- Comments:
  . As noted in comment #2, the pagination bar only appears at the bottom of the list.
  . Tab headings are in plain text (Approved comments, Comments awaiting moderation) - created bug 37859

- Lists:
  . The pagination bar is displayed above the action buttons, outside the section with the white background.
  . The number of results is displayed before the pagination bar - "This list contains 25 titles".

- Markup removed, as not being used:
  . Patron attribute search types: before and after the patch using DataTables(?)
  . Record matching results: not using any pagination, tested with 21 rules
  . Tags: before and after the patch using DataTables(?)
Comment 17 Owen Leonard 2024-12-06 19:50:48 UTC Comment hidden (obsolete)
Comment 18 Owen Leonard 2024-12-06 19:50:51 UTC Comment hidden (obsolete)
Comment 19 Owen Leonard 2024-12-06 19:50:53 UTC Comment hidden (obsolete)
Comment 20 David Nind 2024-12-08 16:53:22 UTC Comment hidden (obsolete)
Comment 21 David Nind 2024-12-08 16:53:26 UTC Comment hidden (obsolete)
Comment 22 David Nind 2024-12-08 16:53:29 UTC
Created attachment 175281 [details] [review]
Bug 28453: (follow-up) Make pagination labels translatable

This patch moves the English strings out of Output.pm and adds classes
to the pagination markup which can be used as hooks for JavaScript. The
global JS include is modified to look for these hooks and add text
labels to the links.

Signed-off-by: David Nind <david@davidnind.com>
Comment 23 Jonathan Druart 2025-01-16 11:30:53 UTC
Is this change in the first patch expected?

-            <input type="hidden" name="authtypecode" value="PERSO_NAME" />
+            <input type="hidden" name="authtypecode" value="EDITORS" />
Comment 24 Jonathan Druart 2025-01-16 11:33:23 UTC
What about the difference between DT's pagination and those pagination menus?

Shouldn't we style them identically?
Comment 25 Owen Leonard 2025-01-16 14:00:24 UTC
Created attachment 176663 [details] [review]
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 <david@davidnind.com>
Comment 26 Owen Leonard 2025-01-16 14:00:27 UTC
Created attachment 176664 [details] [review]
Bug 28453: DO NOT PUSH - FOR MARC21 TESTING ONLY

This patch changes the authority type searched by the UNIMARC 210$c
plugin from EDITORS to PERSO_NAME in order to try to make it more easily
testable by MARC21 users.

FOR TESTING ONLY!!

Signed-off-by: David Nind <david@davidnind.com>
Comment 27 Owen Leonard 2025-01-16 14:00:29 UTC
Created attachment 176665 [details] [review]
Bug 28453: (follow-up) Make pagination labels translatable

This patch moves the English strings out of Output.pm and adds classes
to the pagination markup which can be used as hooks for JavaScript. The
global JS include is modified to look for these hooks and add text
labels to the links.

Signed-off-by: David Nind <david@davidnind.com>
Comment 28 Owen Leonard 2025-01-16 14:03:43 UTC
(In reply to Jonathan Druart from comment #23)
> Is this change in the first patch expected?

No that was included by mistake. I have re-uploaded the patches without that change.

(In reply to Jonathan Druart from comment #24)
> What about the difference between DT's pagination and those pagination menus?

I think that is a question that requires more feedback from users. My rationale for having them be different is that the controls trigger very different actions: The Bootstrap-styled links will cause a new page to load. The DT controls only affect the table. In my opinion it is correct that users have a clue about this difference.
Comment 29 Jonathan Druart 2025-01-16 14:25:01 UTC
Created attachment 176666 [details] [review]
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 <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 30 Jonathan Druart 2025-01-16 14:25:04 UTC
Created attachment 176667 [details] [review]
Bug 28453: (follow-up) Make pagination labels translatable

This patch moves the English strings out of Output.pm and adds classes
to the pagination markup which can be used as hooks for JavaScript. The
global JS include is modified to look for these hooks and add text
labels to the links.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>