crowdstart-checkout
Version:
One Click Checkout for Crowdstart
80 lines (59 loc) • 1.86 kB
JavaScript
// Generated by CoffeeScript 1.10.0
var Events, Modal, View, crowdcontrol,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
crowdcontrol = require('crowdcontrol');
Events = crowdcontrol.Events;
View = crowdcontrol.view.View;
Modal = (function(superClass) {
var obj;
extend(Modal, superClass);
function Modal() {
return Modal.__super__.constructor.apply(this, arguments);
}
Modal.prototype.tag = 'modal';
Modal.prototype.html = require('../../templates/modal.jade');
Modal.prototype.isOpen = false;
Modal.prototype.canClose = true;
Modal.prototype.events = (
obj = {},
obj["" + Events.Modal.Open] = function() {
return this.open();
},
obj["" + Events.Modal.Close] = function() {
return this.close();
},
obj["" + Events.Modal.DisableClose] = function() {
return this.canClose = false;
},
obj["" + Events.Modal.EnableClose] = function() {
return this.canClose = true;
},
obj
);
Modal.prototype.js = function(opts) {
this.client = opts.client;
return $(document).on('keydown', this.closeOnEscape);
};
Modal.prototype.open = function() {
this.isOpen = true;
return this.update();
};
Modal.prototype.close = function() {
if (this.canClose) {
this.isOpen = false;
return this.update();
} else {
return true;
}
};
Modal.prototype.closeOnEscape = function(event) {
if (event.which === 27) {
return this.close();
}
};
return Modal;
})(View);
Modal.register();
module.exports = Modal;
//# sourceMappingURL=modal.js.map