Module: Decidim::Proposals::ApplicationHelper

Includes:
Comments::CommentsHelper, MapHelper, Decidim::PaginateHelper, MapHelper, ProposalVotesHelper
Defined in:
decidim-proposals/app/helpers/decidim/proposals/application_helper.rb

Overview

Custom helpers, scoped to the proposals engine.

Instance Method Summary collapse

Methods included from MapHelper

#proposals_data_for_map

Methods included from MapHelper

#dynamic_map_for, #static_map_link

Methods included from ProposalVotesHelper

#remaining_votes_count_for, #vote_button_classes, #vote_limit_enabled?, #votes_count_classes

Methods included from Decidim::PaginateHelper

#decidim_paginate

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
# File 'decidim-proposals/app/helpers/decidim/proposals/application_helper.rb', line 19

def humanize_proposal_state(state)
  I18n.t(state, scope: "decidim.proposals.answers", default: :not_answered)
end

#proposal_state_badge_css_class(state) ⇒ Object

Public: The css class applied based on the proposal state to

the proposal badge.

state - The String state of the proposal.

Returns a String.



47
48
49
50
51
52
53
54
55
56
# File 'decidim-proposals/app/helpers/decidim/proposals/application_helper.rb', line 47

def proposal_state_badge_css_class(state)
  case state
  when "accepted"
    "success"
  when "rejected"
    "warning"
  when "evaluating"
    "secondary"
  end
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.



28
29
30
31
32
33
34
35
36
37
38
39
# File 'decidim-proposals/app/helpers/decidim/proposals/application_helper.rb', line 28

def proposal_state_css_class(state)
  case state
  when "accepted"
    "text-success"
  when "rejected"
    "text-alert"
  when "evaluating"
    "text-info"
  else
    "text-warning"
  end
end