Module: ProfitableHelper
- Defined in:
- app/helpers/profitable_helper.rb
Overview
View helper: profitable.
Instance Method Summary collapse
- #colored_profit(profitable) ⇒ Object
- #colored_profit_status(profitable) ⇒ Object
- #style_for_profit_status(status) ⇒ Object
Instance Method Details
#colored_profit(profitable) ⇒ Object
4 5 6 |
# File 'app/helpers/profitable_helper.rb', line 4 def colored_profit(profitable) content_tag(:span, "#{profitable.profitable_total_profit_markup * 100} %", style: style_for_profit_status(profitable.profitable_status)) end |
#colored_profit_status(profitable) ⇒ Object
8 9 10 |
# File 'app/helpers/profitable_helper.rb', line 8 def colored_profit_status(profitable) content_tag(:span, profitable.profitable_status, style: style_for_profit_status(profitable.profitable_status)) end |
#style_for_profit_status(status) ⇒ Object
12 13 14 15 16 17 |
# File 'app/helpers/profitable_helper.rb', line 12 def style_for_profit_status(status) color = { ok: 'green', warning: '#c98626', alert: 'red' }[status] || 'inherit' "color: #{color}" end |