Sha256: 09b78dffe71008308be05935de4da90ed30db4a9a6f04a1558fda0de32aceba9

Contents?: true

Size: 1.28 KB

Versions: 58

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    class MediaController < Decidim::Conferences::ApplicationController
      include ParticipatorySpaceContext
      helper Decidim::Conferences::MediaAttachmentsHelper
      helper Decidim::SanitizeHelper

      participatory_space_layout only: :index

      helper_method :collection, :conference

      def index
        raise ActionController::RoutingError, "No media_links for this conference " if media_links.empty? && current_participatory_space.attachments.empty?

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

      private

      def media_links
        @media_links ||= current_participatory_space.media_links
      end

      alias collection media_links

      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

58 entries across 58 versions & 1 rubygems

Version Path
decidim-conferences-0.28.4 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.9 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.28.3 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.8 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.28.2 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.7 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.28.1 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.6 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.26.10 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.26.9 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.28.0 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.5 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.28.0.rc5 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.28.0.rc4 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.26.8 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.4 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.3 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.26.7 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.26.5 app/controllers/decidim/conferences/media_controller.rb
decidim-conferences-0.27.2 app/controllers/decidim/conferences/media_controller.rb