Sha256: 0b901cd487c3fb93b1ea22065c3b07310505f6346b9f448b709cbe6f9933486e

Contents?: true

Size: 1.73 KB

Versions: 32

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    class ConferenceProgramController < Decidim::Conferences::ApplicationController
      include ParticipatorySpaceContext
      helper Decidim::SanitizeHelper
      helper Decidim::Conferences::ConferenceProgramHelper
      participatory_space_layout only: :show

      helper_method :collection, :conference, :meeting_days, :meeting_component

      def show
        raise ActionController::RoutingError, "No meetings for this conference " if meetings.blank?

        enforce_permission_to :list, :program
        redirect_to decidim_conferences.conference_path(current_participatory_space) unless current_user_can_visit_space?
      end

      private

      def meeting_component
        return if params[:id].blank?

        @meeting_component ||= current_participatory_space.components.where(manifest_name: "meetings").find_by(id: params[:id])
      end

      def meetings
        return unless meeting_component.published? || !meeting_component.presence

        @meetings ||= Decidim::Meetings::Meeting.where(component: meeting_component).visible_meeting_for(current_user).order(:start_time)
      end

      def meeting_days
        @meeting_days ||= meetings.map { |m| [m.start_time.to_date] }.uniq.flatten
      end

      alias collection meetings

      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

32 entries across 32 versions & 1 rubygems

Version Path
decidim-conferences-0.26.2 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.26.1 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.26.0 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.26.0.rc2 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.26.0.rc1 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.25.2 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.25.1 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.25.0 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.25.0.rc4 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.25.0.rc3 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.25.0.rc2 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.25.0.rc1 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.24.3 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.23.6 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.24.2 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.23.5 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.24.1 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.24.0 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.24.0.rc2 app/controllers/decidim/conferences/conference_program_controller.rb
decidim-conferences-0.23.4 app/controllers/decidim/conferences/conference_program_controller.rb