@@ -, +, @@ configuration - Apply the patch and go to Administration -> Search engine configuration (Elasticsearch) - Test the tables under each tab, "Search fields," "Bibliographic records," and "Authorities," the table has a search filter and the header row "sticks" to the top of the browser window as you scroll down. - The "Search fields" table should be sortable, but the other two should not--they have drag-and-drop row reordering. --- .../admin/searchengine/elasticsearch/mappings.tt | 41 +++++++++++----------- .../prog/js/elasticsearch-mappings.js | 27 +++++++++++++- 2 files changed, 47 insertions(+), 21 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt @@ -108,27 +108,26 @@ a.add, a.delete { [% END %]
- +
- + - - - - + + + [% FOREACH search_field IN all_search_fields %] - - - + - [% END %] @@ -231,7 +230,7 @@ a.add, a.delete { [% FOREACH index IN indexes %]
-
Name Aliases Label TypeSearchable WeightSearchable
 Staff interfaceOPAC  Staff interfaceOPAC
+ [% IF search_field.mandatory %] [% ELSE %] @@ -138,14 +137,14 @@ a.add, a.delete { [% search_field.aliases.join(', ') | html %] + [% IF search_field.mandatory %] [% ELSE %] [% END %] + [% IF search_field.mandatory %] + [% IF search_field.mapped_biblios %] + + [% ELSE %] + + [% END %] + - [% IF search_field.mapped_biblios %] - - [% ELSE %] - - [% END %] -
+
@@ -240,7 +239,7 @@ a.add, a.delete { - + @@ -267,6 +266,7 @@ a.add, a.delete { + [% ELSE %] @@ -448,10 +448,10 @@ a.add, a.delete { [% END %] -

+

-

+
@@ -465,6 +465,7 @@ a.add, a.delete { [% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %] [% Asset.js("js/elasticsearch-mappings.js") | $raw %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js +++ a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js @@ -20,8 +20,32 @@ function clone_line(line) { return new_line; } +function tableInit( oldtabid, newtabid ) { + + var oldTableId = $("#" + oldtabid + "_table"); + var newTableId = $("#" + newtabid + "_table"); + + oldTableId.DataTable().destroy(); + newTableId.DataTable( + $.extend(true, {}, dataTablesDefaults, { + "columnDefs": [ + { "orderable": false, "searchable": false, 'targets': ['NoSort'] }, + ], + "paging": false, + "autoWidth": false + })); +} + $(document).ready(function () { - $("#tabs").tabs(); + + tableInit( "", "search_fields"); + + $("#tabs").tabs({ + activate: function( event, ui ){ + tableInit( ui.oldPanel.attr('id'), ui.newPanel.attr('id') ); + }, + }); + $('.delete').click(function () { if ($(this).hasClass('mandatory') && $(".mandatory[data-field_name=" + $(this).attr('data-field_name') + "]").length < 2) { alert( __("This field is mandatory and must have at least one mapping") ); @@ -34,6 +58,7 @@ $(document).ready(function () { $("table.mappings").tableDnD({ onDragClass: "dragClass", }); + $('.add').click(function () { var table = $(this).closest('table'); var index_name = $(table).attr('data-index_name'); --
Search fieldSuggestible Searchable Mapping