Sha256: 794d12966548a23799e0c794514a0596a081324576a03f2c72bb5c79d5b7b5de

Contents?: true

Size: 1.08 KB

Versions: 24

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatorySpaceHelpers
    # 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.
    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
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
decidim-core-0.9.2 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.9.1 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.9.0 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.8.4 app/helpers/decidim/participatory_space_helpers.rb