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

(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt (-8 / +19 lines)
Lines 124-130 Link Here
124
        <input type="text" size="30" name="q" title="Enter search terms" value="" />
124
        <input type="text" size="30" name="q" title="Enter search terms" value="" />
125
[% IF ( expanded_options ) %]
125
[% IF ( expanded_options ) %]
126
        <!--   [% IF ( search_box.scan_index ) %]<input type="checkbox" name="scan" id="scan" value="1" /> Scan Indexes[% END %] -->
126
        <!--   [% IF ( search_box.scan_index ) %]<input type="checkbox" name="scan" id="scan" value="1" /> Scan Indexes[% END %] -->
127
        [% IF ( search_box.add_field ) %]<a href="JavaScript:add_field();" id="ButtonPlus" title="Add another field">[+]</a>[% END %]
127
        [% IF ( !loop.first ) %]
128
            <a class="ButtonPlus" name="ButtonPlus" title="Add another field">[+]</a>
129
            <a class="ButtonLess" title="Remove field">[-]</a>
130
        [% END %]
128
[% END %]
131
[% END %]
129
        </p>
132
        </p>
130
    [% END %]
133
    [% END %]
Lines 335-346 Link Here
335
<script type="text/javascript" language="javascript">
338
<script type="text/javascript" language="javascript">
336
    /* This function allows to display a new field to search.
339
    /* This function allows to display a new field to search.
337
    */
340
    */
338
    function add_field() {
341
    $(document).on("click", '.ButtonPlus', function() {
339
        var ButtonPlus = document.getElementById('ButtonPlus');
342
        $('.ButtonLess').show();
340
        var line       = ButtonPlus.parentNode;
343
        var thisLine = $(this).parent();
341
        line.parentNode.appendChild(line.cloneNode(true));
344
        var newLine = thisLine.clone();
342
        line.removeChild(ButtonPlus);
345
        console.log(newLine);
343
    }
346
        newLine.find('input').val('');
347
        thisLine.after(newLine);
348
    });
349
350
    $(document).on("click", '.ButtonLess', function() {
351
        if($(this).parent().siblings().length <= 3 ) {
352
           $('.ButtonLess').hide();
353
        }
354
        $(this).parent().remove();
355
    });
344
</script>
356
</script>
345
357
346
</div>
358
</div>
347
- 

Return to bug 8600