Lines 13-20
Link Here
|
13 |
|
13 |
|
14 |
function clone_line( line ) { |
14 |
function clone_line( line ) { |
15 |
var new_line = $(line).clone(); |
15 |
var new_line = $(line).clone(); |
|
|
16 |
let my_index_name = $(new_line).find('td:first-child > input:first-child').val(); |
16 |
$(new_line).removeClass("nodrag nodrop"); |
17 |
$(new_line).removeClass("nodrag nodrop"); |
17 |
$(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html(_("Delete")); |
18 |
|
|
|
19 |
//add class for the research |
20 |
$(new_line).find('td:first-child > select').addClass("field_name_research_" + my_index_name); |
21 |
$(new_line).find('td:nth-child(2)> select').addClass("sort_research_" + my_index_name); |
22 |
$(new_line).find('td:nth-child(3)> select').addClass("facet_research_select_" + my_index_name); |
23 |
$(new_line).find('td:nth-child(4)> select').addClass("suggestible_research_" + my_index_name); |
24 |
$(new_line).find('td:nth-child(5)> input').addClass("mapping_research_" + my_index_name); |
25 |
|
26 |
$(new_line).find('td:last-child>a').removeClass("add").addClass("delete").html('<i class="fa fa-trash"></i> Delete'); |
18 |
$(new_line).find('[data-id]').each( function() { |
27 |
$(new_line).find('[data-id]').each( function() { |
19 |
$(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id'); |
28 |
$(this).attr({ name: $(this).attr('data-id') }).removeAttr('data-id'); |
20 |
} ); |
29 |
} ); |
Lines 26-31
Link Here
|
26 |
return new_line; |
35 |
return new_line; |
27 |
} |
36 |
} |
28 |
|
37 |
|
|
|
38 |
function search_input(imput_search_val, input_class) { |
39 |
if (imput_search_val != ""){ |
40 |
$('input.' + input_class ).each ( function () { |
41 |
//if the search correspond with the begining of a input value |
42 |
if (($(this).val().toLowerCase().indexOf(imput_search_val.toLowerCase()) == -1) |
43 |
&& ($(this).val().toLowerCase().indexOf(imput_search_val.replace(',','.').toLowerCase()) == -1)){ |
44 |
$(this).parents('tr').hide(); |
45 |
} |
46 |
}); |
47 |
} |
48 |
} |
49 |
|
50 |
function search_select(select_search_val, select_class){ |
51 |
if (select_search_val != "All"){ |
52 |
$('select.' + select_class +' option:selected').each( function () { |
53 |
if ($(this).val() != select_search_val){ |
54 |
$(this).parents('tr').hide(); |
55 |
} |
56 |
}); |
57 |
} |
58 |
} |
59 |
|
29 |
$(document).ready(function() { |
60 |
$(document).ready(function() { |
30 |
$("#tabs").tabs(); |
61 |
$("#tabs").tabs(); |
31 |
$('.delete').click(function() { |
62 |
$('.delete').click(function() { |
Lines 38-48
Link Here
|
38 |
$('.add').click(function() { |
69 |
$('.add').click(function() { |
39 |
var table = $(this).closest('table'); |
70 |
var table = $(this).closest('table'); |
40 |
var index_name = $(table).attr('data-index_name'); |
71 |
var index_name = $(table).attr('data-index_name'); |
|
|
72 |
|
73 |
//remove the no matches tr from if the search give no results search |
74 |
$(".delete_tr_" + index_name).remove(); |
41 |
var line = $(this).closest("tr"); |
75 |
var line = $(this).closest("tr"); |
42 |
var marc_field = $(line).find('input[data-id="mapping_marc_field"]').val(); |
76 |
var marc_field = $(line).find('input[data-id="mapping_marc_field"]').val(); |
43 |
if ( marc_field.length > 0 ) { |
77 |
if ( marc_field.length > 0 ) { |
44 |
var new_line = clone_line( line ); |
78 |
var new_line = clone_line( line ); |
45 |
new_line.appendTo($('table[data-index_name="'+index_name+'"]>tbody')); |
79 |
new_line.appendTo($('table[data-index_name="'+ index_name+ '"]>.' + index_name + '_table')); |
46 |
$('.delete').click(function() { |
80 |
$('.delete').click(function() { |
47 |
$(this).parents('tr').remove(); |
81 |
$(this).parents('tr').remove(); |
48 |
}); |
82 |
}); |
Lines 56-64
Link Here
|
56 |
$("#facet_biblios > table").tableDnD( { |
90 |
$("#facet_biblios > table").tableDnD( { |
57 |
onDragClass: "dragClass", |
91 |
onDragClass: "dragClass", |
58 |
} ); |
92 |
} ); |
|
|
93 |
|
94 |
|
95 |
//SEARCH FOR SEARCH FIELDS TABLE |
96 |
|
97 |
let search_field_table = $(".search_field_table"); |
98 |
search_field_table.each( function () { |
99 |
$(this).children().attr("style","display: table-row"); |
100 |
}); |
101 |
|
102 |
let searching_fields_name = $("#searching_fields_name"); |
103 |
let searching_fields_label = $("#searching_fields_label"); |
104 |
let searching_fields_type = $("#searching_fields_type"); |
105 |
let searching_fields_weight = $("#searching_fields_weight"); |
106 |
|
107 |
function search_fields (){ |
108 |
|
109 |
$(".delete_tr").remove(); |
110 |
search_field_table.each( function () { |
111 |
$(this).children().show(); |
112 |
}); |
113 |
|
114 |
search_input(searching_fields_name.val(),"field_name_research"); |
115 |
search_input(searching_fields_label.val(),"field_label_research"); |
116 |
search_select(searching_fields_type.val(),"field_type_research"); |
117 |
search_input(searching_fields_weight.val(),"field_weight_research"); |
118 |
|
119 |
let find = false; |
120 |
let tr_search_field_table = $(".search_field_table > tr"); |
121 |
tr_search_field_table.each(function(){ |
122 |
if ($(this).css("display") == "table-row"){ |
123 |
find = true; |
124 |
} |
125 |
}); |
126 |
if (find == false){ |
127 |
search_field_table.append('<tr class="delete_tr"><td colspan="4" id="no_matches" ><h3><b>no matches</b></h3></td></tr>'); |
128 |
} |
129 |
} |
130 |
|
131 |
searching_fields_name.on("click paste keyup", search_fields); |
132 |
searching_fields_label.on("click paste keyup", search_fields); |
133 |
searching_fields_type.change(search_fields); |
134 |
searching_fields_weight.on("click paste keyup", search_fields); |
135 |
|
136 |
//SEARCH FOR BIBLIOS AND AUTHORITIES TABLE |
137 |
|
138 |
[% FOREACH index IN indexes %] |
139 |
|
140 |
let [% index.index_name | html %]_table = $(".[% index.index_name | html %]_table"); |
141 |
[% index.index_name | html %]_table.each( function () { |
142 |
$(this).children().attr("style","display: table-row"); |
143 |
}); |
144 |
|
145 |
let searching_fields_[% index.index_name | html %] = $("#searching_fields_[% index.index_name | html %]"); |
146 |
let searching_sortable_[% index.index_name | html %] = $("#searching_sortable_[% index.index_name | html %]"); |
147 |
let searching_facetable_[% index.index_name | html %] = $("#searching_facetable_[% index.index_name | html %]"); |
148 |
let searching_suggestible_[% index.index_name | html %] = $("#searching_suggestible_[% index.index_name | html %]"); |
149 |
let searching_mappings_[% index.index_name | html %] = $("#searching_mappings_[% index.index_name | html %]"); |
150 |
|
151 |
function search_[% index.index_name | html %] (){ |
152 |
|
153 |
//remove the no matches tr from the previous search |
154 |
$(".delete_tr_[% index.index_name | html %]").remove(); |
155 |
|
156 |
[% index.index_name | html %]_table.each( function () { |
157 |
$(this).children().show(); |
158 |
}); |
159 |
|
160 |
search_input(searching_fields_[% index.index_name | html %].val(),"field_name_research_[% index.index_name | html %]"); |
161 |
search_select(searching_sortable_[% index.index_name | html %].val(),"sort_research_[% index.index_name | html %]"); |
162 |
search_select(searching_suggestible_[% index.index_name | html %].val(),"suggestible_research_[% index.index_name | html %]"); |
163 |
search_input(searching_mappings_[% index.index_name | html %].val(),"mapping_research_[% index.index_name | html %]"); |
164 |
|
165 |
if (searching_fields_[% index.index_name | html %].val() != ""){ |
166 |
$('select.field_name_research_[% index.index_name | html %] option:selected').each( function () { |
167 |
if ($(this).val().toLowerCase().indexOf(searching_fields_[% index.index_name | html %].val().toLowerCase()) == -1 ){ |
168 |
$(this).parents('tr').hide(); |
169 |
} |
170 |
}); |
171 |
} |
172 |
|
173 |
if (searching_facetable_[% index.index_name | html %].val() != "All"){ |
174 |
$('select.facet_research_select_[% index.index_name | html %] option:selected').each( function () { |
175 |
if ($(this).val() != searching_facetable_[% index.index_name | html %].val()){ |
176 |
$(this).parents('tr').hide(); |
177 |
} |
178 |
}); |
179 |
$('input.facet_research_input_[% index.index_name | html %]').each( function () { |
180 |
if ($(this).val() != searching_facetable_[% index.index_name | html %].val()){ |
181 |
$(this).parents('tr').hide(); |
182 |
} |
183 |
}); |
184 |
} |
185 |
|
186 |
let find = false; |
187 |
let tr_[% index.index_name | html %]_table = $(".[% index.index_name | html %]_table > tr"); |
188 |
tr_[% index.index_name | html %]_table.each(function(){ |
189 |
if ($(this).css("display") == "table-row"){ |
190 |
find = true; |
191 |
} |
192 |
}); |
193 |
if (find == false){ |
194 |
[% index.index_name | html %]_table.append('<tr class="delete_tr_[% index.index_name | html %]"><td colspan="6" id="no_matches" ><h3><b>no matches</b></h3></td></tr>'); |
195 |
} |
196 |
} |
197 |
|
198 |
searching_fields_[% index.index_name | html %].on("paste keyup", search_[% index.index_name | html %]); |
199 |
searching_sortable_[% index.index_name | html %].change(search_[% index.index_name | html %]); |
200 |
searching_facetable_[% index.index_name | html %].change(search_[% index.index_name | html %]); |
201 |
searching_suggestible_[% index.index_name | html %].change(search_[% index.index_name | html %]); |
202 |
searching_mappings_[% index.index_name | html %].on("click paste keyup", search_[% index.index_name | html %]); |
203 |
|
204 |
$('.reset_search_[% index.index_name | html %]').click(function() { |
205 |
searching_fields_[% index.index_name | html %].val(""); |
206 |
searching_sortable_[% index.index_name | html %].val("All"); |
207 |
searching_facetable_[% index.index_name | html %].val("All"); |
208 |
searching_suggestible_[% index.index_name | html %].val("All"); |
209 |
searching_mappings_[% index.index_name | html %].val(""); |
210 |
search_[% index.index_name | html %](); |
211 |
}); |
212 |
[% END %] |
59 |
}); |
213 |
}); |
60 |
</script> |
214 |
</script> |
61 |
<style> |
215 |
<style> |
|
|
216 |
|
217 |
#no_matches { |
218 |
color : red; |
219 |
text-align : center; |
220 |
} |
221 |
|
222 |
.btn-search |
223 |
{ |
224 |
width : 100%; |
225 |
margin-right:-20px; |
226 |
} |
227 |
|
228 |
.delete, .add, .width_full, .input_search |
229 |
{ |
230 |
width : 100%; |
231 |
} |
232 |
|
233 |
.input_search |
234 |
{ |
235 |
padding-bottom: 10px; |
236 |
} |
237 |
|
238 |
#searching_fields_weight |
239 |
{ |
240 |
margin-right:-100px; |
241 |
width : 100%; |
242 |
} |
62 |
a.add, a.delete { |
243 |
a.add, a.delete { |
63 |
cursor: pointer; |
244 |
cursor: pointer; |
64 |
} |
245 |
} |
Lines 163-177
a.add, a.delete {
Link Here
|
163 |
<th>Weight</th> |
344 |
<th>Weight</th> |
164 |
</tr> |
345 |
</tr> |
165 |
</thead> |
346 |
</thead> |
|
|
347 |
|
166 |
<tbody> |
348 |
<tbody> |
|
|
349 |
<tr> |
350 |
<td> |
351 |
<input placeholder="Search names" type="text" id="searching_fields_name" class="input_search" /> |
352 |
</td> |
353 |
<td> |
354 |
<input placeholder="Search labels" type="text" id="searching_fields_label" class="input_search" /> |
355 |
</td> |
356 |
<td> |
357 |
<select class="btn btn-s btn-search" id="searching_fields_type"> |
358 |
<option value="All" >All</option> |
359 |
<option value="" ></option> |
360 |
<option value="string" >String</option> |
361 |
<option value="date" >Date</option> |
362 |
<option value="number" >Number</option> |
363 |
<option value="boolean" >Boolean</option> |
364 |
<option value="sum" >Sum</option> |
365 |
</select> |
366 |
</td> |
367 |
<td> |
368 |
<input placeholder="Search weights" type="text" id="searching_fields_weight" class="input_search" /> |
369 |
</td> |
370 |
</tr> |
371 |
</tbody> |
372 |
|
373 |
<tbody class="search_field_table"> |
374 |
|
167 |
[% FOREACH search_field IN all_search_fields %] |
375 |
[% FOREACH search_field IN all_search_fields %] |
|
|
376 |
|
168 |
<tr> |
377 |
<tr> |
169 |
<td> |
378 |
<td> |
170 |
<input type="text" name="search_field_name" value="[% search_field.name | html %]" /> |
379 |
<input type="text" name="search_field_name" value="[% search_field.name | html %]" class="field_name_research" /> |
171 |
</td> |
380 |
</td> |
172 |
<td><input type="text" name="search_field_label" value="[% search_field.label | html %]" /> |
381 |
<td><input type="text" name="search_field_label" value="[% search_field.label | html %]" class="field_label_research" /></td> |
173 |
<td> |
382 |
<td> |
174 |
<select name="search_field_type"> |
383 |
<select name="search_field_type" class="btn btn-default btn-xs width_full field_type_research" > |
175 |
<option value=""></option> |
384 |
<option value=""></option> |
176 |
[% IF search_field.type == "string" %] |
385 |
[% IF search_field.type == "string" %] |
177 |
<option value="string" selected="selected">String</option> |
386 |
<option value="string" selected="selected">String</option> |
Lines 199-205
a.add, a.delete {
Link Here
|
199 |
<option value="sum">Sum</option> |
408 |
<option value="sum">Sum</option> |
200 |
[% END %] |
409 |
[% END %] |
201 |
[% IF search_field.type == "isbn" %] |
410 |
[% IF search_field.type == "isbn" %] |
202 |
<option value="isbn" selected="selected">ISBN</option> |
411 |
<option value="isbn" selected="selected">ISBN</option> |
203 |
[% ELSE %] |
412 |
[% ELSE %] |
204 |
<option value="isbn">ISBN</option> |
413 |
<option value="isbn">ISBN</option> |
205 |
[% END %] |
414 |
[% END %] |
Lines 212-220
a.add, a.delete {
Link Here
|
212 |
</td> |
421 |
</td> |
213 |
<td> |
422 |
<td> |
214 |
[% IF search_field.mapped_biblios %] |
423 |
[% IF search_field.mapped_biblios %] |
215 |
<input type="number" step="0.01" min="0.01" max="999.99" name="search_field_weight" value="[% search_field.weight | html %]" /> |
424 |
<input class="field_weight_research" type="number" step="0.01" min="0.01" max="999.99" name="search_field_weight" value="[% search_field.weight | html %]" /> |
216 |
[% ELSE %] |
425 |
[% ELSE %] |
217 |
<input type="hidden" name="search_field_weight" value=""> |
426 |
<input class="field_weight_research" type="hidden" name="search_field_weight" value=""> |
218 |
[% END %] |
427 |
[% END %] |
219 |
</td> |
428 |
</td> |
220 |
</tr> |
429 |
</tr> |
Lines 235-250
a.add, a.delete {
Link Here
|
235 |
<th></th> |
444 |
<th></th> |
236 |
</tr> |
445 |
</tr> |
237 |
</thead> |
446 |
</thead> |
|
|
447 |
|
238 |
<tbody> |
448 |
<tbody> |
|
|
449 |
<tr> |
450 |
<td> |
451 |
<input placeholder="Search fields" type="text" id="searching_fields_[% index.index_name | html %]" class="input_search" /> |
452 |
</td> |
453 |
<td> |
454 |
<select class="btn btn-s btn-search" id="searching_sortable_[% index.index_name | html %]"> |
455 |
<option value="All" >All</option> |
456 |
<option value="undef" >Undef</option> |
457 |
<option value="0" >0</option> |
458 |
<option value="1" >1</option> |
459 |
</select> |
460 |
</td> |
461 |
<td> |
462 |
<select class="btn btn-s btn-search" id="searching_facetable_[% index.index_name | html %]"> |
463 |
<option value="All" >All</option> |
464 |
<option value="1" >Yes</option> |
465 |
<option value="0" >No</option> |
466 |
</select> |
467 |
</td> |
468 |
<td> |
469 |
<select class="btn btn-s btn-search" id="searching_suggestible_[% index.index_name | html %]"> |
470 |
<option value="All" >All</option> |
471 |
<option value="1" >Yes</option> |
472 |
<option value="0" >No</option> |
473 |
</select> |
474 |
</td> |
475 |
<td> |
476 |
<input placeholder="Search mappings" type="text" id="searching_mappings_[% index.index_name | html %]" class="input_search" /> |
477 |
</td> |
478 |
<td> |
479 |
<a class="btn btn-default btn-s reset_search_[% index.index_name | html %]"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Search</a></td> |
480 |
</td> |
481 |
</tr> |
482 |
</tbody> |
483 |
|
484 |
<tbody class="[% index.index_name | html %]_table"> |
239 |
[% FOREACH mapping IN index.mappings %] |
485 |
[% FOREACH mapping IN index.mappings %] |
240 |
<tr> |
486 |
<tr> |
241 |
<td> |
487 |
<td> |
242 |
<input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" /> |
488 |
<input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" /> |
243 |
<input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]"> |
489 |
<input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]" class="field_name_research_[% index.index_name | html %]"> |
244 |
[% mapping.search_field_label | html %] |
490 |
[% mapping.search_field_label | html %] |
245 |
</td> |
491 |
</td> |
246 |
<td> |
492 |
<td> |
247 |
<select name="mapping_sort"> |
493 |
<select name="mapping_sort" class="btn btn-default btn-xs width_full sort_research_[% index.index_name | html %]"> |
248 |
[% IF mapping.sort == 'undef' %] |
494 |
[% IF mapping.sort == 'undef' %] |
249 |
<option value="undef" selected="selected">Undef</option> |
495 |
<option value="undef" selected="selected">Undef</option> |
250 |
[% ELSE %] |
496 |
[% ELSE %] |
Lines 264-270
a.add, a.delete {
Link Here
|
264 |
</td> |
510 |
</td> |
265 |
<td> |
511 |
<td> |
266 |
[% IF mapping.is_facetable %] |
512 |
[% IF mapping.is_facetable %] |
267 |
<select name="mapping_facet"> |
513 |
<select name="mapping_facet" class="btn btn-default btn-xs width_full facet_research_select_[% index.index_name | html %]"> |
268 |
[% IF mapping.facet %] |
514 |
[% IF mapping.facet %] |
269 |
<option value="0">No</option> |
515 |
<option value="0">No</option> |
270 |
<option value="1" selected="selected">Yes</option> |
516 |
<option value="1" selected="selected">Yes</option> |
Lines 274-285
a.add, a.delete {
Link Here
|
274 |
[% END %] |
520 |
[% END %] |
275 |
</select> |
521 |
</select> |
276 |
[% ELSE %] |
522 |
[% ELSE %] |
277 |
<input type="hidden" name="mapping_facet" value="0" /> |
523 |
<input type="hidden" name="mapping_facet" value="0" class="facet_research_input_[% index.index_name | html %]"/> |
278 |
No |
524 |
No |
279 |
[% END %] |
525 |
[% END %] |
280 |
</td> |
526 |
</td> |
281 |
<td> |
527 |
<td> |
282 |
<select name="mapping_suggestible"> |
528 |
<select name="mapping_suggestible" class="btn btn-default btn-xs width_full suggestible_research_[% index.index_name | html %]"> |
283 |
[% IF mapping.suggestible %] |
529 |
[% IF mapping.suggestible %] |
284 |
<option value="0">No</option> |
530 |
<option value="0">No</option> |
285 |
<option value="1" selected="selected">Yes</option> |
531 |
<option value="1" selected="selected">Yes</option> |
Lines 290-296
a.add, a.delete {
Link Here
|
290 |
</select> |
536 |
</select> |
291 |
</td> |
537 |
</td> |
292 |
<td> |
538 |
<td> |
293 |
<input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" /> |
539 |
<input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" class="mapping_research_[% index.index_name | html %]"/> |
294 |
</td> |
540 |
</td> |
295 |
<td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td> |
541 |
<td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td> |
296 |
</tr> |
542 |
</tr> |
Lines 300-320
a.add, a.delete {
Link Here
|
300 |
<tr class="nodrag nodrop"> |
546 |
<tr class="nodrag nodrop"> |
301 |
<td> |
547 |
<td> |
302 |
<input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" /> |
548 |
<input data-id="mapping_index_name" type="hidden" value="[% index.index_name | html %]" /> |
303 |
<select data-id="mapping_search_field_name"> |
549 |
<select data-id="mapping_search_field_name" class="btn btn-default btn-xs width_full" > |
304 |
[% FOREACH f IN all_search_fields %] |
550 |
[% FOREACH f IN all_search_fields %] |
305 |
<option value="[% f.name | html %]">[% f.name | html %]</option> |
551 |
<option value="[% f.name | html %]">[% f.name | html %]</option> |
306 |
[% END %] |
552 |
[% END %] |
307 |
</select> |
553 |
</select> |
308 |
</td> |
554 |
</td> |
309 |
<td> |
555 |
<td> |
310 |
<select data-id="mapping_sort"> |
556 |
<select data-id="mapping_sort" class="btn btn-default btn-xs width_full"> |
311 |
<option value="undef">Undef</option> |
557 |
<option value="undef">Undef</option> |
312 |
<option value="0">0</option> |
558 |
<option value="0">0</option> |
313 |
<option value="1">1</option> |
559 |
<option value="1">1</option> |
314 |
</select> |
560 |
</select> |
315 |
</td> |
561 |
</td> |
316 |
<td> |
562 |
<td> |
317 |
<select data-id="mapping_facet"> |
563 |
<select data-id="mapping_facet" class="btn btn-default btn-xs width_full"> |
318 |
[% IF mapping.facet %] |
564 |
[% IF mapping.facet %] |
319 |
<option value="0">No</option> |
565 |
<option value="0">No</option> |
320 |
<option value="1" selected="selected">Yes</option> |
566 |
<option value="1" selected="selected">Yes</option> |
Lines 325-331
a.add, a.delete {
Link Here
|
325 |
</select> |
571 |
</select> |
326 |
</td> |
572 |
</td> |
327 |
<td> |
573 |
<td> |
328 |
<select data-id="mapping_suggestible"> |
574 |
<select data-id="mapping_suggestible" class="btn btn-default btn-xs width_full"> |
329 |
[% IF mapping.suggestible %] |
575 |
[% IF mapping.suggestible %] |
330 |
<option value="0">No</option> |
576 |
<option value="0">No</option> |
331 |
<option value="1" selected="selected">Yes</option> |
577 |
<option value="1" selected="selected">Yes</option> |
332 |
- |
|
|