Sha256: 43c9389b5fa8782bdcb5c51c9dd5e7c783e9b071c9f2293e05e7d82ebaa0239b

Contents?: true

Size: 726 Bytes

Versions: 4

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ActionDelegator
    module Consultations
      module QuestionMultipleVotesControllerOverride
        extend ActiveSupport::Concern

        included do
          helper_method :delegation
          before_action do
            session[:delegation_id] = params[:delegation] if params[:delegation]
          end

          private

          def delegation
            @delegation ||= Decidim::ActionDelegator::Delegation.find_by(id: delegation_id)
          end

          def delegation_id
            @delegation_id ||= params[:decidim_consultations_delegation_id] || params[:delegation] || session[:delegation_id]
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-action_delegator-0.6.0 app/controllers/decidim/action_delegator/consultations/question_multiple_votes_controller_override.rb
decidim-action_delegator-0.5.0 app/controllers/decidim/action_delegator/consultations/question_multiple_votes_controller_override.rb
decidim-action_delegator-0.4.1 app/controllers/decidim/action_delegator/consultations/question_multiple_votes_controller_override.rb
decidim-action_delegator-0.4 app/controllers/decidim/action_delegator/consultations/question_multiple_votes_controller_override.rb