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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt (-21 / +42 lines)
Lines 274-287 Link Here
274
                                        [% END %]
274
                                        [% END %]
275
                                    </fieldset>
275
                                    </fieldset>
276
                                </form>
276
                                </form>
277
                                <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="myform">
277
                                <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions">
278
                                    <input type="hidden" name="op" value="delete_confirm" />
278
                                    <input type="hidden" name="op" value="delete_confirm" />
279
                                    [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
279
                                    [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %]
280
                                        <div id="toolbar" class="toolbar clearfix">
280
                                        <div id="toolbar" class="toolbar clearfix">
281
                                        [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
281
                                        [% IF ( Koha.Preference('MaxOpenSuggestions') != '' && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
282
                                                <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]).</br>Once the library has processed those suggestions you will be able to place more.</p>
282
                                                <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time ([% Koha.Preference('MaxOpenSuggestions') | html %]).</br>Once the library has processed those suggestions you will be able to place more.</p>
283
                                        [% ELSE %]
283
                                        [% ELSE %]
284
                                                <a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a>
284
                                                <a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
285
                                        [% END %]
285
                                        [% END %]
286
                                        </div>
286
                                        </div>
287
                                    [% END %]
287
                                    [% END %]
Lines 314-325 Link Here
314
                                                    [% IF ( loggedinusername ) %]
314
                                                    [% IF ( loggedinusername ) %]
315
                                                        <td>
315
                                                        <td>
316
                                                            [% IF ( suggestions_loo.showcheckbox ) %]
316
                                                            [% IF ( suggestions_loo.showcheckbox ) %]
317
                                                                <input type="checkbox" class="cb" name="delete_field" value="[% suggestions_loo.suggestionid | html %]" />
317
                                                                <input type="checkbox" class="cb" id="id[% suggestions_loo.suggestionid | html %]" name="delete_field" data-title="[% suggestions_loo.title | html %]" value="[% suggestions_loo.suggestionid | html %]" />
318
                                                            [% END %]
318
                                                            [% END %]
319
                                                        </td>
319
                                                        </td>
320
                                                    [% END %]
320
                                                    [% END %]
321
                                                    <td>
321
                                                    <td>
322
                                                        <p><strong>[% suggestions_loo.title | html %]</strong></p>
322
                                                        <p><label for="id[% suggestions_loo.suggestionid | html %]"><strong>[% suggestions_loo.title | html %]</strong></label></p>
323
                                                            <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author | html %],[% END %]
323
                                                            <p>[% IF ( suggestions_loo.author ) %][% suggestions_loo.author | html %],[% END %]
324
                                                                [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate | html %],[% END %]
324
                                                                [% IF ( suggestions_loo.copyrightdate ) %] - [% suggestions_loo.copyrightdate | html %],[% END %]
325
                                                                [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode | html %][% END %]
325
                                                                [% IF ( suggestions_loo.publishercode ) %] - [% suggestions_loo.publishercode | html %][% END %]
Lines 373-379 Link Here
373
373
374
                                    [% IF ( loggedinusername ) %]
374
                                    [% IF ( loggedinusername ) %]
375
                                        <fieldset class="action">
375
                                        <fieldset class="action">
376
                                            <input type="submit" class="btn btn-danger" value="Delete selected" />
376
                                            <input type="submit" class="btn btn-danger removeitems" value="Delete selected" />
377
                                        </fieldset>
377
                                        </fieldset>
378
                                    [% END %]
378
                                    [% END %]
379
                                </form>
379
                                </form>
Lines 387-393 Link Here
387
                                    [% IF ( Koha.Preference('MaxOpenSuggestions') != ''  && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
387
                                    [% IF ( Koha.Preference('MaxOpenSuggestions') != ''  && patrons_pending_suggestions_count >= Koha.Preference('MaxOpenSuggestions') ) %]
388
                                        <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time.</br>Once the library has processed those suggestions you will be able to place more.</p>
388
                                        <p class="TooManySuggestionsText">You have reached your limit of suggestions you can place at this time.</br>Once the library has processed those suggestions you will be able to place more.</p>
389
                                    [% ELSE %]
389
                                    [% ELSE %]
390
                                        <p><a class="new" href="/cgi-bin/koha/opac-suggestions.pl?op=add">New purchase suggestion</a></p>
390
                                        <p><a class="btn btn-link new" href="/cgi-bin/koha/opac-suggestions.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a></p>
391
                                    [% END %]
391
                                    [% END %]
392
                                [% END %]
392
                                [% END %]
393
                            [% END # / IF suggestions_loop %]
393
                            [% END # / IF suggestions_loop %]
Lines 404-410 Link Here
404
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
404
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
405
[% INCLUDE 'datatables.inc' %]
405
[% INCLUDE 'datatables.inc' %]
406
<script>
406
<script>
407
    //<![CDATA[
408
    [% IF ( loggedinusername ) %]
407
    [% IF ( loggedinusername ) %]
409
        function enableCheckboxActions(){
408
        function enableCheckboxActions(){
410
            // Enable/disable controls if checkboxes are checked
409
            // Enable/disable controls if checkboxes are checked
Lines 450-471 Link Here
450
        $(".cb").click(function(){
449
        $(".cb").click(function(){
451
          enableCheckboxActions();
450
          enableCheckboxActions();
452
        });
451
        });
453
        $("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Delete")+"</a>")
452
        $("#removeitems").html("<a href=\"#\" class=\"btn btn-link removeitems tag_hides btn-disabled\"><i class=\"fa fa-trash\"></i> "+_("Delete")+"</a>");
454
        .click(function(e){
453
455
          e.preventDefault();
456
          $("#myform").submit();
457
          return false;
458
        });
459
        enableCheckboxActions();
454
        enableCheckboxActions();
460
        $("#myform").on('submit', function() {
455
461
          if ( $("input:checked").size() < 1 ) {
456
        $(".removeitems").on("click", function(e) {
462
            alert(MSG_NO_SUGGESTION_SELECTED);
457
            e.preventDefault();
463
            return false;
458
            var selected_titles = $("input:checked");
464
          }
459
            var title;
465
          return true;
460
            var yes_label;
461
            var no_label;
462
            var message = "";
463
            if ( selected_titles.size() < 1 ) {
464
                alert(MSG_NO_SUGGESTION_SELECTED);
465
                return false;
466
            } else {
467
                if( selected_titles.size() > 1 ){
468
                    message = $("<ul></ul>");
469
                    title = _("Are you sure you want to delete these suggestions?");
470
                    yes_label = _("Yes, delete suggestions");
471
                    no_label = _("No, do not delete suggestions");
472
                    selected_titles.each(function(){
473
                        message.append( "<li>" +  $(this).data("title") + "</li>" );
474
                    });
475
                } else {
476
                    title = _("Are you sure you want to delete this suggestion?");
477
                    yes_label = _("Yes, delete suggestion");
478
                    no_label = _("No, do not delete suggestion");
479
                    selected_titles.each(function(){
480
                        message += $(this).data("title");
481
                    });
482
                }
483
                confirmModal( message, title, yes_label, no_label, function( result ){
484
                    if( result ){
485
                        $("#delete_suggestions").submit();
486
                    }
487
                });
488
            }
466
        });
489
        });
467
        [% END %]
490
        [% END %]
468
    });
491
    });
469
//]]>
470
</script>
492
</script>
471
[% END %]
493
[% END %]
472
- 

Return to bug 24336