Module: Decidim::Proposals::ProposalCellsHelper

Includes:
ApplicationHelper, CardHelper, LayoutHelper, ApplicationHelper, ResourceReferenceHelper, TranslatableAttributes, TranslationsHelper
Included in:
EndorsersListCell, HighlightedProposalsCell, ParticipatoryTextProposalCell, ProposalCell, ProposalMCell, ProposalTagsCell
Defined in:
app/helpers/decidim/proposals/proposal_cells_helper.rb

Overview

Custom helpers, scoped to the proposals engine.

Instance Method Summary collapse

Methods included from ApplicationHelper

#authors_for, #collaborative_draft_state_badge_css_class, #endorsers_for, #filter_origin_values, #filter_state_values, #filter_type_values, #follow_button_for, #form_has_address?, #humanize_collaborative_draft_state, #humanize_proposal_state, #minimum_votes_per_user_enabled?, #proposal_limit, #proposal_limit_enabled?, #proposal_state_css_class, #show_voting_rules?, #vote_button_for, #votes_count_for, #votes_given

Methods included from ControlVersionHelper

#back_to_resource_path, #back_to_resource_path_text, #proposal?, #resource_all_versions_path, #resource_version_path, #versions_controller?

Methods included from CollaborativeDraftHelper

#accept_request_button_label, #collaborative_drafts_states_collection, #reject_request_button_label

Methods included from MapHelper

#proposals_data_for_map

Methods included from ProposalEndorsementsHelper

#current_user_can_endorse?, #endorsement_button, #endorsement_button_classes, #endorsement_identity_presenter, #endorsements_blocked?, #endorsements_enabled?, #fully_endorsed?, #render_endorsement_identity, #render_endorsements_button_card_part, #render_endorsements_count_card_part, #show_endorsements_card?

Methods included from ProposalVotesHelper

#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

#badge_nameObject



53
54
55
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 53

def badge_name
  humanize_proposal_state state
end

#component_settingsObject



41
42
43
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 41

def component_settings
  model.component.settings
end

#current_componentObject



45
46
47
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 45

def current_component
  model.component
end

#current_settingsObject



37
38
39
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 37

def current_settings
  model.component.current_settings
end

#from_contextObject



49
50
51
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 49

def from_context
  @options[:from]
end

#has_actions?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 19

def has_actions?
  return context[:has_actions] if context[:has_actions].present?
  proposals_controller? && index_action? && current_settings.votes_enabled? && !model.draft?
end

#has_footer?Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 24

def has_footer?
  return context[:has_footer] if context[:has_footer].present?
  proposals_controller? && index_action? && current_settings.votes_enabled? && !model.draft?
end

#index_action?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 33

def index_action?
  context[:controller].action_name == "index"
end

#proposals_controller?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 29

def proposals_controller?
  context[:controller].class.to_s == "Decidim::Proposals::ProposalsController"
end

#state_classesObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'app/helpers/decidim/proposals/proposal_cells_helper.rb', line 57

def state_classes
  case state
  when "accepted"
    ["success"]
  when "rejected"
    ["alert"]
  when "evaluating"
    ["warning"]
  when "withdrawn"
    ["alert"]
  else
    ["muted"]
  end
end