-
Notifications
You must be signed in to change notification settings - Fork 0
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
[74] Enter Evaluators A11y Fix #343
base: dev
Are you sure you want to change the base?
Conversation
app/views/evaluators/index.html.erb
Outdated
<p>Create and manage a list of evaluators for the challenge.</p> | ||
<h2 class="padding-top-3">Add Evaluators</h2> | ||
<p>Evaluators will not be assigned to submissions until you assign in the submission detail view.</p> | ||
<%= form_with(model: EvaluatorInvitation.new, url: phase_evaluators_path(@phase), method: :post, local: true) do |form| %> | ||
<%= form_with(model: @evaluator_invitation || EvaluatorInvitation.new, url: phase_evaluators_path(@phase), method: :post, local: true, data: { controller: "evaluator-form modal" }, html: { novalidate: true }) do |form| %> |
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.
the evaluator-form
stimulus controller doesn't exist, did you mean to use evaluation-form
controller?
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.
since you're using the evaluation-form#validatePresence
function here, I think it would be good to extract that functionality into a separate controller to be used in both places. the rest of the EvaluationFormController related to the EvaluationForm fields can stay there. that way we'll have a reusable form validation controller for other stimulus forms.
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.
The missing inline error message is probably a blocker given the requirements. Plus some other suggestions to improve the design.
end | ||
|
||
handle_failed_invitation(result) |
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 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.
The first screenshot is also missing the inline error text label describing the issue.
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.
@@ -44,6 +45,24 @@ def resend_invitation(invitation) | |||
|
|||
private | |||
|
|||
def update_name_for_existing_user(user) | |||
names = @invitation_params[:full_name].to_s.strip.split(/\s+/, 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.
I feel like it's potentially problematic to duplicate this field parsing logic with the EvaluatorInvitation model, in case things change in the future. Can you extract these into a single function? Something like User.split_full_name(full_name) => [first, last]
For the validation error message, you can just have a method that adds those errors directly to the model if first_name
or last_name
are blank. Actually it might be even easier to build a fake EvaluatorInvitation model first (without saving), check if it's valid, and if so then update the user. If it's invalid you can return the invalid Invitation with its errors. That way you're reusing the Invitation name splitting logic and you can get the invitation's first_name/last_name to update the User when the name is valid. WDYT?
Related ticket: #200 #74
Figma
Changes made in this PR:
when adding that user as an evaluator to a challenge phase,
then require and update the user with the provided first and last name.
Updated UI
Validation errors
Empty form
Only a first name
Missing last name
User with invalid role
Required first and last name for existing user
Existing user without first and last name updated with name entered
Mobile
WAVE