File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
vendor/assets/javascripts/dashing Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,17 @@ class Dashing.Widget extends Batman.View
5959
6060 receiveData : (data ) =>
6161 @ mixin (data)
62+ @ addStatus (data)
6263 @ onData (data)
6364
65+ addStatus : (data ) =>
66+ if data .status
67+ # clear existing "status-*" classes
68+ $ (@ get (' node' )).attr ' class' , (i ,c ) ->
69+ c .replace / \b status-\S + / g , ' '
70+ # add new class
71+ $ (@ get (' node' )).addClass " status-#{ data .status } "
72+
6473 onData : (data ) =>
6574 # Widgets override this to handle incoming data
6675
Original file line number Diff line number Diff line change @@ -14,11 +14,3 @@ class Dashing.Number extends Dashing.Widget
1414 @ accessor ' arrow' , ->
1515 if @ get (' last' )
1616 if parseInt (@ get (' current' )) > parseInt (@ get (' last' )) then ' fa fa-arrow-up' else ' fa fa-arrow-down'
17-
18- onData : (data ) ->
19- if data .status
20- # clear existing "status-*" classes
21- $ (@ get (' node' )).attr ' class' , (i ,c ) ->
22- c .replace / \b status-\S + / g , ' '
23- # add new class
24- $ (@ get (' node' )).addClass " status-#{ data .status } "
You can’t perform that action at this time.
0 commit comments