UNPKG

crowdstart-checkout

Version:

One Click Checkout for Crowdstart

76 lines (54 loc) 2.27 kB
// Generated by CoffeeScript 1.10.0 var Choose, Events, Screen, crowdcontrol, input, requestAnimationFrame, 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; Screen = require('./screen'); requestAnimationFrame = crowdcontrol.utils.shim.requestAnimationFrame; input = require('../../utils/input'); Choose = (function(superClass) { extend(Choose, superClass); function Choose() { return Choose.__super__.constructor.apply(this, arguments); } Choose.prototype.tag = 'choose'; Choose.prototype.title = 'Select Payment'; Choose.prototype.html = require('../../../templates/screens/choose.jade'); Choose.prototype.scripts = null; Choose.prototype.choice = 'stripe'; Choose.prototype.js = function() { this.scripts = this.model.scripts; Choose.__super__.js.apply(this, arguments); return this.stripe(); }; Choose.prototype.stripe = function() { this.choice = 'stripe'; return requestAnimationFrame((function(_this) { return function() { $(_this.root).find('#choose-stripe').prop('checked', true); return $(_this.root).find('#choose-paypal').prop('checked', false); }; })(this)); }; Choose.prototype.paypal = function() { this.choice = 'paypal'; return requestAnimationFrame((function(_this) { return function() { $(_this.root).find('#choose-stripe').prop('checked', false); return $(_this.root).find('#choose-paypal').prop('checked', true); }; })(this)); }; Choose.prototype._submit = function() { if (this.choice === 'stripe') { return this.screenManagerObs.trigger(Events.Screen.UpdateScript, this.scripts.stripe, 1); } else if (this.choice === 'paypal') { return this.screenManagerObs.trigger(Events.Screen.UpdateScript, this.scripts.paypal, 1); } }; return Choose; })(Screen); Choose.register(); module.exports = Choose; //# sourceMappingURL=choose.js.map