Commit 00eaab03f86222fc3246a4a71abc45ff9d3cb799
1 parent
ba389ecc
Exists in
master
and in
27 other branches
Display basic error message when fail to save an article
Showing
5 changed files
with
6 additions
and
2 deletions
Show diff stats
src/app/article/basic-editor/basic-editor.component.ts
| @@ -57,6 +57,8 @@ export class BasicEditorComponent { | @@ -57,6 +57,8 @@ export class BasicEditorComponent { | ||
| 57 | let article = (<noosfero.Article>response.data); | 57 | let article = (<noosfero.Article>response.data); |
| 58 | this.$state.go('main.profile.page', { page: article.path, profile: article.profile.identifier }); | 58 | this.$state.go('main.profile.page', { page: article.path, profile: article.profile.identifier }); |
| 59 | this.notification.success({ title: "article.basic_editor.success.title", message: "article.basic_editor.success.message" }); | 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,7 +110,7 @@ export class ProfileComponent { | ||
| 110 | }).then((response: restangular.IResponse) => { | 110 | }).then((response: restangular.IResponse) => { |
| 111 | this.boxes = response.data.boxes; | 111 | this.boxes = response.data.boxes; |
| 112 | }).catch(() => { | 112 | }).catch(() => { |
| 113 | - $state.transitionTo('main'); | 113 | + $state.transitionTo('main.environment.home'); |
| 114 | notificationService.error({ message: "notification.profile.not_found" }); | 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,7 +25,7 @@ export class NotificationService { | ||
| 25 | 25 | ||
| 26 | httpError(status: number, data: any): boolean { | 26 | httpError(status: number, data: any): boolean { |
| 27 | this.error({ message: `notification.http_error.${status}.message` }); | 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 | success({ | 31 | success({ |
src/languages/en.json
| @@ -40,6 +40,7 @@ | @@ -40,6 +40,7 @@ | ||
| 40 | "article.basic_editor.title": "Title", | 40 | "article.basic_editor.title": "Title", |
| 41 | "article.basic_editor.body": "Body", | 41 | "article.basic_editor.body": "Body", |
| 42 | "article.basic_editor.save": "Save", | 42 | "article.basic_editor.save": "Save", |
| 43 | + "article.basic_editor.save.failed": "This article could not be saved", | ||
| 43 | "article.basic_editor.cancel": "Cancel", | 44 | "article.basic_editor.cancel": "Cancel", |
| 44 | "article.basic_editor.success.title": "Good job!", | 45 | "article.basic_editor.success.title": "Good job!", |
| 45 | "article.basic_editor.success.message": "Article saved!", | 46 | "article.basic_editor.success.message": "Article saved!", |
src/languages/pt.json
| @@ -40,6 +40,7 @@ | @@ -40,6 +40,7 @@ | ||
| 40 | "article.basic_editor.title": "Título", | 40 | "article.basic_editor.title": "Título", |
| 41 | "article.basic_editor.body": "Corpo", | 41 | "article.basic_editor.body": "Corpo", |
| 42 | "article.basic_editor.save": "Salvar", | 42 | "article.basic_editor.save": "Salvar", |
| 43 | + "article.basic_editor.save.failed": "O artigo não pode ser salvo", | ||
| 43 | "article.basic_editor.cancel": "Cancelar", | 44 | "article.basic_editor.cancel": "Cancelar", |
| 44 | "article.basic_editor.success.title": "Bom trabalho!", | 45 | "article.basic_editor.success.title": "Bom trabalho!", |
| 45 | "article.basic_editor.success.message": "Artigo salvo com sucesso!", | 46 | "article.basic_editor.success.message": "Artigo salvo com sucesso!", |