diff --git a/src/app/index.route.js b/src/app/index.route.js index 038aec1..49f965b 100644 --- a/src/app/index.route.js +++ b/src/app/index.route.js @@ -8,9 +8,9 @@ function routeConfig($routeProvider) { $routeProvider .when('/:profile', { - templateUrl: 'app/main/main.html', - controller: 'MainController', - controllerAs: 'main' + templateUrl: 'app/profile/profile.html', + controller: 'ProfileController', + controllerAs: 'vm' }) .when('/profile/:profile', { redirectTo: '/:profile' diff --git a/src/app/main/main.controller.js b/src/app/main/main.controller.js deleted file mode 100644 index ce659e3..0000000 --- a/src/app/main/main.controller.js +++ /dev/null @@ -1,27 +0,0 @@ -(function() { - 'use strict'; - - angular - .module('angular') - .controller('MainController', MainController); - - - /** @ngInject */ - function MainController($timeout, noosfero, $log, $routeParams) { - var vm = this; - vm.boxes = []; - activate(); - - function activate() { - noosfero.communities().get({identifier: $routeParams.profile, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (profile) { - $log.log(profile); - vm.owner = profile.communities[0]; - }); - } - - vm.boxesOrder = function(box) { - if(box.position==2) return 0; - return box.position; - } - } -})(); diff --git a/src/app/main/main.controller.spec.js b/src/app/main/main.controller.spec.js deleted file mode 100644 index 587817d..0000000 --- a/src/app/main/main.controller.spec.js +++ /dev/null @@ -1,38 +0,0 @@ -(function() { - 'use strict'; - - describe('controllers', function(){ - var vm; - var $timeout; - var toastr; - - beforeEach(module('angular')); - beforeEach(inject(function(_$controller_, _$timeout_, _toastr_) { - spyOn(_toastr_, 'info').and.callThrough(); - - vm = _$controller_('MainController'); - $timeout = _$timeout_; - toastr = _toastr_; - })); - - it('should have a timestamp creation date', function() { - expect(vm.creationDate).toEqual(jasmine.any(Number)); - }); - - it('should define animate class after delaying timeout ', function() { - $timeout.flush(); - expect(vm.classAnimation).toEqual('rubberBand'); - }); - - it('should show a Toastr info and stop animation when invoke showToastr()', function() { - vm.showToastr(); - expect(toastr.info).toHaveBeenCalled(); - expect(vm.classAnimation).toEqual(''); - }); - - it('should define more than 5 awesome things', function() { - expect(angular.isArray(vm.awesomeThings)).toBeTruthy(); - expect(vm.awesomeThings.length === 5).toBeTruthy(); - }); - }); -})(); diff --git a/src/app/main/main.html b/src/app/main/main.html deleted file mode 100644 index 44ca1c2..0000000 --- a/src/app/main/main.html +++ /dev/null @@ -1,11 +0,0 @@ -
- -
- -
- -
- -
- -
diff --git a/src/app/pages/profile/box.html b/src/app/pages/profile/box.html deleted file mode 100644 index ab63d44..0000000 --- a/src/app/pages/profile/box.html +++ /dev/null @@ -1,4 +0,0 @@ -
- Box {{box.id}}->{{box.position}} - -
diff --git a/src/app/profile/profile.controller.js b/src/app/profile/profile.controller.js new file mode 100644 index 0000000..b5f4af6 --- /dev/null +++ b/src/app/profile/profile.controller.js @@ -0,0 +1,27 @@ +(function() { + 'use strict'; + + angular + .module('angular') + .controller('ProfileController', ProfileController); + + + /** @ngInject */ + function ProfileController($timeout, noosfero, $log, $routeParams) { + var vm = this; + vm.boxes = []; + activate(); + + function activate() { + noosfero.communities().get({identifier: $routeParams.profile, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (profile) { + $log.log(profile); + vm.owner = profile.communities[0]; + }); + } + + vm.boxesOrder = function(box) { + if(box.position==2) return 0; + return box.position; + } + } +})(); diff --git a/src/app/profile/profile.controller.spec.js b/src/app/profile/profile.controller.spec.js new file mode 100644 index 0000000..587817d --- /dev/null +++ b/src/app/profile/profile.controller.spec.js @@ -0,0 +1,38 @@ +(function() { + 'use strict'; + + describe('controllers', function(){ + var vm; + var $timeout; + var toastr; + + beforeEach(module('angular')); + beforeEach(inject(function(_$controller_, _$timeout_, _toastr_) { + spyOn(_toastr_, 'info').and.callThrough(); + + vm = _$controller_('MainController'); + $timeout = _$timeout_; + toastr = _toastr_; + })); + + it('should have a timestamp creation date', function() { + expect(vm.creationDate).toEqual(jasmine.any(Number)); + }); + + it('should define animate class after delaying timeout ', function() { + $timeout.flush(); + expect(vm.classAnimation).toEqual('rubberBand'); + }); + + it('should show a Toastr info and stop animation when invoke showToastr()', function() { + vm.showToastr(); + expect(toastr.info).toHaveBeenCalled(); + expect(vm.classAnimation).toEqual(''); + }); + + it('should define more than 5 awesome things', function() { + expect(angular.isArray(vm.awesomeThings)).toBeTruthy(); + expect(vm.awesomeThings.length === 5).toBeTruthy(); + }); + }); +})(); diff --git a/src/app/profile/profile.html b/src/app/profile/profile.html new file mode 100644 index 0000000..a86ca95 --- /dev/null +++ b/src/app/profile/profile.html @@ -0,0 +1,11 @@ +
+ +
+ +
+ +
+ +
+ +
diff --git a/src/app/views/profile/block.html b/src/app/views/profile/block.html index 4fcc85b..62c727a 100644 --- a/src/app/views/profile/block.html +++ b/src/app/views/profile/block.html @@ -3,6 +3,6 @@

{{block.title}}

- +
-- libgit2 0.21.2