Commit cd461555e42c7cb63c20f6fe09aaf1f3ee337f05

Authored by ABNER SILVA DE OLIVEIRA
1 parent c494da7e

added profile actions, to show actions on profile page. changed to allways show …

…new Discussion on contentviewer pages
src/app/article/content-viewer/navbar-actions.html
... ... @@ -10,7 +10,7 @@
10 10 <i class="fa fa-file fa-fw fa-lg"></i> {{"navbar.content_viewer_actions.new_post" | translate}}
11 11 </a>
12 12 </li>
13   - <li ng-show="vm.parentId">
  13 + <li>
14 14 <a href="#" ui-sref="main.cms({profile: vm.profile.identifier, parent_id: vm.parentId, type: 'CommentParagraphPlugin::Discussion'})">
15 15 <i class="fa fa-file fa-fw fa-lg"></i> {{"navbar.content_viewer_actions.new_discussion" | translate}}
16 16 </a>
... ...
src/app/profile/navbar-actions.html 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +<ul class="nav navbar-nav">
  2 + <li class="dropdown profile-menu" uib-dropdown>
  3 + <a class="btn dropdown-toggle" data-toggle="dropdown" uib-dropdown-toggle>
  4 + {{"navbar.profile_actions.new_item" | translate}}
  5 + <i class="fa fa-caret-down"></i>
  6 + </a>
  7 + <ul class="dropdown-menu" uib-dropdown-menu ng-show="vm.profile">
  8 + <!-- FIXED HERE BUT SHOULD BE A HOTSPOT TO INCLUDE LINKS FROM THE PLUGIN -->
  9 + <li>
  10 + <a href="#" ui-sref="main.cms({profile: vm.profile.identifier, parent_id: null, type: 'CommentParagraphPlugin::Discussion'})">
  11 + <i class="fa fa-file fa-fw fa-lg"></i> {{"navbar.profile_actions.new_discussion" | translate}}
  12 + </a>
  13 + </li>
  14 + </ul>
  15 + </li>
  16 +
  17 +</ul>
  18 +
... ...
src/app/profile/profile-actions.component.ts 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +import {Component, Inject, provide} from "ng-forward";
  2 +import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service";
  3 +
  4 +@Component({
  5 + selector: "profile-actions",
  6 + templateUrl: "app/article/content-viewer/navbar-actions.html",
  7 + providers: [
  8 + provide('profileService', { useClass: ProfileService })
  9 + ]
  10 +})
  11 +@Inject(ProfileService)
  12 +export class ProfileActionsComponent {
  13 + profile: noosfero.Profile;
  14 + parentId: number;
  15 +
  16 + constructor(profileService: ProfileService) {
  17 + profileService.getCurrentProfile().then((profile: noosfero.Profile) => {
  18 + this.profile = profile;
  19 + });
  20 + }
  21 +}
... ...
src/app/profile/profile.component.ts
... ... @@ -9,7 +9,7 @@ import {ActivitiesComponent} from &quot;./activities/activities.component&quot;;
9 9 import {ProfileService} from "../../lib/ng-noosfero-api/http/profile.service";
10 10 import {NotificationService} from "../shared/services/notification.service";
11 11 import {MyProfileComponent} from "./myprofile.component";
12   -
  12 +import {ProfileActionsComponent} from "./profile-actions.component";
13 13  
14 14 /**
15 15 * @ngdoc controller
... ... @@ -37,13 +37,25 @@ import {MyProfileComponent} from &quot;./myprofile.component&quot;;
37 37 templateUrl: "app/profile/info/profile-info.html",
38 38 controller: ProfileInfoComponent,
39 39 controllerAs: "vm"
  40 + },
  41 + "actions@main": {
  42 + templateUrl: "app/profile/navbar-actions.html",
  43 + controller: ProfileActionsComponent,
  44 + controllerAs: "vm"
40 45 }
41 46 }
42 47 },
43 48 {
44 49 name: 'main.profile.settings',
45 50 url: "^/myprofile/:profile",
46   - component: MyProfileComponent
  51 + component: MyProfileComponent,
  52 + views: {
  53 + "actions@main": {
  54 + templateUrl: "app/profile/navbar-actions.html",
  55 + controller: ProfileActionsComponent,
  56 + controllerAs: "vm"
  57 + }
  58 + }
47 59 },
48 60 {
49 61 name: 'main.cms',
... ...
src/languages/en.json
... ... @@ -25,8 +25,11 @@
25 25 "auth.form.password": "Password",
26 26 "auth.form.login_button": "Login",
27 27 "navbar.content_viewer_actions.new_item": "New Item",
  28 + "navbar.profile_actions.new_item": "New Item",
28 29 "navbar.content_viewer_actions.new_post": "New Post",
  30 + "//TODO": "Create a way to load plugin translatios - Move plugins translations to the plugins translations files",
29 31 "navbar.content_viewer_actions.new_discussion": "New Discussion",
  32 + "navbar.profile_actions.new_discussion": "New Discussion",
30 33 "notification.error.default.message": "Something went wrong!",
31 34 "notification.error.default.title": "Oops...",
32 35 "notification.profile.not_found": "Page not found",
... ...