Module: Decidim::Proposals::ProposalCellsHelper
Overview
Custom helpers, scoped to the proposals engine.
Instance Method Summary
collapse
#current_user_proposals, #follow_button_for, #humanize_proposal_state, #proposal_limit, #proposal_limit_enabled?, #proposal_state_badge_css_class, #proposal_state_css_class
Methods included from MapHelper
#proposals_data_for_map
#current_user_can_endorse?, #endorsement_button, #endorsement_button_classes, #endorsement_identity_presenter, #endorsements_blocked?, #endorsements_count_classes, #endorsements_enabled?, #fully_endorsed?, #render_endorsement_identity, #show_endorsements_card?
#can_accumulate_supports_beyond_threshold?, #current_user_can_vote?, #remaining_votes_count_for, #threshold_per_proposal, #threshold_per_proposal_enabled?, #vote_button_classes, #vote_limit, #vote_limit_enabled?, #votes_blocked?, #votes_count_classes, #votes_enabled?
Instance Method Details
#actionable? ⇒ Boolean
19
20
21
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 19
def actionable?
proposals_controller? && index_action? && current_settings.votes_enabled? && !model.draft?
end
|
#badge_name ⇒ Object
47
48
49
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 47
def badge_name
humanize_proposal_state state
end
|
#component_settings ⇒ Object
35
36
37
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 35
def component_settings
model.component.settings
end
|
#current_component ⇒ Object
39
40
41
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 39
def current_component
model.component
end
|
#current_settings ⇒ Object
31
32
33
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 31
def current_settings
model.component.current_settings
end
|
#from_context ⇒ Object
43
44
45
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 43
def from_context
@options[:from]
end
|
#index_action? ⇒ Boolean
27
28
29
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 27
def index_action?
context[:controller].action_name == "index"
end
|
#proposals_controller? ⇒ Boolean
23
24
25
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 23
def proposals_controller?
context[:controller].class.to_s == "Decidim::Proposals::ProposalsController"
end
|
#state_classes ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 51
def state_classes
case state
when "accepted"
["success"]
when "rejected"
["alert"]
when "evaluating"
["warning"]
when "withdrawn"
["alert"]
else
["muted"]
end
end
|