From 17f0e9cff81b8b921d364231cffe8d744a2bdfe7 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 Signed-off-by: Fridolin Somers --- .../prog/css/src/staff-global.scss | 6 + .../en/modules/admin/authorised_values.tt | 131 ++++++++++-------- 2 files changed, 83 insertions(+), 54 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 fbf5200bfe..7f6375e895 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -1014,6 +1014,11 @@ fieldset { padding-bottom: 0; } } + + .toptabs { + clear: both; + margin: 1em; + } } } @@ -3591,6 +3596,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 3bcd576083..12336be243 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,13 +12,29 @@ [% INCLUDE 'doc-head-close.inc' %] - +[% FILTER collapse %] + +[% END %] @@ -146,35 +162,46 @@ -
-
Choose an icon:
-
    -
  • None
  • +
    +
    Choose an icon:
    + -
    -
      -
    • - -
    • -
    -
    -
    - - [% FOREACH imageset IN imagesets %] -
    -
      - [% FOREACH image IN imageset.images %] -
    • +
      +
      +
      + +
      +
      + + [% FOREACH imageset IN imagesets %] + [% IF ( imageset.imagesetactive ) %] +
      + [% ELSE %] +
      + [% END %] +
      + [% FOREACH image IN imageset.images %] -
    • - [% END # /FOREACH image %] -
    -
    -
    - [% END # /FOREACH imageset %] - -
    -
      -
    • - - [% IF av.imageurl.match('^http') %] - - - - [% ELSE %] - - - [% END %] -
    • -
    -
    -
    - + [% END # /FOREACH image %] +
    +
+ [% END # /FOREACH imageset %] + +
+ + [% IF av.imageurl.match('^http') %] + + + + [% ELSE %] + + + [% END %] +
+ [% END # /IF action_add_category %] @@ -415,7 +435,6 @@ 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?")); @@ -428,6 +447,10 @@ $("#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.35.1