Sha256: 1b16a2bf1aff7ddd8bf7af5a56650353582c2a5b3c05de7ddef234fc3aaf67d3
Contents?: true
Size: 1.82 KB
Versions: 12
Compression:
Stored size: 1.82 KB
Contents
class Backbone.Poised.RangeControl extends Backbone.Poised.BaseControl initialize: (options) => super @options = _.chain(@options) .pick('model', 'renderSpinner', 'clearOnFocus', 'stepSize', 'precision', 'range', 'attribute', 'unit', 'sliderMinValue', 'sliderMaxValue', 'spinnerMinValue', 'spinnerMaxValue') .defaults renderSpinner: true clearOnFocus: true type: 'number' .value() if @options.stepSize? and not @options.precision? @options.precision = _.find([0..3], (i) => @options.stepSize * Math.pow(10, i) >= 1) # A spinner field is a textfield of type number. if @options.renderSpinner @spinnerOptions = _.chain(@options) .pick('model', 'attribute', 'type', 'clearOnFocus', 'unit', 'precision', 'stepSize') .defaults minValue: _.firstDefined(@options.spinnerMinValue, @options.range?[0], @options.range?.spinner?[0]) maxValue: _.firstDefined(@options.spinnerMaxValue, @options.range?[1], @options.range?.spinner?[1]) parentView: this .value() @sliderOptions = _.chain(@options) .pick('model', 'attribute', 'stepSize') .defaults minValue: _.firstDefined(@options.sliderMinValue, @options.range?[0], @options.range?.slider?[0]) maxValue: _.firstDefined(@options.sliderMaxValue, @options.range?[1], @options.range?.slider?[1]) parentView: this .value() render: => super if @options.renderSpinner @subviews.spinner = new Backbone.Poised.Textfield(@spinnerOptions) @$info.append(@subviews.spinner.render().el) else @subviews.value = new Backbone.Poised.Value(@options) @$info.append(@subviews.value.render().el) @subviews.slider = new Backbone.Poised.Slider(@sliderOptions) @$el.append(@subviews.slider.render().el) this
Version data entries
12 entries across 12 versions & 1 rubygems