Skip to content

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

Merged
merged 1 commit into from
Jul 22, 2025

Conversation

aaron-collier
Copy link
Contributor

@aaron-collier aaron-collier commented Jul 11, 2025

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:
Screenshot 2025-07-15 at 2 22 34 PM

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.

Screenshot 2025-07-15 at 2 22 47 PM

@aaron-collier aaron-collier force-pushed the t329-author-affiliations branch 3 times, most recently from 9eb97c2 to 3251387 Compare July 14, 2025 21:03
@aaron-collier aaron-collier force-pushed the t329-author-affiliations branch 7 times, most recently from 83e0803 to 5a700c5 Compare July 15, 2025 21:22
@aaron-collier aaron-collier changed the title [DRAFT] Contributor affiliation updates to work form Add contributor affiliation updates to work form Jul 15, 2025
@aaron-collier aaron-collier marked this pull request as ready for review July 15, 2025 21:26
Copy link
Contributor

@justinlittman justinlittman left a 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') %>
Copy link
Contributor

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?

Copy link
Contributor Author

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))
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@aaron-collier aaron-collier force-pushed the t329-author-affiliations branch 2 times, most recently from f8091fa to 3259fdd Compare July 16, 2025 20:21
@justinlittman justinlittman force-pushed the t329-author-affiliations branch 2 times, most recently from 27a5f86 to fa2e473 Compare July 18, 2025 19:29
@justinlittman justinlittman force-pushed the t329-author-affiliations branch from 48ef57d to 73485bc Compare July 22, 2025 12:45
@justinlittman justinlittman merged commit 452a6c0 into main Jul 22, 2025
8 checks passed
@justinlittman justinlittman deleted the t329-author-affiliations branch July 22, 2025 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Author affiliations
2 participants