Sha256: bf55458c372ed1df781d227546c6d06402704feb625c0b0032d9633df3a6dba4

Contents?: true

Size: 1.81 KB

Versions: 7

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    # A controller that holds the logic to show Conferences in a
    # public layout.
    class ConferencesController < Decidim::Conferences::ApplicationController
      include ParticipatorySpaceContext
      participatory_space_layout only: :show

      helper Decidim::AttachmentsHelper
      helper Decidim::IconHelper
      helper Decidim::WidgetUrlsHelper
      helper Decidim::SanitizeHelper
      helper Decidim::ResourceReferenceHelper
      helper Decidim::Conferences::PartnersHelper

      helper_method :collection, :promoted_conferences, :conferences, :stats

      def index
        raise ActionController::RoutingError, "Not Found" if published_conferences.none?

        enforce_permission_to :list, :conference
      end

      def show
        check_current_user_can_visit_space
      end

      def user_diploma
        render layout: "decidim/diploma"
      end

      private

      def current_participatory_space
        return unless params[:slug]

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

      def published_conferences
        @published_conferences ||= OrganizationPublishedConferences.new(current_organization, current_user)
      end

      def conferences
        @conferences ||= OrganizationPrioritizedConferences.new(current_organization, current_user)
      end

      alias collection conferences

      def promoted_conferences
        @promoted_conferences ||= conferences | PromotedConferences.new
      end

      def stats
        @stats ||= ConferenceStatsPresenter.new(conference: current_participatory_space)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-conferences-0.27.9 app/controllers/decidim/conferences/conferences_controller.rb
decidim-conferences-0.27.8 app/controllers/decidim/conferences/conferences_controller.rb
decidim-conferences-0.27.7 app/controllers/decidim/conferences/conferences_controller.rb
decidim-conferences-0.27.6 app/controllers/decidim/conferences/conferences_controller.rb
decidim-conferences-0.26.10 app/controllers/decidim/conferences/conferences_controller.rb
decidim-conferences-0.26.9 app/controllers/decidim/conferences/conferences_controller.rb
decidim-conferences-0.27.5 app/controllers/decidim/conferences/conferences_controller.rb