Sha256: 5d7cf65a8c0892a02ddaa7691355773f87127fd6c68803edb845a8ee4ce85458

Contents?: true

Size: 822 Bytes

Versions: 22

Compression:

Stored size: 822 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  # Handles requests to upload images for exhibit thumbnails
  class FeaturedImagesController < Spotlight::ApplicationController
    load_and_authorize_resource instance_name: :featured_image, class: 'Spotlight::TemporaryImage'

    def create
      if @featured_image.save && @featured_image.file_present?
        render json: { tilesource: tilesource, id: @featured_image.id }
      else
        render json: { error: 'unable to create image' }, status: :bad_request
      end
    end

    private

    def tilesource
      riiif.info_url(@featured_image)
    end

    # The create action can be called from a number of different forms, so
    # we normalize all the parameters.
    def create_params
      params.require(:featured_image).permit(:image)
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-spotlight-3.5.0.4 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.5.0.3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.5.0.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.5.0.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.5.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.4.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.4 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.2.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.2.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.4.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.3.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.2.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.1.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0 app/controllers/spotlight/featured_images_controller.rb