From fc26605fa756d8c58ca01a46743bfddcb3f2dca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s?= Date: Thu, 4 Oct 2018 18:28:07 -0300 Subject: [PATCH] arreglos pre-commit --- package.json | 115 ++++++++++++++++++++++++++------------------------- src/js/controller.js | 43 +++++++++++-------- src/js/service.js | 16 ++++--- 3 files changed, 93 insertions(+), 81 deletions(-) diff --git a/package.json b/package.json index ec041fa..df5f41c 100644 --- a/package.json +++ b/package.json @@ -1,59 +1,60 @@ { - "name": "foca-modal-busqueda-productos", - "version": "0.0.1", - "description": "Menu de navegacion de doble entrada", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "compile": "gulp templates && gulp uglify", - "pre-commit": [ - "gulp-pre-commit" - ], - "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", - "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" - }, - "repository": { - "type": "git", - "url": "https://192.168.0.11/modulos-npm/foca-navegacion-doble" - }, - "author": "Nicolás Guarnieri", - "license": "ISC", - "peerDependencies": { - "angular": "^1.7.4", - "bootstrap": "^4.1.3", - "font-awesome": "^4.7.0", - "ui-bootstrap4": "^3.0.4", - "gulp": "^3.9.1", - "gulp-angular-templatecache": "^2.2.1", - "gulp-concat": "^2.6.1", - "gulp-connect": "^5.6.1", - "gulp-htmlmin": "^5.0.1", - "gulp-rename": "^1.4.0", - "gulp-replace": "^1.0.0", - "gulp-uglify": "^3.0.1", - "jquery": "^3.3.1", - "pump": "^3.0.0", - "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", - }, - "devDependencies": { - "angular": "^1.7.4", - "bootstrap": "^4.1.3", - "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", - "font-awesome": "^4.7.0", - "gulp": "^3.9.1", - "gulp-angular-templatecache": "^2.2.1", - "gulp-concat": "^2.6.1", - "gulp-connect": "^5.6.1", - "gulp-htmlmin": "^5.0.1", - "gulp-jshint": "^2.1.0", - "gulp-rename": "^1.4.0", - "gulp-replace": "^1.0.0", - "gulp-uglify": "^3.0.1", - "jasmine-core": "^3.2.1", - "jquery": "^3.3.1", - "jshint": "^2.9.6", - "pre-commit": "^1.2.2", - "pump": "^3.0.0", - "ui-bootstrap4": "^3.0.4" - } + "name": "foca-modal-busqueda-productos", + "version": "0.0.1", + "description": "Menu de navegacion de doble entrada", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "compile": "gulp templates && gulp uglify", + "gulp-pre-commit": "gulp pre-commit", + "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", + "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" + }, + "pre-commit": [ + "gulp-pre-commit" + ], + "repository": { + "type": "git", + "url": "https://192.168.0.11/modulos-npm/foca-navegacion-doble" + }, + "author": "Nicolás Guarnieri", + "license": "ISC", + "peerDependencies": { + "angular": "^1.7.4", + "bootstrap": "^4.1.3", + "font-awesome": "^4.7.0", + "ui-bootstrap4": "^3.0.4", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.1", + "gulp-concat": "^2.6.1", + "gulp-connect": "^5.6.1", + "gulp-htmlmin": "^5.0.1", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-uglify": "^3.0.1", + "jquery": "^3.3.1", + "pump": "^3.0.0", + "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas" + }, + "devDependencies": { + "angular": "^1.7.4", + "bootstrap": "^4.1.3", + "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas", + "font-awesome": "^4.7.0", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.1", + "gulp-concat": "^2.6.1", + "gulp-connect": "^5.6.1", + "gulp-htmlmin": "^5.0.1", + "gulp-jshint": "^2.1.0", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-uglify": "^3.0.1", + "jasmine-core": "^3.2.1", + "jquery": "^3.3.1", + "jshint": "^2.9.6", + "pre-commit": "^1.2.2", + "pump": "^3.0.0", + "ui-bootstrap4": "^3.0.4" + } } diff --git a/src/js/controller.js b/src/js/controller.js index 4205f0f..2787cca 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -22,15 +22,22 @@ angular.module('focaBusquedaProductos') //METODOS $scope.search = function() { - $scope.filteredProductos = $filter('filter')($scope.productos, {$: $scope.filters}); - $scope.lastPage = Math.ceil($scope.filteredProductos.length / $scope.numPerPage); + $scope.filteredProductos = $filter('filter')( + $scope.productos, + {$: $scope.filters} + ); + + $scope.lastPage = Math.ceil( + $scope.filteredProductos.length / $scope.numPerPage + ); + $scope.resetPage(); - } + }; $scope.resetPage = function() { $scope.currentPage = 1; $scope.selectPage(1); - } + }; $scope.selectPage = function(page) { var start = (page - 1) * $scope.numPerPage; @@ -39,45 +46,45 @@ angular.module('focaBusquedaProductos') $scope.paginas = calcularPages(page); $scope.currentPageProductos = $scope.filteredProductos.slice(start, end); $scope.currentPage = page; - } + }; $scope.select = function(producto) { $uibModalInstance.close(producto); - } + }; $scope.cancel = function() { $uibModalInstance.dismiss('cancel'); - } + }; $scope.busquedaDown = function(key) { if (key === 40) { primera(key); } - } + }; $scope.busquedaPress = function(key) { if (key === 13) { primera(key); } - } + }; $scope.itemProducto = function(key) { - if (key == 38) { + if (key === 38) { anterior(key); } - if (key == 40) { + if (key === 40) { siguiente(key); } - if (key == 37) { + if (key === 37) { retrocederPagina(); } - if (key == 39) { + if (key === 39) { avanzarPagina(); } - } + }; function calcularPages(paginaActual) { var paginas = []; @@ -109,11 +116,11 @@ angular.module('focaBusquedaProductos') return paginas; } - function primera(key) { + function primera() { $scope.selectedProducto = 0; } - function anterior(key) { + function anterior() { if ($scope.selectedProducto === 0 && $scope.currentPage > 1) { retrocederPagina(); } else { @@ -121,7 +128,7 @@ angular.module('focaBusquedaProductos') } } - function siguiente(key) { + function siguiente() { if ($scope.selectedProducto < $scope.currentPageProductos.length - 1 ) { $scope.selectedProducto++; } else { @@ -144,4 +151,4 @@ angular.module('focaBusquedaProductos') } } ] - ) + ); diff --git a/src/js/service.js b/src/js/service.js index 352d279..ba79684 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -1,8 +1,12 @@ angular.module('focaBusquedaProductos') - .service('focaBusquedaProductosService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { - return { - getProductos: function(filtro) { - return $http.get(API_ENDPOINT.URL + '/articulos'); - } + .service('focaBusquedaProductosService', [ + '$http', + 'API_ENDPOINT', + function($http, API_ENDPOINT) { + return { + getProductos: function() { + return $http.get(API_ENDPOINT.URL + '/articulos'); + } + }; } - }]) + ]); -- 1.9.1