docs: ✏️ Update create, save, and delete i18n notify strings
In addition, notify on create, save, and delete before route changes for consistency
This commit is contained in:
5 files changed
+24
-20
No files matched your search
@@ -36,10 +36,13 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
async save(group) {
|
||||
const { isNew } = group;
|
||||
try {
|
||||
await group.save(this.scopeAdapterOptions());
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.save-success'));
|
||||
this.notify.success(this.intl.t(
|
||||
isNew ? 'notify.create-success' : 'notify.save-success'
|
||||
));
|
||||
this.transitionTo('scopes.scope.groups.group', group);
|
||||
} catch (error) {
|
||||
//TODO: replace with translated strings
|
||||
@@ -56,8 +59,8 @@ export default class ScopesScopeGroupsRoute extends Route {
|
||||
try {
|
||||
await group.destroyRecord(this.scopeAdapterOptions());
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.delete-success'));
|
||||
this.transitionTo('scopes.scope.groups');
|
||||
this.notify.success(this.intl.t('notify.group.delete-success'));
|
||||
} catch (error) {
|
||||
//TODO: replace with translated strings
|
||||
this.notify.error(error.message, { closeAfter: null });
|
||||
|
||||
@@ -5,6 +5,7 @@ import { action } from '@ember/object';
|
||||
export default class ScopesScopeProjectsRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service intl;
|
||||
@service notify;
|
||||
|
||||
// =methods
|
||||
@@ -52,11 +53,13 @@ export default class ScopesScopeProjectsRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
async save(project) {
|
||||
const { isNew } = project;
|
||||
try {
|
||||
await project.save();
|
||||
this.refresh();
|
||||
// TODO: replace with translated strings
|
||||
this.notify.success('Save succeeded.');
|
||||
this.notify.success(this.intl.t(
|
||||
isNew ? 'notify.create-success' : 'notify.save-success'
|
||||
));
|
||||
this.transitionTo('scopes.scope.projects.project', project);
|
||||
} catch (error) {
|
||||
// TODO: replace with translated strings
|
||||
@@ -73,9 +76,8 @@ export default class ScopesScopeProjectsRoute extends Route {
|
||||
try {
|
||||
await project.destroyRecord();
|
||||
this.refresh();
|
||||
this.notify.success('notify.delete-success');
|
||||
this.transitionTo('scopes.scope.projects');
|
||||
// TODO: replace with translated strings
|
||||
this.notify.success('Deleted project succesfully.');
|
||||
} catch (error) {
|
||||
// TODO: replace with translated strings
|
||||
this.notify.error(error.message, { closeAfter: null });
|
||||
|
||||
@@ -36,10 +36,13 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
async save(role) {
|
||||
const { isNew } = role;
|
||||
try {
|
||||
await role.save(this.scopeAdapterOptions());
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.save-success'));
|
||||
this.notify.success(this.intl.t(
|
||||
isNew ? 'notify.create-success' : 'notify.save-success'
|
||||
));
|
||||
this.transitionTo('scopes.scope.roles.role', role);
|
||||
} catch (error) {
|
||||
// TODO: replace with translated strings
|
||||
@@ -56,7 +59,7 @@ export default class ScopesScopeRolesRoute extends Route {
|
||||
try {
|
||||
await role.destroyRecord(this.scopeAdapterOptions());
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.role.delete-success'));
|
||||
this.notify.success(this.intl.t('notify.delete-success'));
|
||||
this.transitionTo('scopes.scope.roles');
|
||||
} catch (error) {
|
||||
// TODO: replace with translated strings
|
||||
|
||||
@@ -37,10 +37,13 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
*/
|
||||
@action
|
||||
async save(user) {
|
||||
const { isNew } = user;
|
||||
try {
|
||||
await user.save(this.scopeAdapterOptions());
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.save-success'));
|
||||
this.notify.success(this.intl.t(
|
||||
isNew ? 'notify.create-success' : 'notify.save-success'
|
||||
));
|
||||
this.transitionTo('scopes.scope.users.user', user);
|
||||
} catch (error) {
|
||||
// TODO: replace with translated strings
|
||||
@@ -57,8 +60,8 @@ export default class ScopesScopeUsersRoute extends Route {
|
||||
try {
|
||||
await user.destroyRecord(this.scopeAdapterOptions());
|
||||
this.refresh();
|
||||
this.notify.success(this.intl.t('notify.delete-success'));
|
||||
this.transitionTo('scopes.scope.users');
|
||||
this.notify.success(this.intl.t('notify.user.delete-success'));
|
||||
} catch (error) {
|
||||
// TODO: replace with translated strings
|
||||
this.notify.error(error.message, { closeAfter: null });
|
||||
|
||||
@@ -60,16 +60,9 @@ errors:
|
||||
server-error: We ran into a problem and could not continue. You can ask your administrator or try again later.
|
||||
unknown-error: Please contact your administrator or try again later.
|
||||
notify:
|
||||
save-success: Save succeeded.
|
||||
user:
|
||||
create-success: User created succesfully.
|
||||
delete-success: Deleted user successfully.
|
||||
role:
|
||||
create-success: Role created succesfully.
|
||||
delete-success: Deleted role successfully.
|
||||
group:
|
||||
create-success: Group created succesfully.
|
||||
delete-success: Deleted group successfully.
|
||||
create-success: Created succesfully.
|
||||
save-success: Saved succesfully.
|
||||
delete-success: Deleted successfully.
|
||||
dev:
|
||||
default-org: Default Org
|
||||
menu-item: Menu item
|
||||
|
||||
Reference in new issue
Block a user