App.NumberFieldComponent = Ember.TextField.extend
  type: 'number'
  attributeBindings: ['min', 'max', 'step']
  focusIn: -> @$().select()
  numericValue: Ember.computed 'value',
    get: ->
      value = @get 'value'
      if value? then String(value) else ''
    set: (key, value)->
      if value?
        setValue = parseFloat(value)
        @set "value", if isFinite(setValue) then setValue else null
      else
        @set 'value', null
      value
