-
Notifications
You must be signed in to change notification settings - Fork 13
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
Other income additional comments prefix for page 2 13614c #5620
base: main
Are you sure you want to change the base?
Other income additional comments prefix for page 2 13614c #5620
Conversation
Heroku app: https://gyr-review-app-5620-8caad679cdd4.herokuapp.com/ |
…on-of-other-income-types-value-for-ty-2024
@@ -29,7 +29,7 @@ def selected_orgs_and_sites | |||
if model.instance_of? Site | |||
model = available_by_id[model.parent_organization_id] | |||
end | |||
model.coalition_id == selected_model.id | |||
model&.coalition_id == selected_model.id |
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.
unrelated to this ticket but noticed this will cause this page to crash sometimes; model is nil when can't find model on available_by_id[model.parent_organization_id]
} | ||
}); | ||
}); | ||
</script> |
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 see we have a label_and_field
method which allows a prefix
in honeycrisp that is used by cfa_textarea
although cfa_textarea
does not pass through a prefix option -- if that was an available option, would that have been a good solution to creating a prefix? Could we create a vita_min_textarea
and then create a ticket to update honeycrisp to allow adding a prefix?
@@ -391,7 +391,7 @@ | |||
|
|||
expect(intake.cv_other_income_cb_yes?).to eq true | |||
|
|||
expect(intake.cv_p2_notes_comments).to eq "Hello" | |||
expect(intake.cv_p2_notes_comments).to eq "additional income from banana stand" |
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.
should we see "Other money received during the year includes:" text anywhere in the feature specs?
|
||
textArea.addEventListener("input", function() { | ||
if (!this.value.startsWith(prefix)) { | ||
this.value = prefix + this.value.replace(prefix, ''); |
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.
can this.value
be nil
?
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.
Tried to look it up online but I don't think so; nil would only occur if the parameter is not included at all in the submitted form data (like if the field is removed via JavaScript before submission)
|
||
textArea.form.addEventListener("submit", function() { | ||
if (textArea.value.startsWith(prefix)) { | ||
textArea.value = textArea.value.replace(prefix, '').trim(); |
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.
can textArea.value
be nil
? Or is it guaranteed to be ""
?
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 think its guaranteed to be at least "", I'm not sure how to check though
form = described_class.new(client, form_attributes) | ||
form.save | ||
intake.reload | ||
end.to change(intake, :had_wages).to "yes" |
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.
how come had_wages
is treated differently from all the other attributes?
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 could do a long chain of .and change(
for the rest of the changes but I decided to use the other pattern and just establish that at least one had changed on the form save; I could just change to use one or the other if its confusing though
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.
couple questions, just want to understand better!
Hey @embarnard , thanks for tackling this! Some good comments here from @arinchoi03 . Zooming out a bit, a couple things didn't seem to work quite right:
GIF showing the backspace behavior: Good news, i think there's a simpler way to do all of this (without JavaScript
There's a sorta-kinda similar thing happening in I love the JavaScript idea, I that that was cool actually! 🥞 , but yeah, i think at On a separate note, about the switch to using And definitely let me know if you think I missed / misunderstood something here. |
…on-of-other-income-types-value-for-ty-2024
@spompea-cfa Oh oops I didn't check the Which brings us to a dilemma of which one to use. I'm leaning towards the original So the way that the javascript is working is that it inserts it into the field if its not there but also removes the prefix on submit so that we are not actually saving the prefix into the the field. Thats why if you try to remove it it will insert it back into the page. It's not a bug, it's intentional but I agree it might be frustrating or confusing if someone want to remove it. I could instead just insert it upon page load instead of always listening to that element to see if its in there. I don't understand how the option of only putting it into the If we want to make this prefix editable then I guess we could just insert it anytime the value of Thanks so much for the review and all your extensive notes! |
Link to pivotal/JIRA issue
Is PM acceptance required? (delete one)
Reminder: merge main into this branch and get green tests before merging to main
What was done?
How to test? Heroku env
Screenshots (for visual changes)