|
Lines 52-57
Link Here
|
| 52 |
} ); |
52 |
} ); |
| 53 |
} |
53 |
} |
| 54 |
}); |
54 |
}); |
|
|
55 |
$('.add-search-field').click(function() { |
| 56 |
var table = $(this).closest('table'); |
| 57 |
var line = $(this).closest("tr"); |
| 58 |
var name = $(line).find('input[data-id="search_field_name"]').val(); |
| 59 |
var label = $(line).find('input[data-id="search_field_name"]').val(); |
| 60 |
if ( name.length > 0 && label.length > 0 ) { |
| 61 |
var new_line = clone_line( line ); |
| 62 |
new_line.appendTo($('table[data-index_name=search_fields]>tbody')); |
| 63 |
$('.delete').click(function() { |
| 64 |
$(this).parents('tr').remove(); |
| 65 |
}); |
| 66 |
clean_line(line); |
| 67 |
|
| 68 |
$(table).tableDnD( { |
| 69 |
onDragClass: "dragClass", |
| 70 |
} ); |
| 71 |
} |
| 72 |
}); |
| 55 |
}); |
73 |
}); |
| 56 |
</script> |
74 |
</script> |
| 57 |
<style> |
75 |
<style> |
|
Lines 144-156
a.add, a.delete {
Link Here
|
| 144 |
[% END %] |
162 |
[% END %] |
| 145 |
</ul> |
163 |
</ul> |
| 146 |
<div id="search_fields"> |
164 |
<div id="search_fields"> |
| 147 |
<table class="search_fields"> |
165 |
<table class="search_fields" data-index_name="search_fields"> |
| 148 |
<thead> |
166 |
<thead> |
| 149 |
<tr> |
167 |
<tr> |
| 150 |
<th>Name</th> |
168 |
<th>Name</th> |
| 151 |
<th>Label</th> |
169 |
<th>Label</th> |
| 152 |
<th>Type</th> |
170 |
<th>Type</th> |
| 153 |
<th>Weight</th> |
171 |
<th>Weight</th> |
|
|
172 |
<th></th> |
| 154 |
</tr> |
173 |
</tr> |
| 155 |
</thead> |
174 |
</thead> |
| 156 |
<tbody> |
175 |
<tbody> |
|
Lines 207-215
a.add, a.delete {
Link Here
|
| 207 |
<input type="hidden" name="search_field_weight" value=""> |
226 |
<input type="hidden" name="search_field_weight" value=""> |
| 208 |
[% END %] |
227 |
[% END %] |
| 209 |
</td> |
228 |
</td> |
|
|
229 |
<td> |
| 230 |
[% IF search_field.is_mapped %] |
| 231 |
<a class="btn btn-default btn-xs disabled delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a> |
| 232 |
[% ELSE %] |
| 233 |
<a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a> |
| 234 |
[% END %] |
| 235 |
</td> |
| 236 |
</td> |
| 210 |
</tr> |
237 |
</tr> |
| 211 |
[% END %] |
238 |
[% END %] |
| 212 |
</tbody> |
239 |
</tbody> |
|
|
240 |
<tfoot> |
| 241 |
<tr> |
| 242 |
<td> |
| 243 |
<input type="text" data-id="search_field_name"/> |
| 244 |
</td> |
| 245 |
<td> |
| 246 |
<input type="text" data-id="search_field_label"/> |
| 247 |
</td> |
| 248 |
<td> |
| 249 |
<select data-id="search_field_type"> |
| 250 |
<option value=""></option> |
| 251 |
<option value="string">String</option> |
| 252 |
<option value="date">Date</option> |
| 253 |
<option value="number">Number</option> |
| 254 |
<option value="boolean">Boolean</option> |
| 255 |
<option value="sum">Sum</option> |
| 256 |
</select> |
| 257 |
</td> |
| 258 |
<td><input type="hidden" name="search_field_weight" value=""></td> |
| 259 |
<td><a class="btn btn-default btn-xs add-search-field"><i class="fa fa-plus"></i> Add</a></td> |
| 260 |
</tr> |
| 261 |
</tfoot> |
| 213 |
</table> |
262 |
</table> |
| 214 |
</div> |
263 |
</div> |
| 215 |
[% FOREACH index IN indexes %] |
264 |
[% FOREACH index IN indexes %] |