Skip to content
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

Creatibutor form update #81

Merged
merged 3 commits into from
Nov 8, 2024
Merged

Creatibutor form update #81

merged 3 commits into from
Nov 8, 2024

Conversation

cc-a
Copy link
Collaborator

@cc-a cc-a commented Oct 24, 2024

This PR hides the role field for the creator form field and adds help text beneath both the creator and contributor form fields. The third item referenced in the issue is to make the search field within the modal more obvious as a search field but I believe the root cause of this issue is that the placeholder text is hidden. I've added a comment to #68 as this appears to be closely related.

The implementation subclasses the relevant form components from invenio_rdm_records in order to override render methods and update the logic. It creates the OptionalRoleCreatibutorsField class (and equivalents for other components) that allows control of the rendering of the role field based on the includeRole prop. It also adds a helpText prop and renders this. In mapping.js it then parametrizes the class with appropriate includeRole and helpText prop values for the creator and contributor fields and overrides the components in the deposit form.

Overall the implementation is pretty horrible hence why it's been left in draft and requires copying quite a lot of code for the render method of relevant form components from invenio_rdm_records as there is no clean extension point to hook into for rendering of the role field. Adding just the help text could be done much more cleanly via subclassing as . This implementation will be brittle w.r.t updates of InvenioRDM version.

All in all I'm open to other suggestions. If we could get some of this (most notably hiding the role field) pulled into invenio_rdm_records then that would be cleanest from our point of view.


Enter a brief description of the PR contents here

Developer Checklist

Developers should review and confirm each of these items before requesting review

  • Code meets acceptance criteria from issue
  • Unit tests are written and all pass
  • User Test Scripts (if required) are written and have been run through
  • Code documentation and related non-code documentation has all been updated

Reviewer Checklist

Reviewers should review and confirm each of these items before approval
If there are multiple reviewers, this section can be duplicated for each reviewer

  • Code meets acceptance criteria from issue
  • Unit tests are written and all pass
  • User Test Scripts (if required) are written and have been run through
  • Code documentation and related non-code documentation has all been updated
  • Migation has been created and tested

Testing

List user test scripts that need to be run

List any non-unit test scripts that need to be run

@cc-a cc-a requested review from Steven-Eardley and J4bbi October 31, 2024 14:33
@cc-a cc-a marked this pull request as ready for review November 5, 2024 14:18
Copy link
Collaborator

@Steven-Eardley Steven-Eardley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look good - I've spun this up and it works as intended. I agree the degree of copying and overwriting is suboptimal, but this is the only mechanism we have for now.

The role if provided via API will be visible over API, but that's fine for now. It's an optional field.

@cc-a
Copy link
Collaborator Author

cc-a commented Nov 8, 2024

Great. I'm going to create an issue to keep track of the inconsistency with the API for later resolution.

@cc-a cc-a merged commit 5df42b8 into develop Nov 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants