Bugzilla – Attachment 153058 Details for
Bug 34115
Use a global tab select function for activating Bootstrap tabs based on location hash
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34115: Use a global tab select function for activating Bootstrap tabs based on location hash
Bug-34115-Use-a-global-tab-select-function-for-act.patch (text/plain), 7.52 KB, created by
Owen Leonard
on 2023-07-05 13:14:29 UTC
(
hide
)
Description:
Bug 34115: Use a global tab select function for activating Bootstrap tabs based on location hash
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2023-07-05 13:14:29 UTC
Size:
7.52 KB
patch
obsolete
>From 497fbc95e3990bcdc06cfe3398ff135f48d3a5d9 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 23 Jun 2023 16:02:43 +0000 >Subject: [PATCH] Bug 34115: Use a global tab select function for activating > Bootstrap tabs based on location hash > >This patch fixes automatic tab selection by location.hash in the MARC >subfield editor. This allows links which target a specific subfield to >open the page with the subfield tab selected. > >I've put this into a global function since it can be reused in multiple >places: The about page and the checkout page have variations of this >functionality which can be replaced with this function. > >The patch also corrects two links in Koha pointing to the About >page which included the wrong location hash (changed in the switch to >Bootstrap tab wrappers). > >To test, apply the patch and go to Adminstration -> Bibliographic >frameworks. > >- View the MARC structure for any framework. > - In the "Search for tag" input field, submit a tag and subfield which > will be found in that framework, e.g. "245$a" > - When you submit the form you should be sent to the MARC subfield > structure page for that tag with the subfield tab automatically > selected. >- View the MARC subfield structure for any framework. > - In the table of subfields, click the subfield link in the first > column. You should be taken to the edit form with the corresponding > tab selected. >- Go to Circulation and check out to a patron. Append a tab anchor to > the URL, e.g. "#holds_panel" and submit. You may have to shift-reload > the page to see the change. (As far as I know no links in Koha take > advantage of this) >- Perform the same test on the patron detail page >- Go to the About page and perform the same test with a tab anchor like > "#team_panel" or "#sysinfo_panel" >--- > koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 4 +--- > .../intranet-tmpl/prog/en/modules/circ/returns.tt | 2 +- > .../intranet-tmpl/prog/en/modules/ill/ill-requests.tt | 2 +- > .../intranet-tmpl/prog/js/marc_subfields_structure.js | 5 ++++- > koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js | 8 ++------ > koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 11 +++++++++++ > 6 files changed, 20 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index c067af0695..375cc90c24 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -1216,9 +1216,7 @@ > [% MACRO jsinclude BLOCK %] > <script> > $(document).ready(function(){ >- /* Bootstrap doesn't support automatic targeting of tabs by location hash */ >- var activeTab = $("[href='" + location.hash + "']"); >- activeTab && activeTab.tab('show'); >+ selectBsTabByHash( "abouttabs" ); > }); > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >index 0028507470..9cd77b2162 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt >@@ -371,7 +371,7 @@ > <p class="problem ret_foreverdebarred"><strong>Reminder: </strong>Patron has an indefinite restriction.</p> > [% END %] > [% IF errmsgloo.data_corrupted %] >- <p class="problem ret_datacorrupt">The item has not been checked in due to a configuration issue in your system. You must ask an administrator to take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a> and correct all errors shown on the "System information" tab</p> >+ <p class="problem ret_datacorrupt">The item has not been checked in due to a configuration issue in your system. You must ask an administrator to take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo_panel">about page</a> and correct all errors shown on the "System information" tab</p> > [% END %] > [% END # /FOREACH errmsgloo %] > </div> <!-- /.dialog.dialog-alert --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >index 1f52f25cc4..77b40abe5f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >@@ -111,7 +111,7 @@ > [% END %] > <div id="interlibraryloans"> > [% IF !backends_available || !has_branch %] >- <div class="dialog message">ILL module configuration problem. Take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a></div> >+ <div class="dialog message">ILL module configuration problem. Take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo_panel">about page</a></div> > [% ELSE %] > [% INCLUDE 'ill-toolbar.inc' %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >index 898c64e3ae..119507ba01 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >@@ -1,4 +1,4 @@ >-/* global dataTablesDefaults tagsubfield */ >+/* global dataTablesDefaults tagsubfield selectBsTabByHash */ > $(document).ready(function() { > if( tagsubfield && tagsubfield == "@"){ > $("#subfieldtabs a[href='#subATfield']").tab("show"); >@@ -39,6 +39,9 @@ $(document).ready(function() { > aaSorting: [], > paginate: false > })); >+ >+ selectBsTabByHash("subfieldtabs"); >+ > }); > > /* Function to enable/disable hidden values checkboxes when Flag is (de)selected */ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >index 7a8f53f474..d05d87b5bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >@@ -1,4 +1,4 @@ >-/* global borrowernumber */ >+/* global borrowernumber selectBsTabByHash */ > $(document).ready(function() { > $("#CheckAllExports").on("click",function(){ > $(".export:visible").prop("checked", true); >@@ -91,11 +91,7 @@ $(document).ready(function() { > }); > > /* Preselect Bootstrap tab based on location hash */ >- var hash = window.location.hash.substring(1); >- if( hash ){ >- var activeTab = $('a[href="#' + hash + '"]'); >- activeTab && activeTab.tab('show'); >- } >+ selectBsTabByHash("finesholdsissues"); > > if ( $('#clubs_panel').length ) { > $('#clubs-tab').on('click', function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index 02bc39b8f8..4c05480ece 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -591,3 +591,14 @@ function buildPatronSearchQuery(term, options) { > } > return q; > } >+ >+function selectBsTabByHash( tabs_container_id ){ >+ /* Check for location.hash in the page URL */ >+ /* If present the location hash will be used to activate the correct tab */ >+ var hash = document.location.hash; >+ if( hash !== "" ){ >+ $('#' + tabs_container_id + ' a[href="' + hash + '"]').tab('show'); >+ } else { >+ $('#' + tabs_container_id + ' a:first').tab('show'); >+ } >+} >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34115
:
152651
|
153058
|
153070
|
153213