Commit e7ad1a7a5abd6a900493198ed241029be3e3b922

Authored by Eric Fernandez
1 parent 5ae8cec1c5
Exists in master

code review

Showing 1 changed file with 5 additions and 12 deletions   Show diff stats
src/js/controllerModal.js
... ... @@ -25,7 +25,7 @@ angular.module('focaModal')
25 25 $scope.selectedEntidad = -1;
26 26  
27 27 $scope.busquedaPress = function(key) {
28   - if (key === 13) {
  28 + if(key === 13) {
29 29 $scope.searchLoading = true;
30 30 focaModalService.getEntidad($scope.filters, query).then(
31 31 function(res) {
... ... @@ -49,7 +49,7 @@ angular.module('focaModal')
49 49 $scope.filteredEntidades.length / $scope.numPerPage
50 50 );
51 51 $scope.resetPage();
52   - }else if(pressed){
  52 + }else if(pressed) {
53 53 $timeout(function() {
54 54 angular.element('#search')[0].focus();
55 55 $scope.filters = '';
... ... @@ -89,15 +89,12 @@ angular.module('focaModal')
89 89 if (key === 38) {
90 90 anterior(key);
91 91 }
92   -
93 92 if (key === 40) {
94 93 siguiente(key);
95 94 }
96   -
97 95 if (key === 37) {
98 96 retrocederPagina();
99 97 }
100   -
101 98 if (key === 39) {
102 99 avanzarPagina();
103 100 }
... ... @@ -114,22 +111,18 @@ angular.module('focaModal')
114 111 paginas.unshift(paginaActual - 2);
115 112 }
116 113 }
117   -
118 114 if (paginaActual + 1 < $scope.lastPage) {
119 115 paginas.push(paginaActual + 1);
120 116 if (paginaActual + 2 < $scope.lastPage) {
121 117 paginas.push(paginaActual + 2);
122 118 }
123 119 }
124   -
125 120 if (paginaActual !== 1) {
126 121 paginas.unshift(1);
127 122 }
128   -
129 123 if (paginaActual !== $scope.lastPage) {
130 124 paginas.push($scope.lastPage);
131 125 }
132   -
133 126 return paginas;
134 127 }
135 128  
... ... @@ -138,7 +131,7 @@ angular.module(&#39;focaModal&#39;)
138 131 }
139 132  
140 133 function anterior() {
141   - if ($scope.selectedEntidad === 0 && $scope.currentPage > 1) {
  134 + if($scope.selectedEntidad === 0 && $scope.currentPage > 1) {
142 135 retrocederPagina();
143 136 } else {
144 137 $scope.selectedEntidad--;
... ... @@ -146,7 +139,7 @@ angular.module(&#39;focaModal&#39;)
146 139 }
147 140  
148 141 function siguiente() {
149   - if ($scope.selectedEntidad < $scope.currentPageEntidades.length - 1) {
  142 + if($scope.selectedEntidad < $scope.currentPageEntidades.length - 1) {
150 143 $scope.selectedEntidad++;
151 144 } else {
152 145 avanzarPagina();
... ... @@ -161,7 +154,7 @@ angular.module(&#39;focaModal&#39;)
161 154 }
162 155  
163 156 function avanzarPagina() {
164   - if ($scope.currentPage < $scope.lastPage) {
  157 + if($scope.currentPage < $scope.lastPage) {
165 158 $scope.selectPage($scope.currentPage + 1);
166 159 $scope.selectedEntidad = 0;
167 160 }