Sha256: 2678a4034c1ff2fde568aae848e5d596971b15f7c14743a1a361ff97687d44f0

Contents?: true

Size: 789 Bytes

Versions: 23

Compression:

Stored size: 789 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

    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

23 entries across 23 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.9 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.8 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.7 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.6 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.5 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.4 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.3 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-3.0.0.alpha.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.13.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.12.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.12.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.9.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.8.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.7.2 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.7.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.7.0 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.6.1.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.6.1 app/controllers/spotlight/featured_images_controller.rb
blacklight-spotlight-2.6.0 app/controllers/spotlight/featured_images_controller.rb