Skip to content

Commit

Permalink
Merge pull request #320 from enoodle/feat/person_email_validation_mes…
Browse files Browse the repository at this point in the history
…sage

email verification: add small message under input
  • Loading branch information
enoodle authored Feb 10, 2019
2 parents 5489bfb + 163c5e1 commit ed207c1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/assets/stylesheets/forms.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
.email_invalid {
background-color: lighten($c-red, 30%) !important;
}
.nested_email_error{
font-size: 12px;
color: lighten($c-red, 30%);
.hidden {
visibility: hidden;
}
.visible {
visibility: visible;
}
}

.menu-heading {
height: 79px;
Expand Down
7 changes: 7 additions & 0 deletions app/views/camps/_person_fields.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
const email_field = event.target;
if (email_field.value != '') {
verify_email(email_field.value, function (valid) {
msg = email_field.parentElement.querySelector('.nested_email_error');
if (!valid) {
email_field.classList.remove("email_valid");
email_field.classList.add("email_invalid");
msg.classList.remove("hidden");
msg.classList.add("visible");
} else {
email_field.classList.remove("email_invalid");
email_field.classList.add("email_valid");
msg.classList.add("hidden");
msg.classList.remove("visible");
}
});
}
Expand Down Expand Up @@ -42,6 +47,8 @@
= f.label :email
- if (@can_edit)
= f.text_field :email, class: 'form-control person_email', onfocusout: 'verify_person_email(event)'
.nested_email_error.hidden
= t("email_not_in_spark_small")
- else
= f.text_field :email, class: 'form-control', readonly: true
= f.label :phone_number
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ en:
new_dream_is_disabled: Creating new dreams is disabled at the moment. If you think
this is a mistake please contact bureau of dreams
email_not_in_spark: Sorry, but we couldn't find a Midburn profile associated with
email_not_in_spark_small: Sorry, but we couldn't find a Midburn profile associated with this email.
dont_miss_out:
banner: Don't miss out! Only %{time} left to %{action}
actions:
Expand Down
1 change: 1 addition & 0 deletions config/locales/he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ he:
# Errors
new_dream_is_disabled: "יצירת חלומות חדשים מנוטרלת כרגע. אם אתה חושב שזאת שגיאה אנא צור קשר עם לשכת החלומות"
email_not_in_spark: "אופס! לא מצאנו פרופיל מידברן מקושר למייל: "
email_not_in_spark_small: "אופס! לא מצאנו פרופיל מידברן מקושר למייל"

time:
am: am
Expand Down

0 comments on commit ed207c1

Please sign in to comment.