From 36c410c2fb755be2fdba477bd9cb351904f57292 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 18 Mar 2022 14:37:54 +0000 Subject: [PATCH] Bug 30000: Replace the use of jQueryUI tabs on the search engine configuration page This patch replaces jQueryUI tabs on the search engine configuration page, replacing them with Bootstrap tabs. To test, apply the patch and go to Administration -> Search engine configuration. - The "Search fields" tab should be selected by default, and the table should be initialized as a DataTable with sorting and filtering. - When you switch to the "Bibliographic records" and "Authorities" tabs the tables on those tabs should also be initialized, each with filtering and drag-and-drop row re-ordering. - All tables should continue to work correctly after switching back and forth between tabs. Signed-off-by: Lucas Gass --- .../searchengine/elasticsearch/mappings.tt | 660 +++++++++--------- .../prog/js/elasticsearch-mappings.js | 9 +- 2 files changed, 339 insertions(+), 330 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt index 3f17b20e32..ca6792c3bf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt @@ -115,353 +115,363 @@ a.add, a.delete {
-
-
    -
  • Search fields
  • +
    + -
    - - - - - - - - - - - - - - - - - - [% FOREACH search_field IN all_search_fields %] - - - - - - - - - - [% END %] - -
    NameAliasesLabelTypeWeightSearchable
     Staff interfaceOPAC
    - [% IF search_field.mandatory %] - - [% ELSE %] - - [% END %] - - [% search_field.aliases.join(', ') | html %] - - [% IF search_field.mandatory %] - - [% ELSE %] - - [% END %] - - [% IF search_field.mandatory %] - - - [% END %] - - [% IF search_field.type == "string" %] - - [% ELSE %] - - [% END %] - [% IF search_field.type == "date" %] - - [% ELSE %] - - [% END %] - [% IF search_field.type == "year" %] - - [% ELSE %] - - [% END %] - [% IF search_field.type == "number" %] - - [% ELSE %] - - [% END %] - [% IF search_field.type == "boolean" %] - - [% ELSE %] - - [% END %] - [% IF search_field.type == "sum" %] - - [% ELSE %] - - [% END %] - [% IF search_field.type == "isbn" %] - - [% ELSE %] - - [% END %] - [% IF search_field.type == "stdno" %] - - [% ELSE %] - - [% END %] - - - [% IF search_field.mapped_biblios %] - - [% ELSE %] - - [% END %] - - - - -
    -
    - [% FOREACH index IN indexes %] -
    - - - - - - - - - - +
    +
    +
    Search fieldSortableFacetableSuggestibleSearchableMapping 
    + + + + + + + + - - - [% FOREACH mapping IN index.mappings %] - [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %] - - - - - - - - - - [% ELSE %] - - + + + + + + + [% FOREACH search_field IN all_search_fields %] + + + + + + - + + + [% END %] + +
    NameAliasesLabelTypeWeightSearchable
    - - - [% mapping.search_field_label | html %] - - [% IF mapping.sort == 0 %] - No - [% ELSE %] - Yes - [% END %] - - [% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %] - - [% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %] - - [% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %] - - -  
    - - - [% mapping.search_field_label | html %] +
     Staff interfaceOPAC
    + [% IF search_field.mandatory %] + + [% ELSE %] + + [% END %] + + [% search_field.aliases.join(', ') | html %] + + [% IF search_field.mandatory %] + + [% ELSE %] + + [% END %] + + [% IF search_field.mandatory %] + + + [% END %] + + [% IF search_field.type == "string" %] + + [% ELSE %] + + [% END %] + [% IF search_field.type == "date" %] + + [% ELSE %] + + [% END %] + [% IF search_field.type == "year" %] + + [% ELSE %] + + [% END %] + [% IF search_field.type == "number" %] + + [% ELSE %] + + [% END %] + [% IF search_field.type == "boolean" %] + + [% ELSE %] + + [% END %] + [% IF search_field.type == "sum" %] + + [% ELSE %] + + [% END %] + [% IF search_field.type == "isbn" %] + + [% ELSE %] + + [% END %] + [% IF search_field.type == "stdno" %] + + [% ELSE %] + + [% END %] + + + [% IF search_field.mapped_biblios %] + + [% ELSE %] + + [% END %] - + + + +
    +
    + [% FOREACH index IN indexes %] +
    + + + + + + + + + + + + + + [% FOREACH mapping IN index.mappings %] + [% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %] + + + - + + + + + + + [% ELSE %] + + + - + - + + + + [% IF mapping.search_field_mandatory %] + [% ELSE %] - - + [% END %] - - - - [% IF mapping.search_field_mandatory %] - - [% ELSE %] - + [% END %] - [% END %] - [% END %] - - - - - - - - - - - - -
    Search fieldSortableFacetableSuggestibleSearchableMapping 
    + + + [% mapping.search_field_label | html %] + [% IF mapping.sort == 0 %] - - + No [% ELSE %] - - + Yes [% END %] - - - [% IF mapping.is_facetable %] - + [% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %] + + [% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %] + + [% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %] + + +  
    + + + [% mapping.search_field_label | html %] + + - [% ELSE %] - - No - [% END %] - - + [% IF mapping.is_facetable %] + [% ELSE %] - - + + No [% END %] - - - + + + + + + Delete Delete - - Delete Delete
    - - - - - - - - - - - Add
    + + + + + + + + + + + + + + + + + + + + + Add + + + - [% IF index.index_name == 'biblios' %] -

    Facet order

    -
    - - - - - - - - - - [% FOREACH f IN facetable_fields %] + [% IF index.index_name == 'biblios' %] +

    Facet order

    +
    +
    Search fieldLabelDisplay
    + - - - + + + - [% END %] - -
    - [% f.name | html %] - - [% SWITCH f.name %] - [% CASE 'author' %]Authors - [% CASE 'itype' %]Item types - [% CASE 'location' %]Locations - [% CASE 'su-geo' %]Places - [% CASE 'title-series' %]Series - [% CASE 'subject' %]Topics - [% CASE 'ccode' %]Collections - [% CASE 'holdingbranch' %]Holding libraries - [% CASE 'homebranch' %]Home libraries - [% CASE 'ln' %]Language - [% CASE %][% f | html %] - [% END %] - - [% IF f.facet_order %] - - [% ELSE %] - - [% END %] - Search fieldLabelDisplay
    -
    - [% END %] -
    - [% END %] -
    + + + [% FOREACH f IN facetable_fields %] + + + [% f.name | html %] + + + [% SWITCH f.name %] + [% CASE 'author' %]Authors + [% CASE 'itype' %]Item types + [% CASE 'location' %]Locations + [% CASE 'su-geo' %]Places + [% CASE 'title-series' %]Series + [% CASE 'subject' %]Topics + [% CASE 'ccode' %]Collections + [% CASE 'holdingbranch' %]Holding libraries + [% CASE 'homebranch' %]Home libraries + [% CASE 'ln' %]Language + [% CASE %][% f | html %] + [% END %] + + + [% IF f.facet_order %] + + [% ELSE %] + + [% END %] + + + [% END %] + + +
+ [% END %] + + [% END %] + +
diff --git a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js index 4b36850c4a..feef514cd5 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js +++ b/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js @@ -21,7 +21,6 @@ function clone_line(line) { } function tableInit( oldtabid, newtabid ) { - if ( oldtabid ){ var oldTableId = $("#" + oldtabid + "_table"); oldTableId.DataTable().destroy(); @@ -42,10 +41,10 @@ $(document).ready(function () { tableInit( "", "search_fields"); - $("#tabs").tabs({ - activate: function( event, ui ){ - tableInit( ui.oldPanel.attr('id'), ui.newPanel.attr('id') ); - }, + $("a[data-toggle='tab']").on("shown.bs.tab", function (e) { + var oldtabid = $(e.relatedTarget).data("tab"); + var newtabid = $(e.target).data("tab"); + tableInit( oldtabid, newtabid ); }); $('.delete').click(function () { -- 2.20.1