Open ShanaLMoore opened 3 months ago
Currently, the Based Near that shows up on the show page should be Location and reads from based_near_label solr property
The problem is in the form in works_controller_behavior
method build_form
. The form being built and validated doesn't have a location object so it validates and updates the form incorrectly.
when the form goes to validate @fields contains
"based_near"=>
#<ActionController::Parameters {"0"=>#<ActionController::Parameters {"hidden_label"=>"Northern Europe, ", "id"=>"https://sws.geonames.org/7729883/", "_destroy"=>""} permitted: false>} permitted: false>,
The form needs to contain
"based_near"=>[#<Hyrax::ControlledVocabularies::Location:0x67944 ID:_:g413400>],
The initial build of the form should include the based_near location object. In our branch it doesn't.
In Hyrax::FormFactory, prepopulate!
is not filling in the value for based_near
in the call to Valkyrie's change_set
Tabled for now as a known bug, to work on higher priority issues.
Summary
Details
ON MAIN - A user is able to add a location to a work.
Add new work > pick a work type Add required fields. Click 'Additional Fields' Find the location property. In the drop down, type in a city name. Select one from the auto populated list. Submit the work
Based_near will be displayed on the work's show page.
Click to edit the work. The location property will display the selected city:
ON flexible_double_combo ...
How it looks when saved:
We noticed that the params look weird after the form get validated here. Diff from main is that it includes several #<ActionController::Parameters within the nested params. Is that a problem?
Dev Notes
Make sure geonames is configured. Otherwise, the drop down will not find any results.
In .koppie/config/intitializers/hyrax.rb update the following to:
This diff Avoids the error about invalid type when saving based_near property on flexible_double_combo. I'm not sure if it's the correct approach. Related PR