Lines 1-74
Link Here
|
1 |
[% USE raw %] |
1 |
[% USE raw %] |
2 |
[% USE Asset %] |
2 |
[% USE Asset %] |
|
|
3 |
[% SET footerjs = 1 %] |
3 |
[% PROCESS 'i18n.inc' %] |
4 |
[% PROCESS 'i18n.inc' %] |
4 |
[% INCLUDE 'doc-head-open.inc' %] |
5 |
[% INCLUDE 'doc-head-open.inc' %] |
5 |
<title>Koha › Administration › Search engine configuration (Elasticsearch)</title> |
6 |
<title>Koha › Administration › Search engine configuration (Elasticsearch)</title> |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
[% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %] |
|
|
8 |
<script> |
9 |
function clean_line( line ) { |
10 |
$(line).find('input[type="text"]').val(""); |
11 |
$(line).find('select').find('option:first').attr("selected", "selected"); |
12 |
} |
13 |
|
14 |
function clone_line( line ) { |
15 |
var new_line = $(line).clone(); |
16 |
$(new_line).removeClass("nodrag nodrop"); |
17 |
$(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html(_("Delete")); |
18 |
$(new_line).find('[data-id]').each( function() { |
19 |
$(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id'); |
20 |
} ); |
21 |
$(new_line).find("select").each( function() { |
22 |
var attr = $(this).attr('name'); |
23 |
var val = $(line).find('[data-id="' + attr + '"]').val(); |
24 |
$(this).find('option[value="' + val + '"]').attr("selected", "selected"); |
25 |
} ); |
26 |
return new_line; |
27 |
} |
28 |
|
29 |
$(document).ready(function() { |
30 |
$("#tabs").tabs(); |
31 |
$('.delete').click(function() { |
32 |
if( $(this).hasClass('mandatory') && $(".mandatory[data-field_name="+$(this).attr('data-field_name')+"]").length < 2 ){ |
33 |
alert("This field is mandatory and must have at least one mapping"); |
34 |
return; |
35 |
} else { |
36 |
$(this).parents('tr').remove(); |
37 |
} |
38 |
}); |
39 |
|
40 |
$("table.mappings").tableDnD( { |
41 |
onDragClass: "dragClass", |
42 |
} ); |
43 |
$('.add').click(function() { |
44 |
var table = $(this).closest('table'); |
45 |
var index_name = $(table).attr('data-index_name'); |
46 |
var line = $(this).closest("tr"); |
47 |
var marc_field = $(line).find('input[data-id="mapping_marc_field"]').val(); |
48 |
if ( marc_field.length > 0 ) { |
49 |
var new_line = clone_line( line ); |
50 |
new_line.appendTo($('table[data-index_name="'+index_name+'"]>tbody')); |
51 |
$('.delete').click(function() { |
52 |
$(this).parents('tr').remove(); |
53 |
}); |
54 |
clean_line(line); |
55 |
|
56 |
$(table).tableDnD( { |
57 |
onDragClass: "dragClass", |
58 |
} ); |
59 |
} |
60 |
}); |
61 |
$("#facet_biblios > table").tableDnD( { |
62 |
onDragClass: "dragClass", |
63 |
} ); |
64 |
}); |
65 |
</script> |
66 |
<style> |
8 |
<style> |
67 |
a.add, a.delete { |
9 |
a.add, a.delete { |
68 |
cursor: pointer; |
10 |
cursor: pointer; |
69 |
} |
11 |
} |
70 |
</style> |
12 |
</style> |
71 |
</head> |
13 |
</head> |
|
|
14 |
|
72 |
<body id="admin_searchengine_mappings" class="admin"> |
15 |
<body id="admin_searchengine_mappings" class="admin"> |
73 |
[% INCLUDE 'header.inc' %] |
16 |
[% INCLUDE 'header.inc' %] |
74 |
[% INCLUDE 'prefs-admin-search.inc' %] |
17 |
[% INCLUDE 'prefs-admin-search.inc' %] |
Lines 517-520
a.add, a.delete {
Link Here
|
517 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
460 |
</div> <!-- /.col-sm-2.col-sm-pull-10 --> |
518 |
</div> <!-- /.row --> |
461 |
</div> <!-- /.row --> |
519 |
|
462 |
|
|
|
463 |
[% MACRO jsinclude BLOCK %] |
464 |
[% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %] |
465 |
[% Asset.js("js/elasticsearch-mappings.js") | $raw %] |
466 |
[% END %] |
467 |
|
520 |
[% INCLUDE 'intranet-bottom.inc' %] |
468 |
[% INCLUDE 'intranet-bottom.inc' %] |