UNPKG

crowdstart-checkout

Version:

One Click Checkout for Crowdstart

100 lines (73 loc) 2.47 kB
// Generated by CoffeeScript 1.10.0 var Confirm, Events, FormView, crowdcontrol, input, 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; FormView = crowdcontrol.view.form.FormView; input = require('../utils/input'); Confirm = (function(superClass) { var obj; extend(Confirm, superClass); function Confirm() { return Confirm.__super__.constructor.apply(this, arguments); } Confirm.prototype.tag = 'confirm'; Confirm.prototype.html = require('../../templates/confirm.jade'); Confirm.prototype.locked = false; Confirm.prototype.hide = false; Confirm.prototype.error = ''; Confirm.prototype.index = 0; Confirm.prototype.model = { agreed: false }; Confirm.prototype.inputConfigs = [input('agreed', '', 'checkbox terms')]; Confirm.prototype.events = ( obj = {}, obj["" + Events.Screen.SyncScript] = function(scriptRefs, index) { this.index = index; return this.update(); }, obj["" + Events.Confirm.Error] = function(msg) { return this.error = msg; }, obj["" + Events.Confirm.Hide] = function() { return this.setHide(true); }, obj["" + Events.Confirm.Show] = function() { return this.setHide(false); }, obj["" + Events.Confirm.Lock] = function() { return this.setLock(true); }, obj["" + Events.Confirm.Unlock] = function() { return this.setLock(false); }, obj ); Confirm.prototype.setHide = function(state) { this.hide = state; return this.update(); }; Confirm.prototype.setLock = function(state) { this.locked = state; return this.update(); }; Confirm.prototype.hasError = function() { return (this.error != null) && this.error !== ''; }; Confirm.prototype.js = function(opts) { Confirm.__super__.js.apply(this, arguments); return this.config = opts.config; }; Confirm.prototype._submit = function(event) { if (this.locked) { return false; } return this.obs.trigger(Events.Screen.TryNext, event); }; return Confirm; })(FormView); Confirm.register(); module.exports = Confirm; //# sourceMappingURL=confirm.js.map