Sha256: 3c3166e8bc0a5e9c5c156facd6914c052f1fc9e854bb4131daf850f3959e143b

Contents?: true

Size: 878 Bytes

Versions: 3

Compression:

Stored size: 878 Bytes

Contents

module Spotlight::Resources
  ##
  # Resources controller allowing curators to create new
  # exhibit resources from a list of DRUIDs.
  class DorHarvesterController < ApplicationController
    before_action :authenticate_user!
    load_and_authorize_resource :exhibit, class: Spotlight::Exhibit
    before_action :build_resource
    authorize_resource

    def create
      @resource.update(resource_params)

      if @resource.save_and_index
        redirect_to spotlight.admin_exhibit_catalog_path(current_exhibit)
      else
        redirect_to spotlight.new_exhibit_resource_path(current_exhibit)
      end
    end
    alias update create

    private

    def build_resource
      @resource = Spotlight::Resources::DorHarvester.instance(current_exhibit)
    end

    def resource_params
      params.require(:resources_dor_harvester).permit(:druid_list)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spotlight-dor-resources-2.0.1 app/controllers/spotlight/resources/dor_harvester_controller.rb
spotlight-dor-resources-2.0.0 app/controllers/spotlight/resources/dor_harvester_controller.rb
spotlight-dor-resources-1.1.0 app/controllers/spotlight/resources/dor_harvester_controller.rb