-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[296] Evaluation Form Validation - Part 2 (#327)
* 296 Inline error unique titles and weighted scores * 296 Newly added criteria collapse existing * 296 Criteria is exapnded if it has errors on save * 296 Simplify validate presence function * 296 Change weighted_scoring to scale_type string * 296 Override default phase presence error for form --------- Co-authored-by: Stephen Chudleigh <[email protected]> Co-authored-by: Stephen Chudleigh <[email protected]>
- Loading branch information
1 parent
e1ce5be
commit 0788919
Showing
25 changed files
with
428 additions
and
287 deletions.
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.