Commit d316e3035539f1eef498487ed105db2258888c59

Authored by ABNER SILVA DE OLIVEIRA
2 parents 5dcaf641 d003d3ce

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

src/app/components/noosfero-blocks/block.component.ts
... ... @@ -12,7 +12,7 @@ export class Block {
12 12  
13 13 ngOnInit() {
14 14 let blockName = this.block.type ? this.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() : "default-block";
15   - this.$element.replaceWith(this.$compile('<noosfero-' + blockName + ' block="ctrl.block" owner="ctrl.owner"></noosfero-' + blockName + '>')(this.$scope));
  15 + this.$element.replaceWith(this.$compile('<noosfero-' + blockName + ' [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-' + blockName + '>')(this.$scope));
16 16 }
17 17  
18 18 constructor(private $element: any, private $scope: ng.IScope, private $injector: ng.auto.IInjectorService, private $compile: ng.ICompileService) {
... ...
src/app/components/noosfero-blocks/link-list/link-list.component.js
... ... @@ -1,21 +0,0 @@
1   -(function() {
2   - 'use strict';
3   -
4   - angular
5   - .module('noosferoApp')
6   - .component('noosferoLinkListBlock', {
7   - restrict: 'E',
8   - templateUrl: 'app/components/noosfero-blocks/link-list/link-list.html',
9   - bindings: {
10   - block: '<',
11   - owner: '<'
12   - },
13   - controller: LinkListBlockController
14   - });
15   -
16   - /** @ngInject */
17   - function LinkListBlockController() {
18   - this.links = this.block.settings.links;
19   - }
20   -
21   -})();
src/app/components/noosfero-blocks/link-list/link-list.component.ts 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +import {Component, Input} from "ng-forward";
  2 +
  3 +@Component({
  4 + selector: "noosfero-link-list-block",
  5 + templateUrl: "app/components/noosfero-blocks/link-list/link-list.html"
  6 +})
  7 +export class LinkListBlock {
  8 +
  9 + @Input() block: any;
  10 + @Input() owner: any;
  11 +
  12 + links: any;
  13 +
  14 + ngOnInit() {
  15 + this.links = this.block.settings.links;
  16 + }
  17 +
  18 +}
... ...
src/app/components/noosfero-blocks/link-list/link-list.html
1 1 <div class="link-list-block">
2   - <div ng-repeat="link in $ctrl.links">
3   - <a ng-href="{{link.address | noosferoTemplateFilter:{profile: $ctrl.owner.identifier} }}">
  2 + <div ng-repeat="link in ctrl.links">
  3 + <a ng-href="{{link.address | noosferoTemplateFilter:{profile: ctrl.owner.identifier} }}">
4 4 <i class="fa fa-fw icon-{{link.icon}}"></i> <span>{{link.name}}</span>
5 5 </a>
6 6 </div>
... ...
src/app/index.ts
... ... @@ -44,7 +44,6 @@ NoosferoApp.addController(&quot;AuthController&quot;, AuthController);
44 44 require("./components/navbar/navbar.directive.js");
45 45 require("./components/noosfero-activities/activities.component.js");
46 46 require("./components/noosfero-activities/activity/activity.component.js");
47   -require("./components/noosfero-blocks/link-list/link-list.component.js");
48 47 require("./components/noosfero-blocks/main-block/main-block.component.js");
49 48 require("./components/noosfero-blocks/members-block/members-block.component.js");
50 49 require("./components/noosfero-blocks/profile-image/profile-image.component.js");
... ...
src/app/main/main.component.ts
... ... @@ -6,6 +6,7 @@ import {ArticleView} from &quot;../components/noosfero-articles/article/article_view&quot;
6 6 import {Profile} from "../profile/profile.component";
7 7 import {Boxes} from "../components/noosfero-boxes/boxes.component";
8 8 import {Block} from "../components/noosfero-blocks/block.component";
  9 +import {LinkListBlock} from "../components/noosfero-blocks/link-list/link-list.component";
9 10  
10 11  
11 12 import {AuthService} from "./../components/auth/auth_service";
... ... @@ -23,7 +24,7 @@ export class MainContent {
23 24 @Component({
24 25 selector: 'main',
25 26 template: '<div ng-view></div>',
26   - directives: [NoosferoArticleBlog, ArticleView, Boxes, Block],
  27 + directives: [NoosferoArticleBlog, ArticleView, Boxes, Block, LinkListBlock],
27 28 providers: [AuthService, Session]
28 29 })
29 30 @StateConfig([
... ...