Commit fc26605fa756d8c58ca01a46743bfddcb3f2dca8
1 parent
31d2d74a10
Exists in
master
and in
1 other branch
arreglos pre-commit
Showing
3 changed files
with
93 additions
and
81 deletions
Show diff stats
package.json
| 1 | 1 | { |
| 2 | - "name": "foca-modal-busqueda-productos", | |
| 3 | - "version": "0.0.1", | |
| 4 | - "description": "Menu de navegacion de doble entrada", | |
| 5 | - "main": "index.js", | |
| 6 | - "scripts": { | |
| 7 | - "test": "echo \"Error: no test specified\" && exit 1", | |
| 8 | - "compile": "gulp templates && gulp uglify", | |
| 9 | - "pre-commit": [ | |
| 10 | - "gulp-pre-commit" | |
| 11 | - ], | |
| 12 | - "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", | |
| 13 | - "install-dev": "npm install angular bootstrap jquery font-awesome gulp gulp-concat gulp-jshint gulp-rename gulp-replace gulp-uglify-es jshint pump gulp-connect jasmine-core pre-commit" | |
| 14 | - }, | |
| 15 | - "repository": { | |
| 16 | - "type": "git", | |
| 17 | - "url": "https://192.168.0.11/modulos-npm/foca-navegacion-doble" | |
| 18 | - }, | |
| 19 | - "author": "Nicolás Guarnieri", | |
| 20 | - "license": "ISC", | |
| 21 | - "peerDependencies": { | |
| 22 | - "angular": "^1.7.4", | |
| 23 | - "bootstrap": "^4.1.3", | |
| 24 | - "font-awesome": "^4.7.0", | |
| 25 | - "ui-bootstrap4": "^3.0.4", | |
| 26 | - "gulp": "^3.9.1", | |
| 27 | - "gulp-angular-templatecache": "^2.2.1", | |
| 28 | - "gulp-concat": "^2.6.1", | |
| 29 | - "gulp-connect": "^5.6.1", | |
| 30 | - "gulp-htmlmin": "^5.0.1", | |
| 31 | - "gulp-rename": "^1.4.0", | |
| 32 | - "gulp-replace": "^1.0.0", | |
| 33 | - "gulp-uglify": "^3.0.1", | |
| 34 | - "jquery": "^3.3.1", | |
| 35 | - "pump": "^3.0.0", | |
| 36 | - "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", | |
| 37 | - }, | |
| 38 | - "devDependencies": { | |
| 39 | - "angular": "^1.7.4", | |
| 40 | - "bootstrap": "^4.1.3", | |
| 41 | - "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", | |
| 42 | - "font-awesome": "^4.7.0", | |
| 43 | - "gulp": "^3.9.1", | |
| 44 | - "gulp-angular-templatecache": "^2.2.1", | |
| 45 | - "gulp-concat": "^2.6.1", | |
| 46 | - "gulp-connect": "^5.6.1", | |
| 47 | - "gulp-htmlmin": "^5.0.1", | |
| 48 | - "gulp-jshint": "^2.1.0", | |
| 49 | - "gulp-rename": "^1.4.0", | |
| 50 | - "gulp-replace": "^1.0.0", | |
| 51 | - "gulp-uglify": "^3.0.1", | |
| 52 | - "jasmine-core": "^3.2.1", | |
| 53 | - "jquery": "^3.3.1", | |
| 54 | - "jshint": "^2.9.6", | |
| 55 | - "pre-commit": "^1.2.2", | |
| 56 | - "pump": "^3.0.0", | |
| 57 | - "ui-bootstrap4": "^3.0.4" | |
| 58 | - } | |
| 2 | + "name": "foca-modal-busqueda-productos", | |
| 3 | + "version": "0.0.1", | |
| 4 | + "description": "Menu de navegacion de doble entrada", | |
| 5 | + "main": "index.js", | |
| 6 | + "scripts": { | |
| 7 | + "test": "echo \"Error: no test specified\" && exit 1", | |
| 8 | + "compile": "gulp templates && gulp uglify", | |
| 9 | + "gulp-pre-commit": "gulp pre-commit", | |
| 10 | + "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", | |
| 11 | + "install-dev": "npm install angular bootstrap jquery font-awesome gulp gulp-concat gulp-jshint gulp-rename gulp-replace gulp-uglify-es jshint pump gulp-connect jasmine-core pre-commit" | |
| 12 | + }, | |
| 13 | + "pre-commit": [ | |
| 14 | + "gulp-pre-commit" | |
| 15 | + ], | |
| 16 | + "repository": { | |
| 17 | + "type": "git", | |
| 18 | + "url": "https://192.168.0.11/modulos-npm/foca-navegacion-doble" | |
| 19 | + }, | |
| 20 | + "author": "Nicolás Guarnieri", | |
| 21 | + "license": "ISC", | |
| 22 | + "peerDependencies": { | |
| 23 | + "angular": "^1.7.4", | |
| 24 | + "bootstrap": "^4.1.3", | |
| 25 | + "font-awesome": "^4.7.0", | |
| 26 | + "ui-bootstrap4": "^3.0.4", | |
| 27 | + "gulp": "^3.9.1", | |
| 28 | + "gulp-angular-templatecache": "^2.2.1", | |
| 29 | + "gulp-concat": "^2.6.1", | |
| 30 | + "gulp-connect": "^5.6.1", | |
| 31 | + "gulp-htmlmin": "^5.0.1", | |
| 32 | + "gulp-rename": "^1.4.0", | |
| 33 | + "gulp-replace": "^1.0.0", | |
| 34 | + "gulp-uglify": "^3.0.1", | |
| 35 | + "jquery": "^3.3.1", | |
| 36 | + "pump": "^3.0.0", | |
| 37 | + "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas" | |
| 38 | + }, | |
| 39 | + "devDependencies": { | |
| 40 | + "angular": "^1.7.4", | |
| 41 | + "bootstrap": "^4.1.3", | |
| 42 | + "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", | |
| 43 | + "font-awesome": "^4.7.0", | |
| 44 | + "gulp": "^3.9.1", | |
| 45 | + "gulp-angular-templatecache": "^2.2.1", | |
| 46 | + "gulp-concat": "^2.6.1", | |
| 47 | + "gulp-connect": "^5.6.1", | |
| 48 | + "gulp-htmlmin": "^5.0.1", | |
| 49 | + "gulp-jshint": "^2.1.0", | |
| 50 | + "gulp-rename": "^1.4.0", | |
| 51 | + "gulp-replace": "^1.0.0", | |
| 52 | + "gulp-uglify": "^3.0.1", | |
| 53 | + "jasmine-core": "^3.2.1", | |
| 54 | + "jquery": "^3.3.1", | |
| 55 | + "jshint": "^2.9.6", | |
| 56 | + "pre-commit": "^1.2.2", | |
| 57 | + "pump": "^3.0.0", | |
| 58 | + "ui-bootstrap4": "^3.0.4" | |
| 59 | + } | |
| 59 | 60 | } |
src/js/controller.js
| ... | ... | @@ -22,15 +22,22 @@ angular.module('focaBusquedaProductos') |
| 22 | 22 | |
| 23 | 23 | //METODOS |
| 24 | 24 | $scope.search = function() { |
| 25 | - $scope.filteredProductos = $filter('filter')($scope.productos, {$: $scope.filters}); | |
| 26 | - $scope.lastPage = Math.ceil($scope.filteredProductos.length / $scope.numPerPage); | |
| 25 | + $scope.filteredProductos = $filter('filter')( | |
| 26 | + $scope.productos, | |
| 27 | + {$: $scope.filters} | |
| 28 | + ); | |
| 29 | + | |
| 30 | + $scope.lastPage = Math.ceil( | |
| 31 | + $scope.filteredProductos.length / $scope.numPerPage | |
| 32 | + ); | |
| 33 | + | |
| 27 | 34 | $scope.resetPage(); |
| 28 | - } | |
| 35 | + }; | |
| 29 | 36 | |
| 30 | 37 | $scope.resetPage = function() { |
| 31 | 38 | $scope.currentPage = 1; |
| 32 | 39 | $scope.selectPage(1); |
| 33 | - } | |
| 40 | + }; | |
| 34 | 41 | |
| 35 | 42 | $scope.selectPage = function(page) { |
| 36 | 43 | var start = (page - 1) * $scope.numPerPage; |
| ... | ... | @@ -39,45 +46,45 @@ angular.module('focaBusquedaProductos') |
| 39 | 46 | $scope.paginas = calcularPages(page); |
| 40 | 47 | $scope.currentPageProductos = $scope.filteredProductos.slice(start, end); |
| 41 | 48 | $scope.currentPage = page; |
| 42 | - } | |
| 49 | + }; | |
| 43 | 50 | |
| 44 | 51 | $scope.select = function(producto) { |
| 45 | 52 | $uibModalInstance.close(producto); |
| 46 | - } | |
| 53 | + }; | |
| 47 | 54 | |
| 48 | 55 | $scope.cancel = function() { |
| 49 | 56 | $uibModalInstance.dismiss('cancel'); |
| 50 | - } | |
| 57 | + }; | |
| 51 | 58 | |
| 52 | 59 | $scope.busquedaDown = function(key) { |
| 53 | 60 | if (key === 40) { |
| 54 | 61 | primera(key); |
| 55 | 62 | } |
| 56 | - } | |
| 63 | + }; | |
| 57 | 64 | |
| 58 | 65 | $scope.busquedaPress = function(key) { |
| 59 | 66 | if (key === 13) { |
| 60 | 67 | primera(key); |
| 61 | 68 | } |
| 62 | - } | |
| 69 | + }; | |
| 63 | 70 | |
| 64 | 71 | $scope.itemProducto = function(key) { |
| 65 | - if (key == 38) { | |
| 72 | + if (key === 38) { | |
| 66 | 73 | anterior(key); |
| 67 | 74 | } |
| 68 | 75 | |
| 69 | - if (key == 40) { | |
| 76 | + if (key === 40) { | |
| 70 | 77 | siguiente(key); |
| 71 | 78 | } |
| 72 | 79 | |
| 73 | - if (key == 37) { | |
| 80 | + if (key === 37) { | |
| 74 | 81 | retrocederPagina(); |
| 75 | 82 | } |
| 76 | 83 | |
| 77 | - if (key == 39) { | |
| 84 | + if (key === 39) { | |
| 78 | 85 | avanzarPagina(); |
| 79 | 86 | } |
| 80 | - } | |
| 87 | + }; | |
| 81 | 88 | |
| 82 | 89 | function calcularPages(paginaActual) { |
| 83 | 90 | var paginas = []; |
| ... | ... | @@ -109,11 +116,11 @@ angular.module('focaBusquedaProductos') |
| 109 | 116 | return paginas; |
| 110 | 117 | } |
| 111 | 118 | |
| 112 | - function primera(key) { | |
| 119 | + function primera() { | |
| 113 | 120 | $scope.selectedProducto = 0; |
| 114 | 121 | } |
| 115 | 122 | |
| 116 | - function anterior(key) { | |
| 123 | + function anterior() { | |
| 117 | 124 | if ($scope.selectedProducto === 0 && $scope.currentPage > 1) { |
| 118 | 125 | retrocederPagina(); |
| 119 | 126 | } else { |
| ... | ... | @@ -121,7 +128,7 @@ angular.module('focaBusquedaProductos') |
| 121 | 128 | } |
| 122 | 129 | } |
| 123 | 130 | |
| 124 | - function siguiente(key) { | |
| 131 | + function siguiente() { | |
| 125 | 132 | if ($scope.selectedProducto < $scope.currentPageProductos.length - 1 ) { |
| 126 | 133 | $scope.selectedProducto++; |
| 127 | 134 | } else { |
| ... | ... | @@ -144,4 +151,4 @@ angular.module('focaBusquedaProductos') |
| 144 | 151 | } |
| 145 | 152 | } |
| 146 | 153 | ] |
| 147 | - ) | |
| 154 | + ); |
src/js/service.js
| 1 | 1 | angular.module('focaBusquedaProductos') |
| 2 | - .service('focaBusquedaProductosService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
| 3 | - return { | |
| 4 | - getProductos: function(filtro) { | |
| 5 | - return $http.get(API_ENDPOINT.URL + '/articulos'); | |
| 6 | - } | |
| 2 | + .service('focaBusquedaProductosService', [ | |
| 3 | + '$http', | |
| 4 | + 'API_ENDPOINT', | |
| 5 | + function($http, API_ENDPOINT) { | |
| 6 | + return { | |
| 7 | + getProductos: function() { | |
| 8 | + return $http.get(API_ENDPOINT.URL + '/articulos'); | |
| 9 | + } | |
| 10 | + }; | |
| 7 | 11 | } |
| 8 | - }]) | |
| 12 | + ]); |