Commit 1aa2ffccce7f01f39b517a72bbd0de8e5d1a86e8

Authored by Victor Costa
2 parents 976e5d62 5e8f7a89

Merge branch 'master' of softwarepublico.gov.br:noosfero-themes/angular-theme

src/app/article/cms/cms.component.ts
@@ -38,7 +38,6 @@ export class CmsComponent { @@ -38,7 +38,6 @@ export class CmsComponent {
38 this.id = this.$stateParams['id']; 38 this.id = this.$stateParams['id'];
39 39
40 if (this.parentId) { 40 if (this.parentId) {
41 - this.article = <noosfero.Article>{ type: this.$stateParams['type'] || "TextArticle", published: true };  
42 this.articleService.get(this.parentId).then((result: noosfero.RestResult<noosfero.Article>) => { 41 this.articleService.get(this.parentId).then((result: noosfero.RestResult<noosfero.Article>) => {
43 this.parent = result.data; 42 this.parent = result.data;
44 }); 43 });
@@ -48,6 +47,8 @@ export class CmsComponent { @@ -48,6 +47,8 @@ export class CmsComponent {
48 this.article = result.data; 47 this.article = result.data;
49 this.article.name = this.article.title; // FIXME 48 this.article.name = this.article.title; // FIXME
50 }); 49 });
  50 + } else {
  51 + this.article = <noosfero.Article>{ type: this.$stateParams['type'] || "TextArticle", published: true };
51 } 52 }
52 } 53 }
53 54
@@ -55,8 +56,10 @@ export class CmsComponent { @@ -55,8 +56,10 @@ export class CmsComponent {
55 this.profileService.setCurrentProfileByIdentifier(this.profileIdentifier).then((profile: noosfero.Profile) => { 56 this.profileService.setCurrentProfileByIdentifier(this.profileIdentifier).then((profile: noosfero.Profile) => {
56 if (this.id) { 57 if (this.id) {
57 return this.articleService.updateArticle(this.article); 58 return this.articleService.updateArticle(this.article);
58 - } else { 59 + } else if (this.parentId) {
59 return this.articleService.createInParent(this.parentId, this.article); 60 return this.articleService.createInParent(this.parentId, this.article);
  61 + } else {
  62 + return this.articleService.createInProfile(profile, this.article);
60 } 63 }
61 }).then((response: noosfero.RestResult<noosfero.Article>) => { 64 }).then((response: noosfero.RestResult<noosfero.Article>) => {
62 let article = (<noosfero.Article>response.data); 65 let article = (<noosfero.Article>response.data);
src/app/article/content-viewer/navbar-actions.html
@@ -4,4 +4,9 @@ @@ -4,4 +4,9 @@
4 <i class="fa fa-file fa-fw fa-lg"></i> {{"navbar.content_viewer_actions.new_post" | translate}} 4 <i class="fa fa-file fa-fw fa-lg"></i> {{"navbar.content_viewer_actions.new_post" | translate}}
5 </a> 5 </a>
6 </li> 6 </li>
  7 + <li ng-show="vm.profile">
  8 + <a href="#" role="button" ui-sref="main.cms({profile: vm.profile.identifier, parent_id: vm.parentId, type: 'CommentParagraphPlugin::Discussion'})">
  9 + <i class="fa fa-file fa-fw fa-lg"></i> {{"navbar.content_viewer_actions.new_post" | translate}}
  10 + </a>
  11 + </li>
7 </ul> 12 </ul>