Module: Crm::ShowcasesHelper

Defined in:
app/helpers/crm/showcases_helper.rb

Overview

View helpers for the CRM showcases screens.

Instance Method Summary collapse

Instance Method Details

#showcase_state_badge(state) ⇒ String

Renders a colored Bootstrap badge for a showcase state.

Parameters:

  • state (String, Symbol)

    showcase state (e.g. 'published', 'draft')

Returns:

  • (String)

    badge HTML



11
12
13
14
15
16
17
18
# File 'app/helpers/crm/showcases_helper.rb', line 11

def showcase_state_badge(state)
  color = case state
          when 'published' then 'success'
          when 'draft' then 'warning'
          else 'secondary'
          end
   :span, state.to_s.humanize, class: "badge bg-#{color}"
end