Module: Decidim::Proposals::ApplicationHelper
- Includes:
- Comments::CommentsHelper, MapHelper, MapHelper, ProposalVotesHelper, PaginateHelper
- Defined in:
- decidim-proposals/app/helpers/decidim/proposals/application_helper.rb
Overview
Custom helpers, scoped to the proposals engine.
Instance Method Summary collapse
-
#humanize_proposal_state(state) ⇒ Object
Public: The state of a proposal in a way a human can understand.
-
#proposal_state_css_class(state) ⇒ Object
Public: The css class applied based on the proposal state.
Methods included from MapHelper
Methods included from ProposalVotesHelper
#remaining_votes_count_for, #vote_button_classes, #vote_limit_enabled?, #votes_count_classes
Methods included from Comments::CommentsHelper
#comments_for, #inline_comments_for, #react_comments_component
Instance Method Details
#humanize_proposal_state(state) ⇒ Object
Public: The state of a proposal in a way a human can understand.
state - The String state of the proposal.
Returns a String.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'decidim-proposals/app/helpers/decidim/proposals/application_helper.rb', line 19 def humanize_proposal_state(state) value = if state == "accepted" "accepted" elsif state == "rejected" "rejected" else "not_answered" end I18n.t(value, scope: "decidim.proposals.answers") end |
#proposal_state_css_class(state) ⇒ Object
Public: The css class applied based on the proposal state.
state - The String state of the proposal.
Returns a String.
36 37 38 39 40 41 42 43 44 |
# File 'decidim-proposals/app/helpers/decidim/proposals/application_helper.rb', line 36 def proposal_state_css_class(state) if state == "accepted" "text-success" elsif state == "rejected" "text-alert" else "text-warning" end end |