summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorDavid Underwood <david.underwood@jadedpixel.com>2012-12-29 20:06:17 +0000
committerDavid Underwood <david.underwood@jadedpixel.com>2012-12-29 20:06:17 +0000
commit264ce7e1b3ccdb5a900842c66831bd999b03090d (patch)
treece0fde6f1497115a24838a14cc285823bf916cd5 /templates
parentbaccda3dfc9d16493becea6261eb65459d860e68 (diff)
Makes the status class removal more flexible
as suggested by @crcastle
Diffstat (limited to 'templates')
-rw-r--r--templates/project/widgets/number/number.coffee6
1 files changed, 5 insertions, 1 deletions
diff --git a/templates/project/widgets/number/number.coffee b/templates/project/widgets/number/number.coffee
index 3ada5a6..645ee7f 100644
--- a/templates/project/widgets/number/number.coffee
+++ b/templates/project/widgets/number/number.coffee
@@ -17,4 +17,8 @@ class Dashing.Number extends Dashing.Widget
onData: (data) ->
if data.status
- $(@get('node')).removeClass("status-danger status-warning").addClass("status-#{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}"