Module: Decidim::Elections::LabelHelper

Included in:
Admin::ElectionsHelper, ElectionCardMetadataCell
Defined in:
app/helpers/decidim/elections/label_helper.rb

Overview

Helpers to render the states as labels on Elections (ongoing, finished, unpublished)

Instance Method Summary collapse

Instance Method Details

#election_status_with_label(election) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/helpers/decidim/elections/label_helper.rb', line 7

def election_status_with_label(election)
  css_class = case election.status
              when :ongoing
                "warning"
              when :finished
                "success"
              when :unpublished
                "alert"
              else
                "reverse"
              end

  (:span,
              I18n.t("decidim.elections.status.#{election.status}"),
              class: "#{css_class} label")
end