From b212d2c0b47714929b3fac18f4f088434aaf67eb Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 1 Feb 2022 19:36:22 +0000 Subject: [PATCH] Bug 29999: Replace the use of jQueryUI tabs on authorized values administration page This patch updates the authorized values edit interface so that it uses Bootstrap tabs instead of jQueryUI tabs for displaying icon sets. Normally Bootstrap tabs don't have to be initiated via JavaScript, but this page requires some JS to select the first tab as active if no other tabs are active. Because of the way the template works it's not simple to do it via template logic, so in this case some JS helps. 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). - Go to Administration -> Authorized values in the staff interface. - Select a category and then add or edit an authorized value in that category. - On the edit page you should see tabs under "Choose an icon." - Confirm that the tabs look correct and work correctly. - If you did not previously have any icon selected, the "None" tab should be active. - If you had an icon selected, that icon set's tab should be active. - Confirm that changing icons works correctly and that the selected icon's tab is always active when you return to the edit page. Signed-off-by: Lucas Gass --- .../prog/css/src/staff-global.scss | 6 + .../en/modules/admin/authorised_values.tt | 122 ++++++++++++------ 2 files changed, 85 insertions(+), 43 deletions(-) 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 75510ad470..94dfdcf964 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -1007,6 +1007,11 @@ fieldset { padding-bottom: 0; } } + + .toptabs { + clear: both; + margin: 1em; + } } } @@ -3572,6 +3577,7 @@ code { } .tab-content { + background-color: #FFF; border: 1px solid #B9D8D9; border-top-width: 0; padding: 1em; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index d8215c817b..377e29e942 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -12,14 +12,29 @@ Authorized values › Administration › Koha [% INCLUDE 'doc-head-close.inc' %] - - +[% FILTER collapse %] + +[% END %] @@ -138,40 +153,58 @@ Authorized values › Administration › Koha -
-
Choose an icon:
- -
    -
  • -
-
- [% FOREACH imageset IN imagesets %] -
    - [% FOREACH image IN imageset.images %] -
  • - -
  • - [% END %]
-
-
- [% END %] -
+
+
Choose an icon:
+ + +
+
+
+ +
+
+ [% FOREACH imageset IN imagesets %] + [% IF ( imageset.imagesetactive ) %] +
+ [% ELSE %] +
+ [% END %] +
+ [% FOREACH image IN imageset.images %] + + [% END %] +
+
+ [% END %] +
+
[% END %]
@@ -366,7 +399,6 @@ Authorized values › Administration › Koha if ( $("#branches option:selected").length < 1 ) { $("#branches option:first").attr("selected", "selected"); } - $('#icons').tabs(); $("a.delete").click(function(){ return confirm(_("Are you sure you want to delete this authorized value?")); @@ -379,6 +411,10 @@ Authorized values › Administration › Koha $("#delete_category").on('submit', function(){ return confirm(_("Are you sure you want to delete this authorized value category?")); }); + + if( $(".tab-pane.active").length < 1 ){ + $("#icons a:first").tab("show"); + } }); [% END %] -- 2.20.1