-
Notifications
You must be signed in to change notification settings - Fork 0
Add contributor affiliation updates to work form #1659
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
Conversation
9eb97c2
to
3251387
Compare
83e0803
to
5a700c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can help with the formatting once the logic is sorted.
It seems like in the case in which a user doesn't select an entry, it should be ignored instead of causing a URI validation error.
<div class="row"> | ||
<div class="col"> | ||
<div data-controller="invalid-feedback" data-invalid-feedback-tab-error-outlet=".tab-error" data-invalid-feedback-tab-value="affiliations"> | ||
<%= render Elements::Forms::InvalidFeedbackComponent.new(form:, field_name: :uri, data: { invalid_feedback_target: 'feedback' }, classes: 'mb-2') %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why invalid feedback on the URI and not the institution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was that institution being populated doesn't necessarily mean they properly selected a value from the ROR return. Though, for the UI - it may be the best place for it. I'll take a pass at it.
@@ -19,7 +19,7 @@ export default class extends Controller { | |||
if (!this.hasContainerTarget) return | |||
this.containerTarget.querySelectorAll('.form-instance').forEach((instanceEl, index) => { | |||
instanceEl.querySelectorAll('.move-up').forEach((btnEl) => btnEl.classList.toggle('d-none', index === 0)) | |||
instanceEl.querySelectorAll('.move-down').forEach((btnEl) => btnEl.classList.toggle('d-none', index === this.instanceTargets.length - 1)) | |||
instanceEl.querySelectorAll('.move-down').forEach((btnEl) => btnEl.classList.toggle('d-none', index === this.instanceTargets.length - 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are now 2 forms for every person type contributor, so currently the -1
is what hides the move up/move down buttons when there is only a single entry. This doesn't work now with a person contributor as there are 2 forms, so we have to -2
here.
f8091fa
to
3259fdd
Compare
27a5f86
to
fa2e473
Compare
48ef57d
to
73485bc
Compare
Taking this out of draft for review.
Fixes #329
(cc: @justinlittman) I think this is ready for review with 2 notable styling issue that I could use help with:
I can't seem to get the trashcan icon to the right of the affiliation form:

I'm wondering how to go about changing this validation message to something useful. The validation is actually based on the hidden URI field and happens if the user enters a value but does not select from the pull down to get the ROR URI, therefore causing a validation error for the affiliation URI. I'm thinking it should say something like "please select a valid institution from the drop down" or something.