Sha256: d806bbbf75f834a15009ac17bcc8986897a6a8f922bbeb14a6c078eab95479ab
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Decidim module TermCustomizer module Context class ControllerContext < Base def resolve! env = data[:headers].env controller = env["action_controller.instance"] @organization = env["decidim.current_organization"] # E.g. at the participatory process controller the # `decidim.current_participatory_space` environment variable has not # been set. Therefore, we need to fetch it directly from the # controller using its private method. In some edge cases this may not # be implemented (https://github.com/mainio/decidim-module-term_customizer/issues/28) # in which case we do not have access to the participatory space. if controller.respond_to?(:current_participatory_space, true) @space = controller.try( :current_participatory_space ) end @space ||= env["decidim.current_participatory_space"] @component = env["decidim.current_component"] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-term_customizer-0.19.1 | lib/decidim/term_customizer/context/controller_context.rb |
decidim-term_customizer-0.19.0 | lib/decidim/term_customizer/context/controller_context.rb |