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

(-)a/koha-tmpl/opac-tmpl/bootstrap/js/overdrive.js (-10 / +10 lines)
Lines 320-326 KOHA.OverDriveCirculation = new function() { Link Here
320
                    if (lockable_formats.length > 0 && checkout_popup) {
320
                    if (lockable_formats.length > 0 && checkout_popup) {
321
                        $(el).append( ajax_button( __("Download as:"), function() {
321
                        $(el).append( ajax_button( __("Download as:"), function() {
322
                            checkout_format(el, id, lockable_formats, copies_available);
322
                            checkout_format(el, id, lockable_formats, copies_available);
323
                        }) ).append(" ");
323
                        }, "downloadas") ).append(" ");
324
                    }
324
                    }
325
                }
325
                }
326
326
Lines 330-336 KOHA.OverDriveCirculation = new function() { Link Here
330
                    if( confirm( __("Are you sure you want to return this item?") ) ) {
330
                    if( confirm( __("Are you sure you want to return this item?") ) ) {
331
                        item_action({action: "return", id: id}, el, copies_available + 1);
331
                        item_action({action: "return", id: id}, el, copies_available + 1);
332
                    }
332
                    }
333
                }) );
333
                }, "checkin") );
334
334
335
                return item;
335
                return item;
336
            }
336
            }
Lines 371-382 KOHA.OverDriveCirculation = new function() { Link Here
371
                            }
371
                            }
372
                        });
372
                        });
373
                    }
373
                    }
374
                }) );
374
                }, "checkout") );
375
            }
375
            }
376
            else if (!item) {
376
            else if (!item) {
377
                $(el).append( ajax_button( __("Place hold"), function() {
377
                $(el).append( ajax_button( __("Place hold"), function() {
378
                    item_action({action: "place-hold", id: id}, el, copies_available);
378
                    item_action({action: "place-hold", id: id}, el, copies_available);
379
                }) );
379
                }, "placehold") );
380
            }
380
            }
381
381
382
            if (item) {
382
            if (item) {
Lines 384-410 KOHA.OverDriveCirculation = new function() { Link Here
384
                    if( confirm( __("Are you sure you want to cancel this hold?") ) ) {
384
                    if( confirm( __("Are you sure you want to cancel this hold?") ) ) {
385
                        item_action({action: "remove-hold", id: id}, el, copies_available);
385
                        item_action({action: "remove-hold", id: id}, el, copies_available);
386
                    }
386
                    }
387
                }) );
387
                }, "cancelhold") );
388
            }
388
            }
389
            return item;
389
            return item;
390
        }
390
        }
391
    }
391
    }
392
392
393
    function ajax_button(label, on_click) {
393
    function ajax_button(label, on_click, uniqueName) {
394
        var button = $('<a href="#">')
394
        var button = $('<a href="#">')
395
            .click(function(e) {
395
            .click(function(e) {
396
                e.preventDefault();
396
                e.preventDefault();
397
                on_click();
397
                on_click();
398
            });
398
            });
399
        decorate_button(button, label);
399
        decorate_button(button, label, uniqueName);
400
        return button;
400
        return button;
401
    }
401
    }
402
402
403
    function decorate_button(button, label) {
403
    function decorate_button(button, label, uniqueName) {
404
        $(button)
404
        $(button)
405
            .addClass("btn btn-primary btn-sm")
405
            .addClass("btn btn-primary btn-sm")
406
            .css("color","white")
406
            .css("color","white")
407
            .text(label);
407
            .text(label)
408
            .addClass(uniqueName);
408
    }
409
    }
409
410
410
    function checkout_format(el, id, formats, copies_available) {
411
    function checkout_format(el, id, formats, copies_available) {
411
- 

Return to bug 29845