Sha256: a96a045112436b0b146676cbb9837cf977cb43b995e03973cf606e9d53fbc267

Contents?: true

Size: 868 Bytes

Versions: 17

Compression:

Stored size: 868 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
      Spotlight::Engine.config.iiif_service.info_url(@featured_image, request.host)
    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

17 entries across 17 versions & 1 rubygems

Version Path
blacklight-spotlight-4.2.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-4.1.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-4.1.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-4.1.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-4.0.3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-4.0.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-4.0.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-4.0.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta10 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta9 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta8 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta7 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta6 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta5 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta4 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.6.0.beta1 app/controllers/spotlight/featured_images_controller.rb