Commit b78762c84f2569ee3ae1627b79f3de62584181ba

Authored by Victor Costa
1 parent 7ba341ab
Exists in master and in 1 other branch dev-fixes

Remove unused code

src/app/components/githubContributor/githubContributor.service.js
... ... @@ -1,37 +0,0 @@
1   -(function() {
2   - 'use strict';
3   -
4   - angular
5   - .module('angular')
6   - .factory('githubContributor', githubContributor);
7   -
8   - /** @ngInject */
9   - function githubContributor($log, $http) {
10   - var apiHost = 'https://api.github.com/repos/Swiip/generator-gulp-angular';
11   -
12   - var service = {
13   - apiHost: apiHost,
14   - getContributors: getContributors
15   - };
16   -
17   - return service;
18   -
19   - function getContributors(limit) {
20   - if (!limit) {
21   - limit = 30;
22   - }
23   -
24   - return $http.get(apiHost + '/contributors?per_page=' + limit)
25   - .then(getContributorsComplete)
26   - .catch(getContributorsFailed);
27   -
28   - function getContributorsComplete(response) {
29   - return response.data;
30   - }
31   -
32   - function getContributorsFailed(error) {
33   - $log.error('XHR Failed for getContributors.\n' + angular.toJson(error.data, true));
34   - }
35   - }
36   - }
37   -})();
src/app/components/githubContributor/githubContributor.service.spec.js
... ... @@ -1,62 +0,0 @@
1   -(function() {
2   - 'use strict';
3   -
4   - describe('service githubContributor', function() {
5   - var githubContributor;
6   - var $httpBackend;
7   - var $log;
8   -
9   - beforeEach(module('angular'));
10   - beforeEach(inject(function(_githubContributor_, _$httpBackend_, _$log_) {
11   - githubContributor = _githubContributor_;
12   - $httpBackend = _$httpBackend_;
13   - $log = _$log_;
14   - }));
15   -
16   - it('should be registered', function() {
17   - expect(githubContributor).not.toEqual(null);
18   - });
19   -
20   - describe('apiHost variable', function() {
21   - it('should exist', function() {
22   - expect(githubContributor.apiHost).not.toEqual(null);
23   - });
24   - });
25   -
26   - describe('getContributors function', function() {
27   - it('should exist', function() {
28   - expect(githubContributor.getContributors).not.toEqual(null);
29   - });
30   -
31   - it('should return data', function() {
32   - $httpBackend.when('GET', githubContributor.apiHost + '/contributors?per_page=1').respond(200, [{pprt: 'value'}]);
33   - var data;
34   - githubContributor.getContributors(1).then(function(fetchedData) {
35   - data = fetchedData;
36   - });
37   - $httpBackend.flush();
38   - expect(data).toEqual(jasmine.any(Array));
39   - expect(data.length === 1).toBeTruthy();
40   - expect(data[0]).toEqual(jasmine.any(Object));
41   - });
42   -
43   - it('should define a limit per page as default value', function() {
44   - $httpBackend.when('GET', githubContributor.apiHost + '/contributors?per_page=30').respond(200, new Array(30));
45   - var data;
46   - githubContributor.getContributors().then(function(fetchedData) {
47   - data = fetchedData;
48   - });
49   - $httpBackend.flush();
50   - expect(data).toEqual(jasmine.any(Array));
51   - expect(data.length === 30).toBeTruthy();
52   - });
53   -
54   - it('should log a error', function() {
55   - $httpBackend.when('GET', githubContributor.apiHost + '/contributors?per_page=1').respond(500);
56   - githubContributor.getContributors(1);
57   - $httpBackend.flush();
58   - expect($log.error.logs).toEqual(jasmine.stringMatching('XHR Failed for'));
59   - });
60   - });
61   - });
62   -})();
src/app/components/noosfero/noosfero.service.js 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular.module('angular').service('noosfero', noosfero);
  5 +
  6 + function noosfero() {
  7 +
  8 + }
  9 +})();
... ...
src/app/components/webDevTec/webDevTec.service.js
... ... @@ -1,74 +0,0 @@
1   -(function() {
2   - 'use strict';
3   -
4   - angular
5   - .module('angular')
6   - .service('webDevTec', webDevTec);
7   -
8   - /** @ngInject */
9   - function webDevTec() {
10   - var data = [
11   - {
12   - 'title': 'AngularJS',
13   - 'url': 'https://angularjs.org/',
14   - 'description': 'HTML enhanced for web apps!',
15   - 'logo': 'angular.png'
16   - },
17   - {
18   - 'title': 'BrowserSync',
19   - 'url': 'http://browsersync.io/',
20   - 'description': 'Time-saving synchronised browser testing.',
21   - 'logo': 'browsersync.png'
22   - },
23   - {
24   - 'title': 'GulpJS',
25   - 'url': 'http://gulpjs.com/',
26   - 'description': 'The streaming build system.',
27   - 'logo': 'gulp.png'
28   - },
29   - {
30   - 'title': 'Jasmine',
31   - 'url': 'http://jasmine.github.io/',
32   - 'description': 'Behavior-Driven JavaScript.',
33   - 'logo': 'jasmine.png'
34   - },
35   - {
36   - 'title': 'Karma',
37   - 'url': 'http://karma-runner.github.io/',
38   - 'description': 'Spectacular Test Runner for JavaScript.',
39   - 'logo': 'karma.png'
40   - },
41   - {
42   - 'title': 'Protractor',
43   - 'url': 'https://github.com/angular/protractor',
44   - 'description': 'End to end test framework for AngularJS applications built on top of WebDriverJS.',
45   - 'logo': 'protractor.png'
46   - },
47   - {
48   - 'title': 'Bootstrap',
49   - 'url': 'http://getbootstrap.com/',
50   - 'description': 'Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.',
51   - 'logo': 'bootstrap.png'
52   - },
53   - {
54   - 'title': 'Angular UI Bootstrap',
55   - 'url': 'http://angular-ui.github.io/bootstrap/',
56   - 'description': 'Bootstrap components written in pure AngularJS by the AngularUI Team.',
57   - 'logo': 'ui-bootstrap.png'
58   - },
59   - {
60   - 'title': 'Sass (Node)',
61   - 'url': 'https://github.com/sass/node-sass',
62   - 'description': 'Node.js binding to libsass, the C version of the popular stylesheet preprocessor, Sass.',
63   - 'logo': 'node-sass.png'
64   - }
65   - ];
66   -
67   - this.getTec = getTec;
68   -
69   - function getTec() {
70   - return data;
71   - }
72   - }
73   -
74   -})();
src/app/components/webDevTec/webDevTec.service.spec.js
... ... @@ -1,29 +0,0 @@
1   -(function() {
2   - 'use strict';
3   -
4   - describe('service webDevTec', function() {
5   - var webDevTec;
6   -
7   - beforeEach(module('angular'));
8   - beforeEach(inject(function(_webDevTec_) {
9   - webDevTec = _webDevTec_;
10   - }));
11   -
12   - it('should be registered', function() {
13   - expect(webDevTec).not.toEqual(null);
14   - });
15   -
16   - describe('getTec function', function() {
17   - it('should exist', function() {
18   - expect(webDevTec.getTec).not.toEqual(null);
19   - });
20   -
21   - it('should return array of object', function() {
22   - var data = webDevTec.getTec();
23   - expect(data).toEqual(jasmine.any(Array));
24   - expect(data[0]).toEqual(jasmine.any(Object));
25   - expect(data.length > 5).toBeTruthy();
26   - });
27   - });
28   - });
29   -})();
src/app/main/main.controller.js
... ... @@ -6,34 +6,13 @@
6 6 .controller('MainController', MainController);
7 7  
8 8 /** @ngInject */
9   - function MainController($timeout, webDevTec, toastr) {
  9 + function MainController($timeout, noosfero, toastr) {
10 10 var vm = this;
11   -
12   - vm.awesomeThings = [];
13   - vm.classAnimation = '';
14   - vm.creationDate = 1452020281605;
15   - vm.showToastr = showToastr;
16   -
  11 + vm.boxes = [];
17 12 activate();
18 13  
19 14 function activate() {
20   - getWebDevTec();
21   - $timeout(function() {
22   - vm.classAnimation = 'rubberBand';
23   - }, 4000);
24   - }
25   -
26   - function showToastr() {
27   - toastr.info('Fork <a href="https://github.com/Swiip/generator-gulp-angular" target="_blank"><b>generator-gulp-angular</b></a>');
28   - vm.classAnimation = '';
29   - }
30   -
31   - function getWebDevTec() {
32   - vm.awesomeThings = webDevTec.getTec();
33   -
34   - angular.forEach(vm.awesomeThings, function(awesomeThing) {
35   - awesomeThing.rank = Math.random();
36   - });
  15 + // vm.boxes = noosfero.getBoxes();
37 16 }
38 17 }
39 18 })();
... ...
src/app/main/main.controller.spec.js
... ... @@ -7,8 +7,7 @@
7 7 var toastr;
8 8  
9 9 beforeEach(module('angular'));
10   - beforeEach(inject(function(_$controller_, _$timeout_, _webDevTec_, _toastr_) {
11   - spyOn(_webDevTec_, 'getTec').and.returnValue([{}, {}, {}, {}, {}]);
  10 + beforeEach(inject(function(_$controller_, _$timeout_, _toastr_) {
12 11 spyOn(_toastr_, 'info').and.callThrough();
13 12  
14 13 vm = _$controller_('MainController');
... ...
src/app/main/main.html
1 1 <div class="container">
2 2  
3 3 <div>
4   - <acme-navbar creation-date="main.creationDate"></acme-navbar>
5   - </div>
6   -
7   - <div class="jumbotron text-center">
8   - <h1>'Allo, 'Allo!</h1>
9   - <p class="lead">
10   - <img src="assets/images/yeoman.png" alt="I'm Yeoman"><br>
11   - Always a pleasure scaffolding your apps.
12   - </p>
13   - <p class="animated infinite" ng-class="main.classAnimation">
14   - <button type="button" class="btn btn-lg btn-success" ng-click="main.showToastr()">Splendid Toastr</button>
15   - </p>
16   - <p>
17   - With ♥ thanks to the contributions of<acme-malarkey extra-values="['Yeoman', 'Gulp', 'Angular']"></acme-malarkey>
18   - </p>
  4 + <acme-navbar></acme-navbar>
19 5 </div>
20 6  
21 7 <div class="row">
22   - <div class="col-sm-6 col-md-4" ng-repeat="awesomeThing in main.awesomeThings | orderBy:'rank'">
23   - <div class="thumbnail">
24   - <img class="pull-right" ng-src="assets/images/{{ awesomeThing.logo }}" alt="{{ awesomeThing.title }}">
25   - <div class="caption">
26   - <h3>{{ awesomeThing.title }}</h3>
27   - <p>{{ awesomeThing.description }}</p>
28   - <p><a ng-href="{{awesomeThing.url}}">{{ awesomeThing.url }}</a></p>
29   - </div>
30   - </div>
  8 + <div class="col-sm-6 col-md-4" ng-repeat="box in main.boxes">
  9 + {{box}}
31 10 </div>
32 11 </div>
33 12  
... ...