-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Builders #26
Comments
@travisLilleberg I'm not sure if there is an easy/clean way to add a builder other than overriding |
I ended up overriding the Hyrax::WorksControllerBehavior#manifest method in our Image controller - building the json, and then attaching the thumbnail info at the end before rendering it. module Hyrax
class ImagesController < CatalogController
include Hyrax::WorksControllerBehavior
self.curation_concern_type = ::Image
self.show_presenter = Hyrax::ImagePresenter
###
# Adds thumbnails to the IIIF Manifest for images.
def manifest
headers['Access-Control-Allow-Origin'] = '*'
manifest_json = manifest_builder.to_h
manifest_json['thumbnail'] = { '@id' => thumbnail }
render json: manifest_json
end
private
###
# Gets the external thumbnail path of a resource.
def thumbnail
thumbnail_path = Hyrax::ThumbnailPathService.call(@presenter).slice(1..-1)
root_url + thumbnail_path
end
end
end I'm open to better ways of doing this, if you can think of any! I hope this helps. |
Hello, this is more of a question than a issue, but is there any way to cleanly add a builder to this process?
I need to add thumbnail support to the manifest and I know I can overwrite things and all that, but I was hoping there was a place where I could just insert my own builder and let the code run as intended.
I'm happy to clarify, if I'm not being clear. Thanks.
The text was updated successfully, but these errors were encountered: