2013-06-11 7 views
13

Mam etykietę statusu w mojej aplikacji AA, która pokazuje tylko niektóre kolory. Czy są pewne kolory, których mogę użyć lub nie mogę? nie mogę znaleźć wielu informacji na ten temat. kolory znaczników statusowych z ActiveAdmin

tutaj jest mój orders_helper

moduł OrdersHelper

def priority_tag_for_order(order) 
    printonrails_status_tag order_priority(order), color_for_weight(order.priority) 
    end 

    def color_for_weight(weight) 
    case weight 
     when 'lowest' 
     :gray 
     when 'low' 
     :blue 
     when 'mid' 
     :yellow 
     when 'high' 
     :orange 
     when 'highest' 
     :red 
    end 
    end 
end 

Odpowiedz

16

W repo widać, że tylko kilka dostępnych kolorów, mianowicie zielony, pomarańczowy i czerwony są.

.status_tag { 
    background: darken($secondary-color, 15%); 
    color: #fff; 
    text-transform: uppercase; 
    letter-spacing: 0.15em; 
    padding: 3px 5px 2px 5px; 
    font-size: 0.8em; 

    &.ok, &.published, &.complete, &.completed, &.green { background: #8daa92; } 
    &.warn, &.warning, &.orange { background: #e29b20; } 
    &.error, &.errored, &.red { background: #d45f53; } 
} 

Jeśli chcesz dodać nowe, trzeba będzie edytować active_admin.css.scss jak tak

body.active_admin { 
    .status_tag.blue { background: #63B8FF; } 
} 
+0

Dzięki Luis. Lubię metryki CSS. Bardzo czysto. Ten dokument objaśnia użycie stanu_tag: http://www.activeadmin.info/docs/12-arbre-components.html#status_tag W powyższym pytaniu można podać status_tag (order.priority) i ustawić kolory CSS dla każdego z nich. priorytet wagi. – scarver2

+2

Ponieważ ten post został napisany, dodano ".yes" (ładny niebieski) i ".no" (ciemny szary). Istnieje również domyślna jasnoszara. – mgold