View | Details | Raw Unified | Return to bug 27682
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/searchengine/elasticsearch/mappings.tt (-20 / +21 lines)
Lines 108-134 a.add, a.delete { Link Here
108
                [% END %]
108
                [% END %]
109
            </ul>
109
            </ul>
110
            <div id="search_fields">
110
            <div id="search_fields">
111
              <table class="search_fields">
111
              <table class="search_fields" id="search_fields_table">
112
                <thead>
112
                <thead>
113
                  <tr>
113
                  <tr>
114
                    <th>Name</th>
114
                    <th>Name</th>
115
                    <th>Aliases</th>
115
                    <th>Aliases</th>
116
                    <th>Label</th>
116
                    <th>Label</th>
117
                    <th>Type</th>
117
                    <th>Type</th>
118
                    <th colspan="2">Searchable</th>
119
                    <th>Weight</th>
118
                    <th>Weight</th>
119
                    <th colspan="2">Searchable</th>
120
                  </tr>
120
                  </tr>
121
                  <tr>
121
                  <tr>
122
                    <th colspan=4>&nbsp;</th>
122
                    <th colspan="5" class="NoSort">&nbsp;</th>
123
                    <th>Staff interface</th>
123
                    <th class="NoSort">Staff interface</th>
124
                    <th>OPAC</th>
124
                    <th class="NoSort">OPAC</th>
125
                    <th>&nbsp;</th>
126
                  </tr>
125
                  </tr>
127
                </thead>
126
                </thead>
128
                <tbody>
127
                <tbody>
129
                  [% FOREACH search_field IN all_search_fields %]
128
                  [% FOREACH search_field IN all_search_fields %]
130
                    <tr>
129
                    <tr>
131
                      <td>
130
                      <td data-order="[% search_field.name | html %]">
132
                        [% IF search_field.mandatory %]
131
                        [% IF search_field.mandatory %]
133
                            <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
132
                            <input type="text" name="search_field_name" value="[% search_field.name | html %]" readonly />
134
                        [% ELSE %]
133
                        [% ELSE %]
Lines 138-151 a.add, a.delete { Link Here
138
                      <td>
137
                      <td>
139
                          [% search_field.aliases.join(', ') | html %]
138
                          [% search_field.aliases.join(', ') | html %]
140
                      </td>
139
                      </td>
141
                      <td>
140
                      <td data-order="[% search_field.label | html %]">
142
                        [% IF search_field.mandatory %]
141
                        [% IF search_field.mandatory %]
143
                            <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
142
                            <input type="text" name="search_field_label" value="[% search_field.label | html %]" readonly />
144
                        [% ELSE %]
143
                        [% ELSE %]
145
                            <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
144
                            <input type="text" name="search_field_label" value="[% search_field.label | html %]" />
146
                        [% END %]
145
                        [% END %]
147
                      </td>
146
                      </td>
148
                      <td>
147
                      <td data-order="[% search_field.type | html %]">
149
                        [% IF search_field.mandatory %]
148
                        [% IF search_field.mandatory %]
150
                            <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
149
                            <input type="hidden" name="search_field_type" value="[% search_field.type | html %]" />
151
                            <select name="search_field_type" disabled>
150
                            <select name="search_field_type" disabled>
Lines 195-200 a.add, a.delete { Link Here
195
                              [% END %]
194
                              [% END %]
196
                            </select>
195
                            </select>
197
                      </td>
196
                      </td>
197
                        <td data-order="[% search_field.weight | html %]">
198
                            [% IF search_field.mapped_biblios %]
199
                                <input type="text" inputmode="numeric" pattern="[0-9]*" name="search_field_weight" value="[% search_field.weight | html %]" />
200
                            [% ELSE %]
201
                                <input type="text" name="search_field_weight" value="">
202
                            [% END %]
203
                        </td>
198
                      <td>
204
                      <td>
199
                        <select name="search_field_staff_client">
205
                        <select name="search_field_staff_client">
200
                          [% IF search_field.staff_client %]
206
                          [% IF search_field.staff_client %]
Lines 217-229 a.add, a.delete { Link Here
217
                          [% END %]
223
                          [% END %]
218
                        </select>
224
                        </select>
219
                      </td>
225
                      </td>
220
                      <td>
221
                        [% IF search_field.mapped_biblios %]
222
                            <input type="text" inputmode="numeric" pattern="[0-9]*" name="search_field_weight" value="[% search_field.weight | html %]" />
223
                        [% ELSE %]
224
                            <input type="hidden" name="search_field_weight" value="">
225
                        [% END %]
226
                      </td>
227
                    </tr>
226
                    </tr>
228
                  [% END %]
227
                  [% END %]
229
                </tbody>
228
                </tbody>
Lines 231-237 a.add, a.delete { Link Here
231
            </div>
230
            </div>
232
            [% FOREACH index IN indexes %]
231
            [% FOREACH index IN indexes %]
233
                <div id="mapping_[% index.index_name | html %]">
232
                <div id="mapping_[% index.index_name | html %]">
234
                    <table class="mappings" data-index_name="[% index.index_name | html %]">
233
                    <table class="mappings" data-index_name="[% index.index_name | html %]" data-ordering="false" id="mapping_[% index.index_name | html %]_table">
235
                      <thead>
234
                      <thead>
236
                        <tr class="nodrag nodrop">
235
                        <tr class="nodrag nodrop">
237
                          <th>Search field</th>
236
                          <th>Search field</th>
Lines 240-246 a.add, a.delete { Link Here
240
                          <th>Suggestible</th>
239
                          <th>Suggestible</th>
241
                          <th>Searchable</th>
240
                          <th>Searchable</th>
242
                          <th>Mapping</th>
241
                          <th>Mapping</th>
243
                          <th></th>
242
                          <th>&nbsp;</th>
244
                        </tr>
243
                        </tr>
245
                      </thead>
244
                      </thead>
246
                      <tbody>
245
                      <tbody>
Lines 267-272 a.add, a.delete { Link Here
267
                                <td>
266
                                <td>
268
                                    <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
267
                                    <input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" />
269
                                </td>
268
                                </td>
269
                                <td>&nbsp;</td>
270
                              </tr>
270
                              </tr>
271
                            [% ELSE %]
271
                            [% ELSE %]
272
                              <tr>
272
                              <tr>
Lines 448-457 a.add, a.delete { Link Here
448
                </div>
448
                </div>
449
            [% END %]
449
            [% END %]
450
        </div>
450
        </div>
451
        <p>
451
        <fieldset class="action">
452
            <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
452
            <button class="btn btn-default" type="submit" name="op" value="edit"><i class="fa fa-hdd-o" aria-hidden="true"></i> Save</button>
453
            <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Mappings</button>
453
            <button class="btn btn-default" type="submit" name="op" value="reset_confirm"><i class="fa fa-refresh" aria-hidden="true"></i> Reset Mappings</button>
454
        </p>
454
        </fieldset>
455
    </form>
455
    </form>
456
456
457
            </main>
457
            </main>
Lines 465-470 a.add, a.delete { Link Here
465
     </div> <!-- /.row -->
465
     </div> <!-- /.row -->
466
466
467
[% MACRO jsinclude BLOCK %]
467
[% MACRO jsinclude BLOCK %]
468
    [% INCLUDE 'datatables.inc' %]
468
    [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
469
    [% Asset.js("lib/jquery/plugins/jquery.tablednd.js") | $raw %]
469
    [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
470
    [% Asset.js("js/elasticsearch-mappings.js") | $raw %]
470
[% END %]
471
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/elasticsearch-mappings.js (-2 / +26 lines)
Lines 20-27 function clone_line(line) { Link Here
20
    return new_line;
20
    return new_line;
21
}
21
}
22
22
23
function tableInit( oldtabid, newtabid ) {
24
25
    var oldTableId = $("#" + oldtabid + "_table");
26
    var newTableId = $("#" + newtabid + "_table");
27
28
    oldTableId.DataTable().destroy();
29
    newTableId.DataTable(
30
        $.extend(true, {}, dataTablesDefaults, {
31
            "columnDefs": [
32
                { "orderable": false, "searchable": false, 'targets': ['NoSort'] },
33
            ],
34
            "paging": false,
35
            "autoWidth": false
36
        }));
37
}
38
23
$(document).ready(function () {
39
$(document).ready(function () {
24
    $("#tabs").tabs();
40
41
    tableInit( "", "search_fields");
42
43
    $("#tabs").tabs({
44
        activate: function( event, ui ){
45
            tableInit( ui.oldPanel.attr('id'), ui.newPanel.attr('id') );
46
        },
47
    });
48
25
    $('.delete').click(function () {
49
    $('.delete').click(function () {
26
        if ($(this).hasClass('mandatory') && $(".mandatory[data-field_name=" + $(this).attr('data-field_name') + "]").length < 2) {
50
        if ($(this).hasClass('mandatory') && $(".mandatory[data-field_name=" + $(this).attr('data-field_name') + "]").length < 2) {
27
            alert( __("This field is mandatory and must have at least one mapping") );
51
            alert( __("This field is mandatory and must have at least one mapping") );
Lines 34-39 $(document).ready(function () { Link Here
34
    $("table.mappings").tableDnD({
58
    $("table.mappings").tableDnD({
35
        onDragClass: "dragClass",
59
        onDragClass: "dragClass",
36
    });
60
    });
61
37
    $('.add').click(function () {
62
    $('.add').click(function () {
38
        var table = $(this).closest('table');
63
        var table = $(this).closest('table');
39
        var index_name = $(table).attr('data-index_name');
64
        var index_name = $(table).attr('data-index_name');
40
- 

Return to bug 27682