Sha256: df42b8a9960bca4210d723ca42ad0c6e213c566e4909e6e7aadeb6539c0be885

Contents?: true

Size: 1.09 KB

Versions: 20

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true
module Hyrax
  class CollectionsController < ApplicationController
    include CollectionsControllerBehavior
    include BreadcrumbsForCollections
    with_themed_layout :decide_layout
    load_and_authorize_resource except: [:index],
                                instance_name: :collection,
                                class: Hyrax.config.collection_model

    skip_load_resource only: :create if
      Hyrax.config.collection_class < ActiveFedora::Base

    # Renders a JSON response with a list of files in this collection
    # This is used by the edit form to populate the thumbnail_id dropdown
    def files
      result = form.select_files.map do |label, id|
        { id: id, text: label }
      end
      render json: result
    end

    private

    def form
      @form ||= form_class.new(@collection, current_ability, repository)
    end

    def decide_layout
      layout = case action_name
               when 'show'
                 '1_column'
               else
                 'dashboard'
               end
      File.join(theme, layout)
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hyrax-5.0.4 app/controllers/hyrax/collections_controller.rb
hyrax-5.0.3 app/controllers/hyrax/collections_controller.rb
hyrax-5.0.2 app/controllers/hyrax/collections_controller.rb
hyrax-5.0.1 app/controllers/hyrax/collections_controller.rb
hyrax-5.0.0 app/controllers/hyrax/collections_controller.rb
hyrax-5.0.0.rc3 app/controllers/hyrax/collections_controller.rb
hyrax-5.0.0.rc2 app/controllers/hyrax/collections_controller.rb
hyrax-5.0.0.rc1 app/controllers/hyrax/collections_controller.rb
hyrax-3.6.0 app/controllers/hyrax/collections_controller.rb
hyrax-4.0.0 app/controllers/hyrax/collections_controller.rb
hyrax-4.0.0.rc3 app/controllers/hyrax/collections_controller.rb
hyrax-4.0.0.rc2 app/controllers/hyrax/collections_controller.rb
hyrax-4.0.0.rc1 app/controllers/hyrax/collections_controller.rb
hyrax-3.5.0 app/controllers/hyrax/collections_controller.rb
hyrax-4.0.0.beta2 app/controllers/hyrax/collections_controller.rb
hyrax-3.4.2 app/controllers/hyrax/collections_controller.rb
hyrax-4.0.0.beta1 app/controllers/hyrax/collections_controller.rb
hyrax-3.4.1 app/controllers/hyrax/collections_controller.rb
hyrax-3.4.0 app/controllers/hyrax/collections_controller.rb
hyrax-3.3.0 app/controllers/hyrax/collections_controller.rb