diff --git a/src/app/article/cms/cms.component.ts b/src/app/article/cms/cms.component.ts index 8c7428e..4e50f42 100644 --- a/src/app/article/cms/cms.component.ts +++ b/src/app/article/cms/cms.component.ts @@ -38,7 +38,6 @@ export class CmsComponent { this.id = this.$stateParams['id']; if (this.parentId) { - this.article = { type: this.$stateParams['type'] || "TextArticle", published: true }; this.articleService.get(this.parentId).then((result: noosfero.RestResult) => { this.parent = result.data; }); @@ -48,6 +47,8 @@ export class CmsComponent { this.article = result.data; this.article.name = this.article.title; // FIXME }); + } else { + this.article = { type: this.$stateParams['type'] || "TextArticle", published: true }; } } @@ -55,8 +56,10 @@ export class CmsComponent { this.profileService.setCurrentProfileByIdentifier(this.profileIdentifier).then((profile: noosfero.Profile) => { if (this.id) { return this.articleService.updateArticle(this.article); - } else { + } else if (this.parentId) { return this.articleService.createInParent(this.parentId, this.article); + } else { + return this.articleService.createInProfile(profile, this.article); } }).then((response: noosfero.RestResult) => { let article = (response.data); -- libgit2 0.21.2