Sha256: 1e86c9e3a41f1b8bd60b2eb27f96a25e988469cc189da2b1e8f421f02b784964

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

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

      helper Decidim::SanitizeHelper

      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
      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

6 entries across 6 versions & 1 rubygems

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