Sha256: 21995903f51dfce985cfa4f979a092d98a3e528a947ba3aad58febcfbae29780

Contents?: true

Size: 731 Bytes

Versions: 21

Compression:

Stored size: 731 Bytes

Contents

class Dashing.Number extends Dashing.Widget
  @accessor 'current', Dashing.AnimatedValue

  @accessor 'difference', ->
    if @get('last')
      last = parseInt(@get('last'))
      current = parseInt(@get('current'))
      if last != 0
        diff = Math.abs(Math.round((current - last) / last * 100))
        "#{diff}%"
    else
      ""

  @accessor 'arrow', ->
    if @get('last')
      if parseInt(@get('current')) > parseInt(@get('last')) then 'icon-arrow-up' else 'icon-arrow-down'

  onData: (data) ->
    if data.status
      # clear existing "status-*" classes
      $(@get('node')).attr 'class', (i,c) ->
        c.replace /\bstatus-\S+/g, ''
      # add new class
      $(@get('node')).addClass "status-#{data.status}"

Version data entries

21 entries across 21 versions & 6 rubygems

Version Path
baseboard-1.0.2 templates/project/widgets/number/number.coffee
baseboard-1.0.1 templates/project/widgets/number/number.coffee
rtdi-1.0 templates/project/widgets/number/number.coffee
dashing-jruby-1.3.4.1 templates/project/widgets/number/number.coffee
dashing-jruby-1.3.4 templates/project/widgets/number/number.coffee
dashing-1.3.4 templates/project/widgets/number/number.coffee
dashing-1.3.3 templates/project/widgets/number/number.coffee
dashing-beanstalk-1.3.2 templates/project/widgets/number/number.coffee
dashing-1.3.2 templates/project/widgets/number/number.coffee
dashing-rails-2.0.0 vendor/assets/javascripts/dashing/widgets/number.coffee
dashing-rails-1.0.3 app/views/dashing/default_widgets/number/number.coffee
dashing-rails-1.0.2 app/views/dashing/default_widgets/number/number.coffee
dashing-1.3.1 templates/project/widgets/number/number.coffee
dashing-1.3.0 templates/project/widgets/number/number.coffee
dashing-rails-1.0.1 app/views/dashing/default_widgets/number/number.coffee
dashing-rails-1.0.0 app/views/dashing/default_widgets/number/number.coffee
dashing-1.2.0 templates/project/widgets/number/number.coffee
dashing-1.1.0 templates/project/widgets/number/number.coffee
dashing-1.0.6 templates/project/widgets/number/number.coffee
dashing-1.0.5 templates/project/widgets/number/number.coffee