Sha256: 2ceb401d926602ffde06a81e92ebed5ad03979d880c0d381434aad2c97c644da

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

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
        redirect_to spotlight.admin_exhibit_catalog_index_path(current_exhibit)
      else
        redirect_to spotlight.new_exhibit_resource_path(current_exhibit)
      end
    end

    def update
      @resource.update(resource_params)

      if @resource.save
        redirect_to spotlight.admin_exhibit_catalog_index_path(current_exhibit)
      else
        redirect_to spotlight.new_exhibit_resource_path(current_exhibit)
      end
    end

    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

1 entries across 1 versions & 1 rubygems

Version Path
spotlight-dor-resources-0.6.0 app/controllers/spotlight/resources/dor_harvester_controller.rb