Sha256: 992bb80109de2eb5352b9f418ecbb5350e37dc16b09a61bd5448d2d6d82b3dec
Contents?: true
Size: 783 Bytes
Versions: 19
Compression:
Stored size: 783 Bytes
Contents
class Backbone.Poised.Value extends Backbone.Poised.View tagName: 'span' className: 'poised value' initialize: (options = {}) => throw new Error('Missing `model` option') unless options.model? throw new Error('Missing `attribute` option') unless options.attribute? @attribute = options.attribute @options = _.chain(options) .pick('unit', 'precision') .value() @model.on "change:#{@attribute}", @render value: -> v = @model.get(@attribute) if typeof v is 'number' and isNaN(v) '-' else if @options.precision? @model.get(@attribute).toFixed(@options.precision) else v unit: -> if @options.unit " #{@options.unit}" else '' render: => @$el.html("#{@value()}#{@unit()}") this
Version data entries
19 entries across 19 versions & 1 rubygems