From 5e8f7a89b7a02b87ba0b1d6258b3a6e9de92e4e6 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Wed, 11 May 2016 08:54:43 -0300 Subject: [PATCH] save articles without parent --- src/app/article/cms/cms.component.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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