Sha256: 888347f23864598d91b20439d723fd0a0f52163d0e43081004bfa97511ff55d3

Contents?: true

Size: 1001 Bytes

Versions: 6

Compression:

Stored size: 1001 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    class ConferenceSpeakersController < Decidim::Conferences::ApplicationController
      include ParticipatorySpaceContext

      helper_method :collection, :conference

      def index
        raise ActionController::RoutingError, "No speakers for this conference " if speakers.empty?

        enforce_permission_to :list, :speakers
      end

      private

      def speakers
        @speakers ||= current_participatory_space.speakers.published
      end

      alias collection speakers

      def current_participatory_space
        return unless params[:conference_slug]

        @current_participatory_space ||= OrganizationConferences.new(current_organization).query.where(slug: params[:conference_slug]).or(
          OrganizationConferences.new(current_organization).query.where(id: params[:conference_slug])
        ).first!
      end

      def conference
        current_participatory_space
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-conferences-0.29.1 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.29.0 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.29.0.rc4 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.29.0.rc3 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.29.0.rc2 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.29.0.rc1 app/controllers/decidim/conferences/conference_speakers_controller.rb