Commit 00eaab03f86222fc3246a4a71abc45ff9d3cb799

Authored by Victor Costa
1 parent ba389ecc

Display basic error message when fail to save an article

src/app/article/basic-editor/basic-editor.component.ts
... ... @@ -57,6 +57,8 @@ export class BasicEditorComponent {
57 57 let article = (<noosfero.Article>response.data);
58 58 this.$state.go('main.profile.page', { page: article.path, profile: article.profile.identifier });
59 59 this.notification.success({ title: "article.basic_editor.success.title", message: "article.basic_editor.success.message" });
  60 + }).catch(() => {
  61 + this.notification.error({ message: "article.basic_editor.save.failed" });
60 62 });
61 63 }
62 64  
... ...
src/app/profile/profile.component.ts
... ... @@ -110,7 +110,7 @@ export class ProfileComponent {
110 110 }).then((response: restangular.IResponse) => {
111 111 this.boxes = response.data.boxes;
112 112 }).catch(() => {
113   - $state.transitionTo('main');
  113 + $state.transitionTo('main.environment.home');
114 114 notificationService.error({ message: "notification.profile.not_found" });
115 115 });
116 116 }
... ...
src/app/shared/services/notification.service.ts
... ... @@ -25,7 +25,7 @@ export class NotificationService {
25 25  
26 26 httpError(status: number, data: any): boolean {
27 27 this.error({ message: `notification.http_error.${status}.message` });
28   - return true; // return true to indicate that the error was already handled
  28 + return false; // return true to indicate that the error was already handled
29 29 }
30 30  
31 31 success({
... ...
src/languages/en.json
... ... @@ -40,6 +40,7 @@
40 40 "article.basic_editor.title": "Title",
41 41 "article.basic_editor.body": "Body",
42 42 "article.basic_editor.save": "Save",
  43 + "article.basic_editor.save.failed": "This article could not be saved",
43 44 "article.basic_editor.cancel": "Cancel",
44 45 "article.basic_editor.success.title": "Good job!",
45 46 "article.basic_editor.success.message": "Article saved!",
... ...
src/languages/pt.json
... ... @@ -40,6 +40,7 @@
40 40 "article.basic_editor.title": "Título",
41 41 "article.basic_editor.body": "Corpo",
42 42 "article.basic_editor.save": "Salvar",
  43 + "article.basic_editor.save.failed": "O artigo não pode ser salvo",
43 44 "article.basic_editor.cancel": "Cancelar",
44 45 "article.basic_editor.success.title": "Bom trabalho!",
45 46 "article.basic_editor.success.message": "Artigo salvo com sucesso!",
... ...