geobtaa / geoblacklight_admin

MIT License
3 stars 2 forks source link

Is it possible to add new value in dct_references_s field in form editor #28

Closed yalamber closed 8 months ago

yalamber commented 8 months ago

I am trying to add new values in the references and also add new item viewer based on the selected value. I want to add deepzoom viewer like https://openseadragon.github.io/ that supports DZi images, I am confused on if I should just aadd new form element or add addiotional option in dct_references_s that will allow users to add DZI images as well.

Screenshot 2023-11-23 at 16 24 01
ewlarson commented 8 months ago

Hi @yalamber / Great question! That field, dct_references_s. is a little magical...

You'll need to do two things to accomplish this goal:

  1. Add the new dct_references_s key for DZI items The geoblacklight_admin/app/models/geoblacklight_admin/schema.rb file configures the list of dct_reference_s keys. You'll need to override this file locally — or you could submit a PR to move these mappings/values into a configurable file (settings.yml maybe or a json file)

  2. Override the GeoBlacklight side of the application to add the new item viewer You'll need to override the default GeoBlacklight::ItemViewer. Here's how I do that in the BTAA Geoportal We added the b1g_image method and added it to the viewer_preference array.

You'll also need to write the JS class that displays the deepzoom object, something similar to this GeoBlacklight.Viewer.B1gImage code.

I hope this helps! Let me know if you have any additional questions. In the meantime, I'm going to close this issue and open a new one to make dct_references_s keys/options configurable.

yalamber commented 8 months ago

Once we change the schema do we need to run migrations?

yalamber commented 8 months ago

do we need to modify reference model as well? https://github.com/geobtaa/geoblacklight_admin/blob/83e24abf4d5743220c9a9bc99ae8ccab4dc79ade/app/models/document/reference.rb#L83

ewlarson commented 8 months ago
  1. No need to run db migrations — this is not DB schema.
  2. And, yes, you will need to modify the reference model as well — I'll add that file to the new issue.