Skip to content

fix(questionnaire): read & accept error placement now in correct location #525

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

Merged
merged 2 commits into from
Jan 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/assets/javascripts/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ document.addEventListener('turbolinks:load', function() {
switch (types[i]) {
case 'presence':
if (!value || $.trim(value).length < 1) {
if ($(this).parents('.agreement_input')) {
notify('.agreement_input', 'Please read & accept');
if ($(this).hasClass("agreement_input")) {
notify($(this).parent(), 'Please read & accept');
} else {
notify(this, 'Missing Information');
}
Expand Down Expand Up @@ -74,7 +74,9 @@ document.addEventListener('turbolinks:load', function() {
.fadeOut(200, function() {
$(this).remove();
});
$(".agreement_input")
// this removes the notification for agreements
$(this)
.parent()
.parent()
.removeClass('field_with_errors')
.find('.error')
Expand Down
2 changes: 2 additions & 0 deletions app/assets/stylesheets/forms/_forms.sass
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ hr
@include css4
color: var(--grey)
.error
display: inline-block
width: 100%
@include css4
background: var(--input--error--background)
color: var(--input--error--text)
Expand Down
3 changes: 1 addition & 2 deletions app/views/questionnaires/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
%strong Agreements
%p Please review the agreements and click the corresponding checkbox next to each agreement to agree.
.form-inputs
.agreement_input
= f.association :agreements, as: :check_boxes, label_method: :formatted_agreement, value_method: :id, label: "", wrapper_html: { style: 'display: block' }, input_html: { "data-validate" => "presence" }
= f.association :agreements, as: :check_boxes, label_method: :formatted_agreement, value_method: :id, label: "", wrapper_html: { style: 'display: block' }, input_html: { "data-validate" => "presence", class: "agreement_input"}

.right
%button.button{ type: "button", "data-wizard" => "previous" } Previous
Expand Down