Sha256: 7df44f1f6c9cc6c28425b5f9de6517b73c6e14182d67a98a221a273088c5c4a5

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

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

      participatory_space_layout only: :index

      helper_method :collection, :conference

      def index
        raise ActionController::RoutingError, "No speakers for this conference " if speakers.empty?
        enforce_permission_to :list, :speakers
        redirect_to decidim_conferences.conference_path(current_participatory_space) unless current_user_can_visit_space?
      end

      private

      def speakers
        @speakers ||= current_participatory_space.speakers
      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

9 entries across 9 versions & 1 rubygems

Version Path
decidim-conferences-0.18.1 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.17.2 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.18.0 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.17.1 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.16.1 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.17.0 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.16.0 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.15.2 app/controllers/decidim/conferences/conference_speakers_controller.rb
decidim-conferences-0.15.1 app/controllers/decidim/conferences/conference_speakers_controller.rb