Sha256: 8f26d86000de03528c8b45c071259dd6a51bd9faf0d1b8521cfb94755932bfe0
Contents?: true
Size: 1.95 KB
Versions: 13
Compression:
Stored size: 1.95 KB
Contents
(function() { var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, 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; Backbone.Poised.NumberControl = (function(superClass) { extend(NumberControl, superClass); function NumberControl() { this.render = bind(this.render, this); return NumberControl.__super__.constructor.apply(this, arguments); } NumberControl.prototype.initialize = function(options) { var ref, ref1; if (options == null) { options = {}; } NumberControl.__super__.initialize.apply(this, arguments); this.options = _.chain(options).pick('model', 'clearOnFocus', 'stepSize', 'precision', 'range', 'attribute', 'unit', 'minValue', 'maxValue').defaults({ clearOnFocus: true, type: 'number', minValue: _.firstDefined(options.minValue, (ref = options.range) != null ? ref[0] : void 0), maxValue: _.firstDefined(options.maxValue, (ref1 = options.range) != null ? ref1[1] : void 0), parentView: this }).value(); if ((this.options.stepSize != null) && (this.options.precision == null)) { return this.options.precision = _.find([0, 1, 2, 3], (function(_this) { return function(i) { return _this.options.stepSize * Math.pow(10, i) >= 1; }; })(this)); } }; NumberControl.prototype.render = function() { NumberControl.__super__.render.apply(this, arguments); this.subviews.spinner = new Backbone.Poised.Textfield(this.options); this.$info.append(this.subviews.spinner.render().el); return this; }; return NumberControl; })(Backbone.Poised.BaseControl); }).call(this);
Version data entries
13 entries across 13 versions & 1 rubygems