Module: Decidim::Solutions::SolutionCellsHelper

Includes:
ApplicationHelper, CardHelper, LayoutHelper, ResourceReferenceHelper, ApplicationHelper, TranslatableAttributes, TranslationsHelper
Included in:
SolutionCell
Defined in:
app/helpers/decidim/solutions/solution_cells_helper.rb

Overview

Custom helpers, scoped to the solutions engine.

Instance Method Summary collapse

Methods included from ApplicationHelper

#participatory_space_challenges, #text_editor_for_description

Instance Method Details

#component_settingsObject



43
44
45
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 43

def component_settings
  model.component.settings
end

#current_componentObject



47
48
49
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 47

def current_component
  model.component
end

#current_settingsObject



39
40
41
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 39

def current_settings
  model.component.current_settings
end

#from_contextObject



51
52
53
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 51

def from_context
  options[:from]
end

#has_actions?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 19

def has_actions?
  return context[:has_actions] if context[:has_actions].present?

  solutions_controller? && index_action? && current_settings.votes_enabled? && !model.draft?
end

#has_footer?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 25

def has_footer?
  return context[:has_footer] if context[:has_footer].present?

  solutions_controller? && index_action? && current_settings.votes_enabled? && !model.draft?
end

#index_action?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 35

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

#solutions_controller?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/helpers/decidim/solutions/solution_cells_helper.rb', line 31

def solutions_controller?
  context[:controller].instance_of?(::Decidim::Solutions::SolutionsController)
end