Commit 7690724a3a2e7254864f4ed2f40460bef734a2a8
1 parent
04836b51
Exists in
master
and in
38 other branches
Improve blocks structure
Showing
8 changed files
with
15 additions
and
10 deletions
Show diff stats
src/app/components/noosfero/blocks/block.directive.js
@@ -10,11 +10,12 @@ | @@ -10,11 +10,12 @@ | ||
10 | var directive = { | 10 | var directive = { |
11 | restrict: 'E', | 11 | restrict: 'E', |
12 | scope: { | 12 | scope: { |
13 | - block: '=' | 13 | + block: '=', |
14 | + owner: '=' | ||
14 | }, | 15 | }, |
15 | link: function(scope, element, attrs) { | 16 | link: function(scope, element, attrs) { |
16 | var blockName = scope.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); | 17 | var blockName = scope.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); |
17 | - element.replaceWith($compile('<noosfero-'+blockName+' block="block"></noosfero-'+blockName+'>')(scope)); | 18 | + element.replaceWith($compile('<noosfero-'+blockName+' block="block" owner="owner"></noosfero-'+blockName+'>')(scope)); |
18 | } | 19 | } |
19 | }; | 20 | }; |
20 | return directive; | 21 | return directive; |
src/app/components/noosfero/blocks/link-list.directive.js
@@ -11,7 +11,8 @@ | @@ -11,7 +11,8 @@ | ||
11 | restrict: 'E', | 11 | restrict: 'E', |
12 | templateUrl: 'app/components/noosfero/blocks/link-list.html', | 12 | templateUrl: 'app/components/noosfero/blocks/link-list.html', |
13 | scope: { | 13 | scope: { |
14 | - block: '=' | 14 | + block: '=', |
15 | + owner: '=' | ||
15 | }, | 16 | }, |
16 | controller: LinkListBlockController, | 17 | controller: LinkListBlockController, |
17 | controllerAs: 'vm', | 18 | controllerAs: 'vm', |
src/app/components/noosfero/blocks/profile-image.directive.js
@@ -11,7 +11,8 @@ | @@ -11,7 +11,8 @@ | ||
11 | restrict: 'E', | 11 | restrict: 'E', |
12 | templateUrl: 'app/components/noosfero/blocks/profile-image.html', | 12 | templateUrl: 'app/components/noosfero/blocks/profile-image.html', |
13 | scope: { | 13 | scope: { |
14 | - block: '=' | 14 | + block: '=', |
15 | + owner: '=' | ||
15 | }, | 16 | }, |
16 | controller: ProfileImageBlockController, | 17 | controller: ProfileImageBlockController, |
17 | controllerAs: 'vm', | 18 | controllerAs: 'vm', |
@@ -23,7 +24,7 @@ | @@ -23,7 +24,7 @@ | ||
23 | /** @ngInject */ | 24 | /** @ngInject */ |
24 | function ProfileImageBlockController(moment) { | 25 | function ProfileImageBlockController(moment) { |
25 | var vm = this; | 26 | var vm = this; |
26 | - vm.links = vm.block.settings.links; | 27 | + vm.profile = vm.owner; |
27 | } | 28 | } |
28 | } | 29 | } |
29 | 30 |
src/app/components/noosfero/blocks/profile-image.html
src/app/main/main.controller.js
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | function activate() { | 14 | function activate() { |
15 | noosfero.communities().get({id: 67, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (profile) { | 15 | noosfero.communities().get({id: 67, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (profile) { |
16 | $log.log(profile); | 16 | $log.log(profile); |
17 | - vm.boxes = profile.community.boxes; | 17 | + vm.owner = profile.community; |
18 | }); | 18 | }); |
19 | } | 19 | } |
20 | } | 20 | } |
src/app/main/main.html
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | </div> | 5 | </div> |
6 | 6 | ||
7 | <div class="row"> | 7 | <div class="row"> |
8 | - <ng-include ng-repeat="box in main.boxes | orderBy: 'position'" src="'app/views/profile/box.html'"></ng-include> | 8 | + <ng-include ng-repeat="box in main.owner.boxes | orderBy: 'position'" src="'app/views/profile/box.html'"></ng-include> |
9 | </div> | 9 | </div> |
10 | 10 | ||
11 | </div> | 11 | </div> |
src/app/views/profile/block.html
1 | <div class="panel panel-primary" > | 1 | <div class="panel panel-primary" > |
2 | - <div class="panel-heading"> | 2 | + <div class="panel-heading" ng-show="block.title"> |
3 | <h3 class="panel-title">{{block.title}}</h3> | 3 | <h3 class="panel-title">{{block.title}}</h3> |
4 | </div> | 4 | </div> |
5 | <div class="panel-body"> | 5 | <div class="panel-body"> |
6 | <pre>{{block}}</pre> | 6 | <pre>{{block}}</pre> |
7 | - <noosfero-block block="block"></noosfero-block> | 7 | + <noosfero-block block="block" owner="main.owner"></noosfero-block> |
8 | </div> | 8 | </div> |
9 | </div> | 9 | </div> |
19.6 KB