Skip to content

Commit b32c89f

Browse files
mrsaicharan1mariobehling
authored andcommitted
Merged contact info with profile (#3146)
removed additional fields Changed to async-await style Removed finally clause Updated UI
1 parent 7cbf3fe commit b32c89f

File tree

13 files changed

+73
-69
lines changed

13 files changed

+73
-69
lines changed

app/components/forms/user-profile-form.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Component from '@ember/component';
22
import FormMixin from 'open-event-frontend/mixins/form';
3+
import { validPhoneNumber } from 'open-event-frontend/utils/validators';
34

45
export default Component.extend(FormMixin, {
56

@@ -27,6 +28,33 @@ export default Component.extend(FormMixin, {
2728
prompt : this.l10n.t('Please enter your family name')
2829
}
2930
]
31+
},
32+
email: {
33+
identifier : 'email',
34+
rules : [
35+
{
36+
type : 'empty',
37+
prompt : this.l10n.t('Please enter your email ID')
38+
},
39+
{
40+
type : 'email',
41+
prompt : this.l10n.t('Please enter a valid email ID')
42+
}
43+
]
44+
},
45+
phone: {
46+
identifier : 'phone',
47+
rules : [
48+
{
49+
type : 'empty',
50+
prompt : this.l10n.t('Please enter a phone number.')
51+
},
52+
{
53+
type : 'regExp',
54+
value : validPhoneNumber,
55+
prompt : this.l10n.t('Please enter a valid phone number.')
56+
}
57+
]
3058
}
3159
}
3260
};

app/controllers/account/contact-info.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

app/controllers/account/profile.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
import Controller from '@ember/controller';
22

33
export default Controller.extend({
4+
actions: {
5+
async updateContactInfo() {
6+
this.set('isLoading', true);
7+
try {
8+
await this.model.save();
9+
this.notify.success(this.l10n.t('Your Contact Info has been updated'));
10+
} catch (error) {
11+
this.notify.error(this.l10n.t(error.message));
12+
}
13+
this.set('isLoading', false);
14+
}
15+
}
416
});

app/router.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ router.map(function() {
107107
});
108108
this.route('account', function() {
109109
this.route('profile');
110-
this.route('contact-info');
111110
this.route('password');
112111
this.route('email-preferences');
113112
this.route('applications');
@@ -160,7 +159,7 @@ router.map(function() {
160159
});
161160
this.route('account', function() {
162161
this.route('applications');
163-
this.route('contact-info');
162+
this.route('profile');
164163
this.route('email-preferences');
165164
});
166165
this.route('tickets', function() {

app/routes/account/contact-info.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/routes/account/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import Route from '@ember/routing/route';
33
export default Route.extend({
44
beforeModel() {
55
this._super(...arguments);
6-
this.transitionTo('account.contact-info');
6+
this.transitionTo('account.profile');
77
}
88
});

app/templates/account.hbs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
{{#link-to 'account.profile' class='item'}}
55
{{t 'Profile'}}
66
{{/link-to}}
7-
{{#link-to 'account.contact-info' class='item'}}
8-
{{t 'Contact Info'}}
9-
{{/link-to}}
107
{{#link-to 'account.billing-info' class='item'}}
118
{{t 'Billing Info'}}
129
{{/link-to}}

app/templates/account/contact-info.hbs

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/templates/account/profile.hbs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
<div class="ui stackable grid">
2-
<div class="sixteen wide column">
3-
{{unverified-user-message}}
4-
</div>
5-
</div>
6-
<div class="ui container">
1+
<div class="sixteen wide column">
2+
{{unverified-user-message}}
73
{{forms/user-profile-form user=model isLoading=isLoading}}
84
</div>

app/templates/admin/users/view/account.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="sixteen wide column">
55
{{#tabbed-navigation}}
66
{{#link-to 'admin.users.view.account.contact-info' model.user.id class='item'}}
7-
{{t 'Contact Info'}}
7+
{{t 'Profile Info'}}
88
{{/link-to}}
99
{{#link-to 'admin.users.view.account.email-preferences' model.user.id class='item'}}
1010
{{t 'Email-Preferences'}}

0 commit comments

Comments
 (0)