Skip to content
15 changes: 12 additions & 3 deletions app/controllers/account/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,22 @@ export default Controller.extend({
this.loader
.post('/auth/change-password', payload)
.then(() => {
this.notify.success(this.l10n.t('Password updated successfully'));
this.notify.success(this.l10n.t('Password updated successfully'),
{
id: 'pass_upd_succ'
});
})
.catch(error => {
if (error.errors) {
this.notify.error(this.l10n.t(`${error.errors[0].detail}`));
this.notify.error(this.l10n.t(`${error.errors[0].detail}`),
{
id: 'err_pass_ser'
});
} else {
this.notify.error(this.l10n.t('Unexpected error. Password did not change.'));
this.notify.error(this.l10n.t('Unexpected error. Password did not change.'),
{
id: 'err_unex_pass'
});
}
})
.finally(() => {
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/account/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ export default Controller.extend({
this.set('isLoading', true);
try {
await this.model.save();
this.notify.success(this.l10n.t('Your Contact Info has been updated'));
this.notify.success(this.l10n.t('Your Contact Info has been updated'),
{
id: 'cont_info_upd'
});
} catch (error) {
this.notify.error(this.l10n.t(error.message));
this.notify.error(this.l10n.t(error.message),
{
id: 'cont_upd_error'
});
}
this.set('isLoading', false);
}
Expand Down
25 changes: 20 additions & 5 deletions app/controllers/admin/content/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export default Controller.extend({
this.set('disableEventSubtopic', false);
this.set('currentTopicSelected', topic);
} catch (e) {
this.notify.error(this.l10n.t('An unexpected error has occurred. SubTopics not loaded.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. SubTopics not loaded.'),
{
id: 'subtop_error'
});
} finally {
this.set('isLoading', false);
}
Expand All @@ -32,10 +35,16 @@ export default Controller.extend({
eventProp.destroyRecord()
.then(() => {
this.get(`model.${modelName}s`).removeObject(eventProp);
this.notify.success(this.l10n.t('This Event Property has been deleted successfully.'));
this.notify.success(this.l10n.t('This Event Property has been deleted successfully.'),
{
id: 'event_prop_del'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. Event Type was not deleted.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. Event Type was not deleted.'),
{
id: 'event_type_error'
});
})
.finally(() => {
this.set('isLoading', false);
Expand All @@ -47,10 +56,16 @@ export default Controller.extend({
modelInstance.save()
.then(() => {
this.get(`model.${camelCasedValue}s`).addObject(modelInstance);
this.notify.success(this.l10n.t(`${startCase(camelCasedValue)} has been added successfully.`));
this.notify.success(this.l10n.t(`${startCase(camelCasedValue)} has been added successfully.`),
{
id: 'mode_add_succ'
});
})
.catch(() => {
this.notify.error(this.l10n.t(`An unexpected error has occurred. ${startCase(camelCasedValue)} not saved.`));
this.notify.error(this.l10n.t(`An unexpected error has occurred. ${startCase(camelCasedValue)} not saved.`),
{
id: 'mode_err_succ'
});
})
.finally(() => {
this.set('isLoading', false);
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ export default Controller.extend({
let settings = this.model;
settings.save()
.then(() => {
this.notify.success(this.l10n.t('Social links have been saved successfully.'));
this.notify.success(this.l10n.t('Social links have been saved successfully.'),
{
id: 'social_link_upd'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. Social links not saved.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. Social links not saved.'),
{
id: 'unex_social_error'
});
})
.finally(() => {
this.set('isLoading', false);
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/content/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ export default Controller.extend({
if (this.isCreate) {
this.set('isFormOpen', false);
}
this.notify.success(this.l10n.t('Page details have been saved successfully.'));
this.notify.success(this.l10n.t('Page details have been saved successfully.'),
{
id: 'page_detail_succ'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. Page Details not saved.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. Page Details not saved.'),
{
id: 'page_detail_del'
});
});
}
}
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/content/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ export default class extends Controller {
anchor.href = URL.createObjectURL(new Blob([result], { type: 'octet/stream' }));
anchor.download = 'Translations.zip';
anchor.click();
this.notify.success(this.l10n.t('Translations Zip generated successfully.'));
this.notify.success(this.l10n.t('Translations Zip generated successfully.'),
{
id: 'zip_generated_succ'
});
} catch (e) {
console.warn(e);
this.notify.error(this.l10n.t('Unexpected error occurred.'));
this.notify.error(this.l10n.t('Unexpected error occurred.'),
{
id: 'zip_error'
});
}
this.set('isLoading', false);
}
Expand Down
30 changes: 24 additions & 6 deletions app/controllers/admin/events/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,16 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
try {
let event = this.store.peekRecord('event', this.eventId, { backgroundReload: false });
await event.destroyRecord();
this.notify.success(this.l10n.t('Event has been deleted successfully.'));
this.notify.success(this.l10n.t('Event has been deleted successfully.'),
{
id: 'event_del_succ'
});
} catch (e) {
console.warn(e);
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'event_delete_error'
});
}
this.setProperties({
isLoading : false,
Expand All @@ -146,10 +152,16 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
let event = this.store.peekRecord('event', event_id, { backgroundReload: false });
event.set('deletedAt', null);
await event.save({ adapterOptions: { getTrashed: true } });
this.notify.success(this.l10n.t('Event has been restored successfully.'));
this.notify.success(this.l10n.t('Event has been restored successfully.'),
{
id: 'event_restored'
});
} catch (e) {
console.warn(e);
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'restore_error'
});
}
this.set('isLoading', false);
}
Expand All @@ -161,11 +173,17 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
let event = this.store.peekRecord('event', event_id, { backgroundReload: false });
event.toggleProperty('isFeatured');
await event.save();
this.notify.success(this.l10n.t('Event details modified successfully'));
this.notify.success(this.l10n.t('Event details modified successfully'),
{
id: 'event_detail_changed'
});

} catch (e) {
console.warn(e);
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'event_det_error'
});
}
this.set('isLoading', false);
}
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ export default Controller.extend({
systemMessages.forEach(systemMessage => {
systemMessage.save();
});
this.notify.success(this.l10n.t('Changes have been saved successfully'));
this.notify.success(this.l10n.t('Changes have been saved successfully'),
{
id: 'message_success'
});
} catch (e) {
this.notify.error(this.l10n.t(e.errors[0].detail));
this.notify.error(this.l10n.t(e.errors[0].detail),
{
id: 'change_error_message'
});
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ export default Controller.extend({
let modules = this.model;
modules.save()
.then(() => {
this.notify.success(this.l10n.t('Settings have been saved successfully.'));
this.notify.success(this.l10n.t('Settings have been saved successfully.'),
{
id: 'setting_change'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'),
{
id: 'setting_not_change'
});
})
.finally(() => {
this.set('isLoading', false);
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/permissions/event-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ export default Controller.extend({
this.set('isLoading', true);
this.get('model.permissions').save()
.then(() => {
this.notify.success(this.l10n.t('Admin Event role permissions have been saved successfully.'));
this.notify.success(this.l10n.t('Admin Event role permissions have been saved successfully.'),
{
id: 'admin_event_succ'
});
})
.catch(err => {
this.notify.error(this.l10n.t(err));
this.notify.error(this.l10n.t(err),
{
id: 'admin_event_error'
});
})
.finally(() => {
this.set('isLoading', false);
Expand Down
35 changes: 28 additions & 7 deletions app/controllers/admin/permissions/system-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ export default Controller.extend({
this.set('isLoading', true);
role.destroyRecord()
.then(() => {
this.notify.success(this.l10n.t('System role has been deleted successfully.'));
this.notify.success(this.l10n.t('System role has been deleted successfully.'),
{
id: 'system_role_update'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. System role was not deleted.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. System role was not deleted.'),
{
id: 'system_role_error'
});
})
.finally(() => {
this.set('isLoading', false);
Expand All @@ -51,16 +57,25 @@ export default Controller.extend({
}
});
if (!this.get('role.panelPermissions').length) {
this.notify.error(this.l10n.t('Please select atleast one panel.'));
this.notify.error(this.l10n.t('Please select atleast one panel.'),
{
id: 'select_panel'
});
this.set('isLoading', false);
} else {
this.role.save()
.then(() => {
this.set('isAddSystemRoleModalOpen', false);
this.notify.success(this.l10n.t('System role have been saved successfully.'));
this.notify.success(this.l10n.t('System role have been saved successfully.'),
{
id: 'system_role_save'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. System role not saved.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. System role not saved.'),
{
id: 'system_save_role_error'
});
})
.finally(() => {
this.set('isLoading', false);
Expand All @@ -71,10 +86,16 @@ export default Controller.extend({
this.set('isLoading', true);
this.get('model.userPermissions').save()
.then(() => {
this.notify.success(this.l10n.t('User permissions have been saved successfully.'));
this.notify.success(this.l10n.t('User permissions have been saved successfully.'),
{
id: 'user_permission_save'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. User permissions not saved.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. User permissions not saved.'),
{
id: 'user_error_permission'
});
})
.finally(() => {
this.set('isLoading', false);
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/sessions/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,16 @@ export default class extends Controller.extend(EmberTableControllerMixin) {
try {
let session = this.store.peekRecord('session', session_id, { backgroundReload: false });
await session.destroyRecord();
this.notify.success(this.l10n.t('Session has been deleted successfully.'));
this.notify.success(this.l10n.t('Session has been deleted successfully.'),
{
id: 'session_deleted_succ'
});
} catch (e) {
console.warn(e);
this.notify.error(this.l10n.t('An unexpected error has occurred.'));
this.notify.error(this.l10n.t('An unexpected error has occurred.'),
{
id: 'unexpected_session_error'
});
}
this.set('isLoading', false);
}
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/settings/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ export default Controller.extend({
let settings = this.model;
settings.save()
.then(() => {
this.notify.success(this.l10n.t('Settings have been saved successfully.'));
this.notify.success(this.l10n.t('Settings have been saved successfully.'),
{
id: 'setting_analytic_save'
});
})
.catch(() => {
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'),
{
id: 'setting_analytic_error'
});
})
.finally(() => {
this.set('isLoading', false);
Expand Down
10 changes: 8 additions & 2 deletions app/controllers/admin/settings/billing.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ export default class extends Controller {
this.set('isLoading', true);
try {
await this.model.save();
this.notify.success(this.l10n.t('Admin Billing info has been saved successfully'));
this.notify.success(this.l10n.t('Admin Billing info has been saved successfully'),
{
id: 'admin_billing_save'
});
} catch (error) {
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'));
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'),
{
id: 'admin_billing_error'
});
}
this.set('isLoading', false);
}
Expand Down
Loading