Commit b046bb63 authored by Cliff Li's avatar Cliff Li Committed by Sandro Lutz
Browse files

Add success/error message for email signup.

parent 8fdfe11e
......@@ -144,6 +144,8 @@
"events.delete_signup": "Anmeldung löschen",
"events.loading": "Laden...",
"events.load_more": "Mehr Events laden",
"events.emailsignup_success": "Anmeldung erfolgreich.",
"events.emailsignup_fail": "Anmeldung fehlgeschlagen. Probier es später wieder.",
"companies.contact_information": "Kontakt-Informationen",
"companies.email": "Email",
"companies.phone": "Telefon",
......
......@@ -159,6 +159,8 @@
"errors.not_found.text": "The page you are looking for could not be found.",
"errors.translation_unavailable": "Translation not available.",
"errors.shown_language": "Showing text in %{shown_language}",
"events.emailsignup_success": "Sign up successful.",
"events.emailsignup_fail": "Sign up failed. Try again later.",
"filtered_list.show_filter": "Show filter",
"filtered_list.hide_filter": "Hide filter",
"filtered_list.show_list": "Back to the list"
......
......@@ -23,6 +23,7 @@ class EventSignupForm extends JSONSchemaForm {
this.email = '';
this.emailErrors = [];
this.emailValid = false;
this.emailSignup = null;
if (isLoggedIn()) {
this.event.loadSignup().then(() => {
if (this.event.signupData) {
......@@ -35,8 +36,10 @@ class EventSignupForm extends JSONSchemaForm {
async signup() {
try {
await this.event.signup(super.getValue(), this.email);
this.emailSignup = 'success';
} catch (err) {
log(err);
this.emailSignup = 'fail';
}
}
......@@ -71,10 +74,15 @@ class EventSignupForm extends JSONSchemaForm {
}
return m('form', { onsubmit: () => false }, elements);
} else if (this.event.allow_email_signup) {
const elements = this.renderFormElements();
elements.push(this._renderEmailField());
elements.push(this._renderSignupButton());
return m('form', { onsubmit: () => false }, elements);
if (!this.emailSignup) {
const elements = this.renderFormElements();
elements.push(this._renderEmailField());
elements.push(this._renderSignupButton());
return m('form', { onsubmit: () => false }, elements);
} else if (this.emailSignup) {
if (this.emailSignup === 'success') return m('span', i18n('events.emailsignup_success'));
if (this.emailSignup === 'fail') return m('span', i18n('events.emailsignup_fail'));
}
}
return m('div', [
m('span', `${i18n('events.amiv_members_only')} `),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment