-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
add-user-role-modal.js
58 lines (53 loc) · 1.29 KB
/
add-user-role-modal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import classic from 'ember-classic-decorator';
import { action } from '@ember/object';
import FormMixin from 'open-event-frontend/mixins/form';
import ModalBase from 'open-event-frontend/components/modals/modal-base';
@classic
export default class AddUserRoleModal extends ModalBase.extend(FormMixin) {
isSmall = true;
autoScrollToErrors = false;
@action
addRole() {
this.onValid(() => {
this.addUserRoles();
});
}
@action
close() {
if (!this.currentInvite.get('id')) {
this.currentInvite.unloadRecord();
}
this.set('isOpen', false);
}
getValidationRules() {
return {
inline : true,
delay : false,
on : 'blur',
fields : {
email: {
identifier : 'user_email',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter an email for user')
},
{
type : 'email',
prompt : this.l10n.t('Please enter a valid email address for user')
}
]
},
role: {
identifier : 'user_role',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please select a role')
}
]
}
}
};
}
}