Module: Decidim::Plans::PlanCellsHelper

Includes:
ApplicationHelper, CardHelper, LayoutHelper, ApplicationHelper, ResourceReferenceHelper, TranslatableAttributes, TranslationsHelper
Included in:
PlanCell, PlanMCell
Defined in:
app/helpers/decidim/plans/plan_cells_helper.rb

Overview

Custom helpers, scoped to the plans engine.

Instance Method Summary collapse

Methods included from ApplicationHelper

#authors_for, #current_user_plans, #filter_state_values, #filter_type_values, #humanize_plan_state, #plan_filter_form_for, #plan_state_css_class, #tabs_id_for_content

Methods included from LinksHelper

#request_params, #request_params_query

Instance Method Details

#badge_nameObject



47
48
49
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 47

def badge_name
  humanize_plan_state state
end

#component_settingsObject



35
36
37
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 35

def component_settings
  model.component.settings
end

#current_componentObject



39
40
41
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 39

def current_component
  model.component
end

#current_settingsObject



31
32
33
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 31

def current_settings
  model.component.current_settings
end

#from_contextObject



43
44
45
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 43

def from_context
  @options[:from]
end

#has_actions?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 19

def has_actions?
  false
end

#index_action?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 27

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

#plans_controller?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/helpers/decidim/plans/plan_cells_helper.rb', line 23

def plans_controller?
  context[:controller].class.to_s == "Decidim::Plans::PlansController"
end

#state_classesObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/helpers/decidim/plans/plan_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