Sha256: 65b352b94fd4d53edfbce66f03e7eff9f693b78b2d4bb1b915ece100ad6f4221

Contents?: true

Size: 1.49 KB

Versions: 46

Compression:

Stored size: 1.49 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

    def participatory_space_floating_help
      return if help_section.blank?

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

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

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.8 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.7 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.6 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.10 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.9 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.5 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.8 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.4 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.3 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.7 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.5 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.2 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.1 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.4 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.0 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.3 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.0.rc2 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.27.0.rc1 app/helpers/decidim/participatory_space_helpers.rb
decidim-core-0.26.2 app/helpers/decidim/participatory_space_helpers.rb