Module: Decidim::ParticipatorySpaceHelpers

Defined in:
app/helpers/decidim/participatory_space_helpers.rb

Instance Method Summary collapse

Instance Method Details

#participatory_space_floating_helpObject



30
31
32
33
34
35
36
# File 'app/helpers/decidim/participatory_space_helpers.rb', line 30

def participatory_space_floating_help
  return if help_section.blank?

   "div", class: "row collapse" do
    floating_help(help_id) { translated_attribute(help_section).html_safe }
  end
end

#participatory_space_helpersObject

Public: This method gets exposed on all controllers that have ‘ParticipatorySpaceContext` included as a module.

Through this method, you can access helpers that are unique to a particular participatory space. These helpers are defined in the participatory space manifest, via the ‘context` helper.

Example:

# If you had a `ParticipatoryProcessHelper` with a `participatory_process_header` method
participatory_process_helpers.participatory_process_header(current_participatory_space)

Returns an Object that includes the Helpers as public methods.



18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/decidim/participatory_space_helpers.rb', line 18

def participatory_space_helpers
  return @participatory_space_helpers if defined?(@participatory_space_helpers)

  helper = current_participatory_space_manifest.context(current_participatory_space_context).helper

  klass = Class.new(SimpleDelegator) do
    include helper.constantize if helper
  end

  @participatory_space_helpers = klass.new(self)
end

#participatory_space_wrapper(&block) ⇒ Object



38
39
40
41
42
43
# File 'app/helpers/decidim/participatory_space_helpers.rb', line 38

def participatory_space_wrapper(&block)
   :div, class: "wrapper" do
    concat(participatory_space_floating_help)
    concat(capture(&block))
  end
end