Commit a6b73d45200885bbddee0fe6da28e19d2235038e

Authored by Leonardo Merlin
2 parents c12e1455 28caa687

Merge branch 'clean-code'

src/app/components/article-service/article.service.js
@@ -128,7 +128,6 @@ @@ -128,7 +128,6 @@
128 128
129 function getProposalByIdRanked (proposalId, params, cbSuccess, cbError) { 129 function getProposalByIdRanked (proposalId, params, cbSuccess, cbError) {
130 var url = service.apiProposals + proposalId + '/ranking?per_page=5&page=1'; 130 var url = service.apiProposals + proposalId + '/ranking?per_page=5&page=1';
131 - console.log(url);  
132 var paramsExtended = angular.extend({ 131 var paramsExtended = angular.extend({
133 // 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'], 132 // 'fields[]': ['id', 'title', 'abstract', 'children', 'children_count', 'ranking_position', 'hits', 'votes_for', 'votes_against'],
134 // 'per_page':'1', 133 // 'per_page':'1',
@@ -283,7 +282,6 @@ @@ -283,7 +282,6 @@
283 function searchProposals (params, cbSuccess, cbError) { 282 function searchProposals (params, cbSuccess, cbError) {
284 // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Proposal&query=cisternas 283 // Ex.: /api/v1/search/article?type=ProposalsDiscussionPlugin::Proposal&query=cisternas
285 var url = service.apiSearch + 'article'; 284 var url = service.apiSearch + 'article';
286 - console.log('url',url);  
287 var paramsExtended = angular.extend({ 285 var paramsExtended = angular.extend({
288 page: 1, 286 page: 1,
289 per_page: 10, 287 per_page: 10,
@@ -306,8 +304,6 @@ @@ -306,8 +304,6 @@
306 ] 304 ]
307 }, params); 305 }, params);
308 306
309 - console.log("params",paramsExtended);  
310 -  
311 UtilService.get(url, {params: paramsExtended}).then(function(data){ 307 UtilService.get(url, {params: paramsExtended}).then(function(data){
312 _pipeInjectSlugIntoParentProgram(data); 308 _pipeInjectSlugIntoParentProgram(data);
313 cbSuccess(data); 309 cbSuccess(data);
src/app/components/category-list/category-list.directive.js
@@ -21,7 +21,6 @@ @@ -21,7 +21,6 @@
21 vm.$element = $element; 21 vm.$element = $element;
22 vm.$log = $log; 22 vm.$log = $log;
23 23
24 -  
25 // initialization 24 // initialization
26 vm.init(); 25 vm.init();
27 } 26 }
@@ -33,13 +32,13 @@ @@ -33,13 +32,13 @@
33 32
34 vm.showCloseBtn = true; 33 vm.showCloseBtn = true;
35 34
36 - // Disable button remove of page ranking  
37 - if(vm.pathUrl=="/ranking"){ 35 + // Disable button 'remove' of page ranking
  36 + if (vm.pathUrl === '/ranking') {
38 vm.showCloseBtn = false; 37 vm.showCloseBtn = false;
39 } 38 }
40 39
41 // Default values 40 // Default values
42 - if(!vm.isCollapsed){ 41 + if (!vm.isCollapsed) {
43 vm.isCollapsed = false; 42 vm.isCollapsed = false;
44 } 43 }
45 44
@@ -48,14 +47,13 @@ @@ -48,14 +47,13 @@
48 CategoryListController.prototype._disableUnselect = function() { 47 CategoryListController.prototype._disableUnselect = function() {
49 var vm = this; 48 var vm = this;
50 49
51 - if(vm.disableUnselect && vm.disableUnselect === 'true'){ 50 + if (vm.disableUnselect && vm.disableUnselect === 'true') {
52 return true; 51 return true;
53 } 52 }
54 53
55 return false; 54 return false;
56 }; 55 };
57 56
58 -  
59 CategoryListController.prototype.selectCategory = function(category, $event) { 57 CategoryListController.prototype.selectCategory = function(category, $event) {
60 var vm = this; 58 var vm = this;
61 59
@@ -65,9 +63,9 @@ @@ -65,9 +63,9 @@
65 if (category !== vm.selectedCategory) { 63 if (category !== vm.selectedCategory) {
66 vm.selectedCategory = category; 64 vm.selectedCategory = category;
67 65
68 - }else{ 66 + }else {
69 67
70 - if(vm._disableUnselect()){ 68 + if (vm._disableUnselect()) {
71 vm.$log.info('Unselect is disabled.'); 69 vm.$log.info('Unselect is disabled.');
72 return; 70 return;
73 } 71 }
@@ -79,11 +77,10 @@ @@ -79,11 +77,10 @@
79 vm.$rootScope.$broadcast('change-selectedCategory', vm.selectedCategory); 77 vm.$rootScope.$broadcast('change-selectedCategory', vm.selectedCategory);
80 }; 78 };
81 79
82 -  
83 CategoryListController.prototype.toogleList = function() { 80 CategoryListController.prototype.toogleList = function() {
84 var vm = this; 81 var vm = this;
85 82
86 - if(!vm._listGroup){ 83 + if (!vm._listGroup) {
87 vm._listGroup = vm.$element.find('.list-group'); 84 vm._listGroup = vm.$element.find('.list-group');
88 } 85 }
89 vm._listGroup.slideToggle(); 86 vm._listGroup.slideToggle();
@@ -105,4 +102,4 @@ @@ -105,4 +102,4 @@
105 return directive; 102 return directive;
106 } 103 }
107 104
108 -})();  
109 \ No newline at end of file 105 \ No newline at end of file
  106 +})();
src/app/components/proposal-box/proposal-box.directive.js
@@ -84,8 +84,6 @@ @@ -84,8 +84,6 @@
84 } 84 }
85 85
86 vm.messageCode = data.code; 86 vm.messageCode = data.code;
87 - console.log("voto");  
88 - console.log(vm.message);  
89 }); 87 });
90 88
91 // Load captcha 89 // Load captcha
src/app/components/proposal-carousel/proposal-carousel.directive.js
@@ -22,11 +22,11 @@ @@ -22,11 +22,11 @@
22 vm.init(); 22 vm.init();
23 } 23 }
24 24
25 - ProposalCarouselController.prototype.init = function () { 25 + ProposalCarouselController.prototype.init = function() {
26 // initial values 26 // initial values
27 var vm = this; 27 var vm = this;
28 28
29 - if(!vm.proposals){ 29 + if (!vm.proposals) {
30 throw { name: 'NotDefined', message: 'The attribute "proposals" is undefined.'}; 30 throw { name: 'NotDefined', message: 'The attribute "proposals" is undefined.'};
31 } 31 }
32 32
@@ -36,38 +36,38 @@ @@ -36,38 +36,38 @@
36 vm.proposalsLength = vm.proposals.length; 36 vm.proposalsLength = vm.proposals.length;
37 }; 37 };
38 38
39 - ProposalCarouselController.prototype.swipeLeft = function () { 39 + ProposalCarouselController.prototype.swipeLeft = function() {
40 var vm = this; 40 var vm = this;
41 41
42 vm.activeIndex = (vm.activeIndex < vm.proposalsLength - 1) ? ++vm.activeIndex : 0; 42 vm.activeIndex = (vm.activeIndex < vm.proposalsLength - 1) ? ++vm.activeIndex : 0;
43 }; 43 };
44 44
45 - ProposalCarouselController.prototype.swipeRight = function () { 45 + ProposalCarouselController.prototype.swipeRight = function() {
46 var vm = this; 46 var vm = this;
47 47
48 vm.activeIndex = (vm.activeIndex > 0) ? --vm.activeIndex : vm.proposalsLength - 1; 48 vm.activeIndex = (vm.activeIndex > 0) ? --vm.activeIndex : vm.proposalsLength - 1;
49 }; 49 };
50 50
51 - ProposalCarouselController.prototype.switchProposal = function (index) { 51 + ProposalCarouselController.prototype.switchProposal = function(index) {
52 var vm = this; 52 var vm = this;
53 53
54 - if(index >= 0 && index < vm.proposalsLength) { 54 + if (index >= 0 && index < vm.proposalsLength) {
55 vm.activeIndex = index; 55 vm.activeIndex = index;
56 - }else{ 56 + }else {
57 vm.$log.warn('[switchProposal] "index" not handled:', index); 57 vm.$log.warn('[switchProposal] "index" not handled:', index);
58 } 58 }
59 }; 59 };
60 60
61 - ProposalCarouselController.prototype.showProposalsList = function () { 61 + ProposalCarouselController.prototype.showProposalsList = function() {
62 var vm = this; 62 var vm = this;
63 63
64 // notify parents - handled by parents 64 // notify parents - handled by parents
65 vm.$scope.$emit('proposal-carousel:showProposalsList'); 65 vm.$scope.$emit('proposal-carousel:showProposalsList');
66 }; 66 };
67 67
68 - ProposalCarouselController.prototype.showContent = function (proposal) { 68 + ProposalCarouselController.prototype.showContent = function(proposal) {
69 var vm = this; 69 var vm = this;
70 - console.log("PROPOSAL-CARROUSEL",proposal); 70 +
71 vm.$state.go('programa', { 71 vm.$state.go('programa', {
72 slug: proposal.parent.slug, 72 slug: proposal.parent.slug,
73 proposal_id: proposal.proposal_id 73 proposal_id: proposal.proposal_id
@@ -89,8 +89,7 @@ @@ -89,8 +89,7 @@
89 bindToController: true 89 bindToController: true
90 }; 90 };
91 91
92 -  
93 return directive; 92 return directive;
94 } 93 }
95 94
96 -})();  
97 \ No newline at end of file 95 \ No newline at end of file
  96 +})();
src/app/components/proposal-list/proposal-list.directive.js
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 36
37 ProposalListController.prototype.showContent = function (proposal) { 37 ProposalListController.prototype.showContent = function (proposal) {
38 var vm = this; 38 var vm = this;
39 - console.log("PROPOSAL-LIST",proposal); 39 +
40 vm.$state.go('programa', { 40 vm.$state.go('programa', {
41 slug: proposal.parent.slug, 41 slug: proposal.parent.slug,
42 proposal_id: proposal.proposal_id 42 proposal_id: proposal.proposal_id
src/app/pages/auth/auth.controller.js
@@ -100,7 +100,7 @@ @@ -100,7 +100,7 @@
100 vm.$log.debug('response', response); 100 vm.$log.debug('response', response);
101 101
102 var logged_in = response.data.logged_in; 102 var logged_in = response.data.logged_in;
103 - var message = response.data.message; 103 + // var message = response.data.message;
104 var private_token = response.data.private_token; 104 var private_token = response.data.private_token;
105 105
106 // Garante que o 'user' sempre terá a propriedade 'private_token' 106 // Garante que o 'user' sempre terá a propriedade 'private_token'
src/app/pages/programas/programa.controller.js
@@ -93,7 +93,7 @@ @@ -93,7 +93,7 @@
93 } else { 93 } else {
94 vm.proposals = data.proposals; 94 vm.proposals = data.proposals;
95 } 95 }
96 - console.log("-------------",vm.proposals); 96 +
97 vm.proposalsTopFive = vm.proposals.slice(0, 5); 97 vm.proposalsTopFive = vm.proposals.slice(0, 5);
98 vm.proposalsTopRated = vm.proposals.slice(0, 3); 98 vm.proposalsTopRated = vm.proposals.slice(0, 3);
99 vm.loadingTopProposals = false; 99 vm.loadingTopProposals = false;
src/app/pages/propostas/propostas.controller.js
@@ -172,7 +172,7 @@ @@ -172,7 +172,7 @@
172 vm.DialogaService.searchProposals(params, function(data){ 172 vm.DialogaService.searchProposals(params, function(data){
173 vm.total_proposals = parseInt(data._obj.headers('total')); 173 vm.total_proposals = parseInt(data._obj.headers('total'));
174 vm.filtredProposals = data.articles; 174 vm.filtredProposals = data.articles;
175 - console.log("FiltredProposals",vm.filtredProposals); 175 +
176 vm.loadingProposals = false; 176 vm.loadingProposals = false;
177 }, function (error) { 177 }, function (error) {
178 vm.error = error; 178 vm.error = error;
src/app/pages/ranking/ranking.controller.js
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 vm.search = vm.$location.search(); 38 vm.search = vm.$location.search();
39 //Remove "X" from the theme at the ranking page 39 //Remove "X" from the theme at the ranking page
40 vm.slug = vm.$location.$$path; 40 vm.slug = vm.$location.$$path;
41 - console.log("aqui",vm.$location.$$path); 41 +
42 42
43 if (vm.search.tema) { 43 if (vm.search.tema) {
44 vm._filtredByThemeSlug = vm.search.tema; 44 vm._filtredByThemeSlug = vm.search.tema;
src/app/pages/respostas/respostas.controller.js
@@ -200,8 +200,7 @@ @@ -200,8 +200,7 @@
200 200
201 vm.total_proposals = parseInt(data._obj.headers('total')); 201 vm.total_proposals = parseInt(data._obj.headers('total'));
202 vm.filtredProposals = data.articles; 202 vm.filtredProposals = data.articles;
203 - console.log("vm.filtredProposals",vm.filtredProposals);  
204 - 203 +
205 vm.loadingProposals = false; 204 vm.loadingProposals = false;
206 }, function (error) { 205 }, function (error) {
207 vm.error = error; 206 vm.error = error;