-
Notifications
You must be signed in to change notification settings - Fork 1
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
[296] Evaluation Form Validation - Part 2 #327
Merged
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
bfd87c5
296 Initial pass at inline errors for eval form
cpreisinger 44ef23f
296 Inline error unique titles and weighted scores
cpreisinger de30760
296 Newly added criteria collapse existing
cpreisinger 120a70a
296 Criteria is exapnded if it has errors on save
cpreisinger ea655eb
296 Simplify validate presence function
cpreisinger 94d07bf
296 Fix test and codeclimate issues
cpreisinger 2da8255
296 Rubocop whitespace failures
cpreisinger c8f02bf
296 Change weighted_scoring to scale_type string
cpreisinger 0dc5921
296 Override default phase presence error for form
cpreisinger ad63854
adjust error rendering
stepchud 8cb8488
cognitive complexity
stepchud c947eed
linter
stepchud 7ef417d
Update app/views/evaluation_forms/_form.html.erb
stepchud c431476
fix header-level skipped a11y warning
stepchud 7cead81
Merge branch 'dev' into 296/evaluation-form-validation-part-2
stepchud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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,22 @@ | ||
# frozen_string_literal: true | ||
|
||
# Helpers for rendering various form elements and errors | ||
module FormHelper | ||
def label_error_class(form, field) | ||
object = form.object | ||
object.errors[field].present? ? "text-secondary" : "" | ||
end | ||
|
||
def input_error_class(form, field) | ||
object = form.object | ||
object.errors[field].present? ? "border-secondary" : "" | ||
end | ||
|
||
def inline_error(form, field) | ||
object = form.object | ||
field_id = (form.object_name + "_#{field}_error").gsub(/[\[\]]/, "_").squeeze('_') | ||
error = object.errors[field].present? ? object.errors[field].join(", ") : "" | ||
|
||
tag.span(error, class: "text-secondary font-body-2xs", id: field_id) | ||
end | ||
end |
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.
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.
this isn't necessary, the helpers are automatically included on every controller