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
Dependent birth year warning #186829970 #4458
Closed
Closed
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
0b3dc8f
Reordered options, bolded text
tofarr 30f9d2e
Bolded text, reordered options
tofarr 2344e73
Merge branch 'main' into nyc-county-warning-#187296817
tofarr 2174fcb
County warning
tofarr 0f83818
I18n fixes
tofarr ff4649f
I18n Fixes
tofarr c2be6b9
I18n Spec fixes
tofarr 36bd35e
Using rails script tag
tofarr b73f5a4
Updated names for clarity
tofarr f3eb6b6
Style update
tofarr 30ea2d1
Select warning component
tofarr 1a90540
Integration with form builder
tofarr 5048db2
Clearer name
tofarr 71a73b6
Renamed for clarity
tofarr 69095cb
More progressive enhancement
tofarr 0e2df98
Controller page cleanup
tofarr f0267d7
More cleanup
tofarr f50c21f
Added a little flair
tofarr 3965c5a
Fix copypasta
tofarr 22c1bda
Permitted fix
tofarr 7fd7ebb
Fixed headers
tofarr 5da8deb
Updates
tofarr 32220c5
Fixed copy
tofarr ed4134d
Merge branch 'main' into nyc-county-warning-#187296817
tofarr 9ccefb0
Merge branch 'main' into nyc-county-warning-#187296817
tofarr 026d496
Spec fixes
tofarr 2c883b9
Using content_tag instead of raw html
tofarr 675f51b
Fix spec
tofarr a1cd39d
Spec fix
tofarr 72591cb
Annotation updates
tofarr 526125e
Merge branch 'main' into nyc-county-warning-#187296817
tofarr 30ba970
WIP
tofarr 50d7a25
WIP
tofarr 8127931
WIP
tofarr 75c1902
Merge branch 'nyc-county-warning-#187296817' into dependent-birth-yea…
tofarr 13a0600
WIP
tofarr 590471f
Dependend birth year warning #186829970
tofarr bf6068b
WIP
tofarr a1c3984
Merge branch 'main' into dependent-birth-year-warning-#186829970
tofarr 60c5a94
WIP
tofarr 5ac1e19
WIP
tofarr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
export default function WarningForDateComponent() { | ||
const warningElements = document.querySelectorAll("[data-warning-for-date]"); | ||
warningElements.forEach((warningElement) => { | ||
let { minDate, warningForDate, requiredYear } = warningElement.dataset; | ||
minDate = new Date(minDate); | ||
const fields = ["year", "month", "day"].map((f) => { | ||
return document.querySelector(`[name="${warningForDate}[dob_${f}]"]`); | ||
}); | ||
|
||
function show(){ | ||
if (requiredYear) { | ||
const selectedYear = fields[0].value; | ||
return selectedYear && selectedYear !== requiredYear; | ||
} | ||
const date = new Date(...fields.map((s) => { | ||
return parseInt(s.value); | ||
})) | ||
return date.getTime() < minDate.getTime(); | ||
} | ||
function render(){ | ||
$(warningElement)[show() ? "show" : "hide"]("slow"); | ||
} | ||
|
||
fields.forEach((f) => { | ||
f.addEventListener("change", render); | ||
}) | ||
render(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Left a comment in #4463