vendor/assets/javascripts/base/_affirm.js in active_frontend-14.0.77 vs vendor/assets/javascripts/base/_affirm.js in active_frontend-14.0.78

- old
+ new

@@ -31,10 +31,13 @@ btnClass: { cancel: 'btn margin-size-right-xs', confirm: 'btn btn-color-red' }, format: 'modal', + onCancelCallback: function () {}, + onConfirmCallback: function () {}, + onDisplayCallback: function () {}, text: { cancel: 'No, Cancel', confirm: 'Yes, Confirm' }, title: 'Are you sure about this?' @@ -49,20 +52,23 @@ this.$element.click(function (e) { e.stopPropagation(); e.preventDefault(); _self.displayFormat(); + _self.options.onDisplayCallback(); return false; }); $('body') .on('click', '[data-affirm-toggle="cancel"]', function () { _self.cancelFormat(); + _self.options.onCancelCallback(); }) .on('click', '[data-affirm-toggle="confirm"]', function () { _self.confirmFormat(); + _self.options.onConfirmCallback(); }); }; Affirm.prototype.cancelBtn = function () { var button = $('<a data-affirm-toggle="cancel" data-dismiss="modal">') @@ -159,10 +165,10 @@ Affirm.prototype.confirmFormat = function () { if (this.options.format === 'popover') { this.$element.popover('hide'); } else { - $('#bsAffirmModal').modal('show'); + $('#bsAffirmModal').modal('hide'); } }; // AFFIRM PLUGIN DEFINITION // ========================