Bug 34124: Improve in-page navigation on table settings page

This patch adds links to the table settings page so that the user can
jump directly to a particular table within a page section.

The patch also changes the logic of when in-page links are displayed: I
think it makes sense not to show a "Jump to page" link when there is
only one page. The page will show a "Jump to table" link only if there
is only one table.

To test, apply the patch and go to Administration -> Table settings.

- Expand and check multiple sections.
- In the "Administration" section, there are multiple pages.
  - Check that the "Jump to page" links work correctly.
- In the "Catalog" section, there is only one page: "detail."
  - Check that the "Jump to table" links work correctly.

Signed-off-by: Sam Lau <samalau@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-06-26 20:30:56 +00:00 committed by Tomas Cohen Arazi
parent 1b579868d5
commit 24b2cd367f
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 10 additions and 2 deletions

View File

@ -3,8 +3,8 @@
[% USE TablesSettings %]
[% SET footerjs = 1 %]
[% BLOCK pagelist %]
[% IF module.keys and module.keys.size > 0 %]
<span>Jump to:</span>
[% IF module.keys and module.keys.size > 1 %]
<span>Jump to page:</span>
[% FOR pagename IN module.keys.sort %]
<a href="#[% pagename | url %]">[% pagename | html %]</a>
[% UNLESS loop.last %]<span class="separator"> | </span>[% END %]
@ -18,6 +18,14 @@
[% FOR pagename IN module.keys.sort %]
<h4 class="page_name" id="[% pagename | html %]">Page: [% pagename | html %]</h4>
[% SET tables = module %]
[% IF tables.$pagename.keys and tables.$pagename.keys.size > 1 %]
Jump to table:
[% FOR tablename IN tables.$pagename.keys.sort %]
[% SET table_id = pagename _ '#' _ tablename %]
<a href="#[% table_id | uri %]">[% tablename | html %]</a>
[% UNLESS loop.last %]<span class="separator"> | </span>[% END %]
[% END %]
[% END %]
[% IF tables.$pagename.keys and tables.$pagename.keys.size > 0 %]
[% FOR tablename IN tables.$pagename.keys.sort %]
[% SET table_id = pagename _ '#' _ tablename %]