Commit 9571bf309fd1b950e2648f65d60bd10e5baece46

Authored by Victor Costa
1 parent 6a785d26

Structure noosfero blocks components

src/app/components/noosfero-blocks/block.directive.js 0 → 100644
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('angular')
  6 + .directive('noosferoBlock', noosferoBlock);
  7 +
  8 + /** @ngInject */
  9 + function noosferoBlock($compile) {
  10 + var directive = {
  11 + restrict: 'E',
  12 + scope: {
  13 + block: '=',
  14 + owner: '='
  15 + },
  16 + link: function(scope, element) {
  17 + var blockName = scope.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
  18 + element.replaceWith($compile('<noosfero-'+blockName+' block="block" owner="owner"></noosfero-'+blockName+'>')(scope));
  19 + }
  20 + };
  21 + return directive;
  22 + }
  23 +
  24 +})();
src/app/components/noosfero-blocks/link-list/link-list.directive.js 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('angular')
  6 + .directive('noosferoLinkListBlock', noosferoLinkListBlock);
  7 +
  8 + /** @ngInject */
  9 + function noosferoLinkListBlock() {
  10 + var directive = {
  11 + restrict: 'E',
  12 + templateUrl: 'app/components/noosfero-blocks/link-list/link-list.html',
  13 + scope: {
  14 + block: '=',
  15 + owner: '='
  16 + },
  17 + controller: LinkListBlockController,
  18 + controllerAs: 'vm',
  19 + bindToController: true
  20 + };
  21 +
  22 + return directive;
  23 +
  24 + /** @ngInject */
  25 + function LinkListBlockController() {
  26 + var vm = this;
  27 + vm.links = vm.block.settings.links;
  28 + }
  29 + }
  30 +
  31 +})();
src/app/components/noosfero-blocks/link-list/link-list.html 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +<div ng-repeat="link in vm.links">
  2 + <a class="icon-{{link.icon}}" ng-href="{{link.address}}">{{link.name}}</a>
  3 +</div>
src/app/components/noosfero-blocks/profile-image/profile-image.directive.js 0 → 100644
@@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('angular')
  6 + .directive('noosferoProfileImageBlock', noosferoProfileImageBlock);
  7 +
  8 + /** @ngInject */
  9 + function noosferoProfileImageBlock() {
  10 + var directive = {
  11 + restrict: 'E',
  12 + templateUrl: 'app/components/noosfero-blocks/profile-image/profile-image.html',
  13 + scope: {
  14 + block: '=',
  15 + owner: '='
  16 + },
  17 + controller: ProfileImageBlockController,
  18 + controllerAs: 'vm',
  19 + bindToController: true
  20 + };
  21 +
  22 + return directive;
  23 +
  24 + /** @ngInject */
  25 + function ProfileImageBlockController() {
  26 + var vm = this;
  27 + vm.profile = vm.owner;
  28 + }
  29 + }
  30 +
  31 +})();
src/app/components/noosfero-blocks/profile-image/profile-image.html 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +<div class="profile-image">
  2 + <img src="assets/images/icons-app/community-big.png">
  3 +</div>
src/app/components/noosfero/blocks/block.directive.js
@@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
1 -(function() {  
2 - 'use strict';  
3 -  
4 - angular  
5 - .module('angular')  
6 - .directive('noosferoBlock', noosferoBlock);  
7 -  
8 - /** @ngInject */  
9 - function noosferoBlock($compile) {  
10 - var directive = {  
11 - restrict: 'E',  
12 - scope: {  
13 - block: '=',  
14 - owner: '='  
15 - },  
16 - link: function(scope, element) {  
17 - var blockName = scope.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();  
18 - element.replaceWith($compile('<noosfero-'+blockName+' block="block" owner="owner"></noosfero-'+blockName+'>')(scope));  
19 - }  
20 - };  
21 - return directive;  
22 - }  
23 -  
24 -})();  
src/app/components/noosfero/blocks/link-list.directive.js
@@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
1 -(function() {  
2 - 'use strict';  
3 -  
4 - angular  
5 - .module('angular')  
6 - .directive('noosferoLinkListBlock', noosferoLinkListBlock);  
7 -  
8 - /** @ngInject */  
9 - function noosferoLinkListBlock() {  
10 - var directive = {  
11 - restrict: 'E',  
12 - templateUrl: 'app/components/noosfero/blocks/link-list.html',  
13 - scope: {  
14 - block: '=',  
15 - owner: '='  
16 - },  
17 - controller: LinkListBlockController,  
18 - controllerAs: 'vm',  
19 - bindToController: true  
20 - };  
21 -  
22 - return directive;  
23 -  
24 - /** @ngInject */  
25 - function LinkListBlockController() {  
26 - var vm = this;  
27 - vm.links = vm.block.settings.links;  
28 - }  
29 - }  
30 -  
31 -})();  
src/app/components/noosfero/blocks/link-list.html
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -<div ng-repeat="link in vm.links">  
2 - <a class="icon-{{link.icon}}" ng-href="{{link.address}}">{{link.name}}</a>  
3 -</div>  
src/app/components/noosfero/blocks/profile-image.directive.js
@@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
1 -(function() {  
2 - 'use strict';  
3 -  
4 - angular  
5 - .module('angular')  
6 - .directive('noosferoProfileImageBlock', noosferoProfileImageBlock);  
7 -  
8 - /** @ngInject */  
9 - function noosferoProfileImageBlock() {  
10 - var directive = {  
11 - restrict: 'E',  
12 - templateUrl: 'app/components/noosfero/blocks/profile-image.html',  
13 - scope: {  
14 - block: '=',  
15 - owner: '='  
16 - },  
17 - controller: ProfileImageBlockController,  
18 - controllerAs: 'vm',  
19 - bindToController: true  
20 - };  
21 -  
22 - return directive;  
23 -  
24 - /** @ngInject */  
25 - function ProfileImageBlockController() {  
26 - var vm = this;  
27 - vm.profile = vm.owner;  
28 - }  
29 - }  
30 -  
31 -})();  
src/app/components/noosfero/blocks/profile-image.html
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -<div class="profile-image">  
2 - <img src="assets/images/icons-app/community-big.png">  
3 -</div>