Sha256: 97dd14b0bd79f5543397e347e89dbbc7c1a823770796d98ba8200208d87ff024

Contents?: true

Size: 758 Bytes

Versions: 33

Compression:

Stored size: 758 Bytes

Contents

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

    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.id)
    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

33 entries across 33 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.4.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.3.3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.3.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.3.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.3.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.2.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.2.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.1.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.0.rc6 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.0.rc5 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.0.rc4 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.0.rc3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.0.rc2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.0.0.rc1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-1.5.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-1.4.1 app/controllers/spotlight/featured_images_controller.rb