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 38 this.id = this.$stateParams['id'];
39 39  
40 40 if (this.parentId) {
41   - this.article = <noosfero.Article>{ type: this.$stateParams['type'] || "TextArticle", published: true };
42 41 this.articleService.get(this.parentId).then((result: noosfero.RestResult<noosfero.Article>) => {
43 42 this.parent = result.data;
44 43 });
... ... @@ -48,6 +47,8 @@ export class CmsComponent {
48 47 this.article = result.data;
49 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 56 this.profileService.setCurrentProfileByIdentifier(this.profileIdentifier).then((profile: noosfero.Profile) => {
56 57 if (this.id) {
57 58 return this.articleService.updateArticle(this.article);
58   - } else {
  59 + } else if (this.parentId) {
59 60 return this.articleService.createInParent(this.parentId, this.article);
  61 + } else {
  62 + return this.articleService.createInProfile(profile, this.article);
60 63 }
61 64 }).then((response: noosfero.RestResult<noosfero.Article>) => {
62 65 let article = (<noosfero.Article>response.data);
... ...
src/app/article/content-viewer/navbar-actions.html
... ... @@ -4,4 +4,9 @@
4 4 <i class="fa fa-file fa-fw fa-lg"></i> {{"navbar.content_viewer_actions.new_post" | translate}}
5 5 </a>
6 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 12 </ul>
... ...