2013-10-29 38 views
1

我目前正在從Nagios Check_mk獲取活動檢查訂閱源並顯示在文本小部件上的項目。我試圖讓小部件改變顏色,通過研討會頁面工作,我堅持使用咖啡腳本,當數值發生變化時,它看起來沒有任何影響。這裏是我有shopify/Dashing研討會咖啡腳本語法問題

alert.coffee

class Dashing.Alert extends Dashing.Widget 

ready: -> 
# This is fired when the widget is done being rendered 

onData: (data) -> 
# Handle incoming data 
# You can access the html node of this widget with @node 
# Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in. 

@accessor 'value', Dashing.AnimatedValue 

@accessor 'isTooHigh', -> 
@get('value') > 200 

警報SCSS

.widget-alert { 
background: #00ff99; 
font-size: 65px; 
font-weight: bold; 
} 

.danger { 
background: #ff1a00; 
} 

所有其他文件是完全在車間內頁爲詳細:非常感謝任何幫助。

回答

0

基本顏色的變化或顏色的動畫閃爍是由SCSS @keyframe規則處理,必須將其綁定到一個選擇,否則動畫不會有任何效果

下面是一些例子

$background-alert-color-1: #FFFF66; 
    $background-alert-color-2: #FF9618; 
    $text-alert-color: #fff; 


    @-webkit-keyframes status-alert-background { 
     0% { background-color: $background-alert-color-1; } 
     50% { background-color: $background-alert-color-2; } 
     100% { background-color: $background-alert-color-1; } 
    } 

    .widget.status-alert { 
     color: $text-alert-color; 
     background-color: $background-alert-color-1; 
     @include animation(status-alert-background, 2s, ease, infinite); 

     .icon-alert-sign { 
     display: inline-block; 
     } 

    .title, .more-info { 
     color: $text-alert-color; 
    } 

對於一些例子和參考(也用於coffescript),你可以檢查這一個dashing_zabbix