inveniosoftware / invenio-app-rdm

Turn-key research data management platform.
https://inveniordm.docs.cern.ch
MIT License
96 stars 137 forks source link

Custom field accordion behavior #2325

Open tmorrell opened 11 months ago

tmorrell commented 11 months ago

Is your feature request related to a problem? Please describe.

I'd like to customize the custom field accordions in the deposit form so they are closed by default. Ideally this would be a parameter you could set in invenio.cfg, but I'm customizing other javascript so some sort of override would also be fine.

Describe the solution you'd like

The custom field accordion closing behavior is defined by active in react-invenio-forms https://github.com/inveniosoftware/react-invenio-forms/blob/176c6367a31fb37d6ae60cf65daf396f0a4acdcd/src/lib/forms/widgets/custom_fields/CustomFields.js#L54. It's a super-easy one line change, but I don't know how customize and integrate it with a production instance. Having it broken out as a parameter would be ideal, but I know that's a more complicated improvement.

ntarocco commented 3 months ago

Possible solution: in the config.py, add a new field to make the section automatically collapsed or not when rendering the form. Then, inject the field in the React props.

AUDIOVIS_FIELDS_UI = {
    "section": _("Audiovisual core"),
    "icon": "camera",
    "hide_from_upload_form": False,
    "discoverable_fields": True,  
+    "default_collapsed": True,
github-actions[bot] commented 1 month ago

This issue was automatically marked as stale.