Sha256: 0b5ab4b933d7d6e76943524ab938e73e5741ba8cc16efb6257c625f93e6ba6e5

Contents?: true

Size: 930 Bytes

Versions: 7

Compression:

Stored size: 930 Bytes

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, :show, :create], instance_name: :collection

    # 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

7 entries across 7 versions & 1 rubygems

Version Path
hyrax-3.1.0 app/controllers/hyrax/collections_controller.rb
hyrax-3.0.2 app/controllers/hyrax/collections_controller.rb
hyrax-3.0.1 app/controllers/hyrax/collections_controller.rb
hyrax-3.0.0 app/controllers/hyrax/collections_controller.rb
hyrax-3.0.0.pre.rc4 app/controllers/hyrax/collections_controller.rb
hyrax-3.0.0.pre.rc3 app/controllers/hyrax/collections_controller.rb
hyrax-3.0.0.pre.rc2 app/controllers/hyrax/collections_controller.rb