Bugzilla – Attachment 170658 Details for
Bug 33178
Use template wrapper for authority and bibliographic subfield entry form tabs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33178: Use template wrapper for authority and bibliographic subfield entry form tabs
Bug-33178-Use-template-wrapper-for-authority-and-b.patch (text/plain), 15.73 KB, created by
Owen Leonard
on 2024-08-23 17:53:44 UTC
(
hide
)
Description:
Bug 33178: Use template wrapper for authority and bibliographic subfield entry form tabs
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2024-08-23 17:53:44 UTC
Size:
15.73 KB
patch
obsolete
>From 458176e36c5f78b5a84815887e412e64ba327f92 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 6 Jun 2024 15:10:21 +0000 >Subject: [PATCH] Bug 33178: Use template wrapper for authority and > bibliographic subfield entry form tabs > >This patch updates the authority and bibliographic subfield entry >forms to replace tab markup with the use of WRAPPERs. Some JS has been >modified in order to adapt to the changed Bootstrap tab markup. > >The patch also updates the WRAPPER code so that a unique ID can be >added to individual tabs. This is necessary as a hook for the Sortable >JavaScript. > >To test, apply the patch and go to Administration. > >- Go to MARC bibliographic frameworks -> Actions -> MARC structure. > - Click Actions -> View subfields for a tag with more than one > subfield. > - Click the "Edit" button for one of the subfields, not the first > one in the list. > - The tab for the subfield you chose should be active. > - Confirm that all the tabs look correct and work correctly. > - Try dragging one of the tabs into a new position. Save your > changes and confirm that the subfield was saved in that new > position. >- Go to Administration -> Authority types -> Actions -> MARC structure > and repeat the same steps above with the authority record subfields. > >Sponsored-By: Athens County Public Libraries >Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> >--- > .../prog/en/includes/html_helpers.inc | 6 +- > .../modules/admin/auth_subfields_structure.tt | 79 ++++++++++--------- > .../modules/admin/marc_subfields_structure.tt | 41 +++++----- > .../prog/js/marc_subfields_structure.js | 6 +- > 4 files changed, 70 insertions(+), 62 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >index 609dc3f0d0..e77c5910ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc >@@ -388,7 +388,11 @@ > [% END %] > > [% BLOCK tab_item %] >- <li class="nav-item" role="presentation"> >+ [% IF ( id ) %] >+ <li id="[% id | html %]" class="nav-item" role="presentation"> >+ [% ELSE %] >+ <li class="nav-item" role="presentation"> >+ [% END %] > [% IF ( bt_active ) %] > [% IF (linktab) %] > <a class="nav-link active" href="?tab=[% tabname | url %]" id="[% tabname | uri %]-tab"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >index 5ae1f28640..2affbe6a93 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >@@ -115,21 +115,24 @@ > [% END %] > [% END %][% END %] > >- <div id="subfieldtabs" class="toptabs numbered"> >- <ul class="nav nav-tabs" role="tablist"> >+ [% WRAPPER tabs id= "subfieldtabs" %] >+ [% WRAPPER tabs_nav %] > [% FOREACH loo IN loop %] >- <li role="presentation" id="tab_subfield_[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]"> >+ [% outputsubfield = PROCESS outputsubfield subfieldanchor = loo.tagsubfield %] >+ [% WRAPPER tab_item tabname= outputsubfield id= "tab_subfield_${outputsubfield}" %] > [% IF ( loo.new_subfield ) %] >- <a href="#sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field" aria-controls="sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field" role="tab" data-bs-toggle="tab" title="[% loo.liblibrarian | html %]">New</a> >+ <span>New</span> > [% ELSE %] >- <a href="#sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field" aria-controls="sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field" role="tab" data-bs-toggle="tab" title="[% loo.liblibrarian | html %]">[% loo.tagsubfield | html %]</a> >- [% END %] >- </li> >- [% END %] >- </ul> >- <div class="tab-content"> >+ [% loo.tagsubfield | html %] >+ [% END # IF loo.new_subfield%] >+ [% END # WRAPPER tab_item %] >+ [% END # FOREACH loo %] >+ [% END # /WRAPPER tabs_nav %] >+ >+ [% WRAPPER tab_panels %] > [% FOREACH loo IN loop %] >- <div role="tabpanel" class="tab-pane" id="sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field"> >+ [% outputsubfield = PROCESS outputsubfield subfieldanchor = loo.tagsubfield %] >+ [% WRAPPER tab_panel tabname=outputsubfield %] > <fieldset class="rows"><ol> > > [% IF ( loo.new_subfield ) %] >@@ -289,10 +292,10 @@ > </fieldset> > </li> > </ol></fieldset><br class="clear" /> >- </div> >- [% END %] >- </div> <!-- /.tab-content --> >- </div> >+ [% END # /WRAPPER tab_panel %] >+ [% END # /FOREACH loo %] >+ [% END # /WRAPPER tab_panels %] >+ [% END # /WRAPPER tabs %] > </form> > [% END %] > >@@ -415,30 +418,32 @@ > paginate: false > })); > >- [% IF ( tagsubfield && tagsubfield == "@") %] >- $("#subfieldtabs a[href='#subATfield']").tab("show"); >- [% ELSIF ( tagsubfield && tagsubfield != "@") %] >- $("#subfieldtabs a[href='#sub[% tagsubfield | html %]field']").tab("show"); >- [% ELSE %] >- $("#subfieldtabs a:first").tab("show"); >- [% END %] >+ if( $("#subfieldtabs").length > 0 ){ >+ [% IF ( tagsubfield && tagsubfield == "@") %] >+ $("#subfieldtabs a[href='#AT_panel']").tab("show"); >+ [% ELSIF ( tagsubfield && tagsubfield != "@") %] >+ $("#subfieldtabs a[href='#[% tagsubfield | html %]_panel']").tab("show"); >+ [% ELSE %] >+ $("#subfieldtabs a:first").tab("show"); >+ [% END %] > >- var subfields_list = $("#subfieldtabs > ul"); >- var sortable_subfields = new Sortable( subfields_list[0], { >- onEnd: function( e ){ >- var old_index = e.oldIndex; >- var new_index = e.newIndex; >- if (old_index < new_index) new_index++; >- var subfield_code = e.item.id.replace( /^tab_subfield_/, ''); >- var content = $('#sub' + subfield_code + 'field'); >- var panels = $("#subfieldtabs .tab-pane"); >- if ( new_index < $(panels).size() ){ >- $(content).insertBefore( panels[new_index]); >- } else { >- $(content).insertAfter( panels[new_index-1]); >+ var subfields_list = $("#subfieldtabs > ul"); >+ var sortable_subfields = new Sortable( subfields_list[0], { >+ onEnd: function( e ){ >+ var old_index = e.oldIndex; >+ var new_index = e.newIndex; >+ if (old_index < new_index) new_index++; >+ var subfield_code = e.item.id.replace( /^tab_subfield_/, ''); >+ var content = $( '#' + subfield_code + '_panel'); >+ var panels = $("#subfieldtabs .tab-pane"); >+ if ( new_index < $(panels).size() ){ >+ $(content).insertBefore( panels[new_index]); >+ } else { >+ $(content).insertAfter( panels[new_index-1]); >+ } > } >- } >- }); >+ }); >+ } > > }); > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >index d5ef541220..8fa50e2f9b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >@@ -110,27 +110,26 @@ > [% END %] > [% END %][% END %] > >- <div id="subfieldtabs" class="toptabs numbered"> >- <ul class="nav nav-tabs" role="tablist"> >+ [% WRAPPER tabs id= "subfieldtabs" %] >+ [% WRAPPER tabs_nav %] > [% FOREACH loo IN loop %] >- <li id="tab_subfield_[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]" class="tab-item" role="presentation"> >+ [% outputsubfield = PROCESS outputsubfield subfieldanchor = loo.subfieldcode %] >+ [% WRAPPER tab_item tabname= outputsubfield id= "tab_subfield_${outputsubfield}" %] > [% IF ( loo.new_subfield ) %] >- <a href="#sub[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]field" aria-controls="sub[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]field" role="tab" data-bs-toggle="tab" title="[% loo.liblibrarian | html_entity %]">New</a> >+ <span>New</span> > [% ELSE %] >- <a href="#sub[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]field" aria-controls="sub[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]field" role="tab" data-bs-toggle="tab" title="[% loo.liblibrarian | html_entity %]"> >- [% loo.subfieldcode | html %] >- </a> >- [% END %] >- </li> >- [% END %] >- </ul> >- >- <div class="tab-content"> >+ [% loo.subfieldcode | html %] >+ [% END # IF loo.new_subfield%] >+ [% END # WRAPPER tab_item %] >+ [% END # FOREACH loo %] >+ [% END # /WRAPPER tabs_nav %] > >+ [% WRAPPER tab_panels %] > [% FOREACH loo IN loop %] >- <div class="constraints tab-pane" role="tabpanel" id="sub[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]field"> >+ [% outputsubfield = PROCESS outputsubfield subfieldanchor = loo.subfieldcode %] >+ [% WRAPPER tab_panel tabname=outputsubfield %] > <input type="hidden" name="tab_id" value="[% loo.row | html %]" /> >- <div id="basic[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]" class="contraints"> >+ <div id="basic[%- outputsubfield | html -%]" class="contraints"> > <fieldset class="rows"> > <legend>Basic constraints</legend> > <ol> >@@ -204,7 +203,7 @@ > </fieldset> <!-- /.rows --> > </div> <!-- /#basic[%- PROCESS outputsubfield subfieldanchor = subfieldcode -%] --> > >- <div id="advanced[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]" class="contraints"> >+ <div id="advanced[%- outputsubfield | html -%]" class="contraints"> > <fieldset class="rows"> > <legend>Advanced constraints</legend> > <ol> >@@ -260,7 +259,7 @@ > </fieldset> <!-- /.rows --> > </div> <!-- /#advanced[%- PROCESS outputsubfield subfieldanchor = subfieldcode -%] --> > >- <div id="oth[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%]" class="constraints"> >+ <div id="oth[%- outputsubfield | html -%]" class="constraints"> > <fieldset class="rows"> > <legend>Other options (choose one)</legend> > <ol> >@@ -303,11 +302,11 @@ > </li> > </ol> > </fieldset> <!-- /.rows --> >- </div> <!-- /#oth[%- PROCESS outputsubfield subfieldanchor = loo.subfieldcode -%] --> >- </div><!-- /constraints --> >+ </div> <!-- /#oth_outputsubfield --> >+ [% END # /WRAPPER tab_panel %] > [% END # /FOREACH loo %] >- </div> <!-- /.tab-content --> >- </div><!-- /subfieldtabs --> >+ [% END # /WRAPPER tab_panels %] >+ [% END # /WRAPPER tabs %] > > <fieldset class="action"> > <input type="submit" class="btn btn-primary" value="Save changes" /> <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=[% tagfield | uri %]&frameworkcode=[% frameworkcode | uri %]" class="cancel">Cancel</a> >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 19b5ff51a3..fb164b4c11 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >@@ -1,9 +1,9 @@ > /* global dataTablesDefaults tagsubfield selectBsTabByHash */ > $(document).ready(function() { > if( tagsubfield && tagsubfield == "@"){ >- $("#subfieldtabs a[href='#subATfield']").tab("show"); >+ $("#subfieldtabs a[href='#AT_panel']").tab("show"); > } else if ( tagsubfield && tagsubfield != "@"){ >- $("#subfieldtabs a[href='#sub" + tagsubfield + "field'").tab("show"); >+ $("#subfieldtabs a[href='#" + tagsubfield + "_panel'").tab("show"); > } else { > $("#subfieldtabs a:first").tab("show"); > } >@@ -15,7 +15,7 @@ $(document).ready(function() { > var new_index = e.newIndex; > if (old_index < new_index) new_index++; > var subfield_code = e.item.id.replace( /^tab_subfield_/, ''); >- var content = $('#sub' + subfield_code + 'field'); >+ var content = $( '#' + subfield_code + '_panel'); > var panels = $("#subfieldtabs .tab-pane"); > if ( new_index < $(panels).size() ){ > $(content).insertBefore( panels[new_index]); >-- >2.39.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 33178
:
167552
|
167576
|
170658
|
171021
|
173540
|
173541