Sha256: 49c9a0028146fe39c115593a721ab7616d77530aecf0ba80f03345cf5e435ef5

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

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

      helper_method :collection, :conference

      def index
        raise ActionController::RoutingError, "No registration types for this conference " if registration_types.empty? && current_participatory_space.registrations_enabled

        enforce_permission_to :list, :registration_types
      end

      private

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

      alias collection registration_types

      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

7 entries across 7 versions & 1 rubygems

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