Module: ProfitableHelper

Defined in:
app/helpers/profitable_helper.rb

Instance Method Summary collapse

Instance Method Details

#colored_profit(profitable) ⇒ Object



3
4
5
# File 'app/helpers/profitable_helper.rb', line 3

def colored_profit(profitable)
  (:span, "#{profitable.profitable_total_profit_markup * 100} %", style: style_for_profit_status(profitable.profitable_status))
end

#colored_profit_status(profitable) ⇒ Object



7
8
9
# File 'app/helpers/profitable_helper.rb', line 7

def colored_profit_status(profitable)
  (:span, profitable.profitable_status, style: style_for_profit_status(profitable.profitable_status))
end

#style_for_profit_status(status) ⇒ Object



11
12
13
14
15
16
# File 'app/helpers/profitable_helper.rb', line 11

def style_for_profit_status(status)
  color = { ok: 'green',
    warning: '#c98626',
    alert: 'red' }[status] || 'inherit'
  "color: #{color}"
end