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 | 10 | var directive = { |
| 11 | 11 | restrict: 'E', |
| 12 | 12 | scope: { |
| 13 | - block: '=' | |
| 13 | + block: '=', | |
| 14 | + owner: '=' | |
| 14 | 15 | }, |
| 15 | 16 | link: function(scope, element, attrs) { |
| 16 | 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 | 21 | return directive; | ... | ... |
src/app/components/noosfero/blocks/link-list.directive.js
src/app/components/noosfero/blocks/profile-image.directive.js
| ... | ... | @@ -11,7 +11,8 @@ |
| 11 | 11 | restrict: 'E', |
| 12 | 12 | templateUrl: 'app/components/noosfero/blocks/profile-image.html', |
| 13 | 13 | scope: { |
| 14 | - block: '=' | |
| 14 | + block: '=', | |
| 15 | + owner: '=' | |
| 15 | 16 | }, |
| 16 | 17 | controller: ProfileImageBlockController, |
| 17 | 18 | controllerAs: 'vm', |
| ... | ... | @@ -23,7 +24,7 @@ |
| 23 | 24 | /** @ngInject */ |
| 24 | 25 | function ProfileImageBlockController(moment) { |
| 25 | 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 | 14 | function activate() { |
| 15 | 15 | noosfero.communities().get({id: 67, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (profile) { |
| 16 | 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 | 5 | </div> |
| 6 | 6 | |
| 7 | 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 | 9 | </div> |
| 10 | 10 | |
| 11 | 11 | </div> | ... | ... |
src/app/views/profile/block.html
| 1 | 1 | <div class="panel panel-primary" > |
| 2 | - <div class="panel-heading"> | |
| 2 | + <div class="panel-heading" ng-show="block.title"> | |
| 3 | 3 | <h3 class="panel-title">{{block.title}}</h3> |
| 4 | 4 | </div> |
| 5 | 5 | <div class="panel-body"> |
| 6 | 6 | <pre>{{block}}</pre> |
| 7 | - <noosfero-block block="block"></noosfero-block> | |
| 7 | + <noosfero-block block="block" owner="main.owner"></noosfero-block> | |
| 8 | 8 | </div> |
| 9 | 9 | </div> | ... | ... |
19.6 KB