Sha256: 561d9919da08a735fa0ae49798bc43abf7bfa5dc804491286490d88738bce0d0

Contents?: true

Size: 693 Bytes

Versions: 44

Compression:

Stored size: 693 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # This module, when injected into a controller, loads all the resources
    # to display and interact with meeting polls.
    module PollsResources
      extend ActiveSupport::Concern

      included do
        helper_method :meeting, :poll, :questionnaire
      end

      private

      def meeting
        @meeting ||= Meeting.not_hidden.where(component: current_component).find(params[:meeting_id])
      end

      def poll
        @poll ||= meeting&.poll
      end

      def questionnaire
        @questionnaire ||= Decidim::Meetings::Questionnaire.find_by(questionnaire_for: poll) if poll
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-meetings-0.25.0.rc4 app/controllers/concerns/decidim/meetings/polls_resources.rb
decidim-meetings-0.25.0.rc3 app/controllers/concerns/decidim/meetings/polls_resources.rb
decidim-meetings-0.25.0.rc2 app/controllers/concerns/decidim/meetings/polls_resources.rb
decidim-meetings-0.25.0.rc1 app/controllers/concerns/decidim/meetings/polls_resources.rb