Commit b41db83e39557a7a861b8f8c892adffcb376cd49
Exists in
master
merge conflicts
Showing
4 changed files
Show diff stats
package.json
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | "description": "Componente de botonera lateral", |
| 5 | 5 | "main": "index.js", |
| 6 | 6 | "scripts": { |
| 7 | + "refresh": "gulp uglify && cp tmp/foca-botonera-lateral.js ../wrapper-demo/node_modules/foca-botonera-lateral/dist/foca-botonera-lateral.min.js", | |
| 7 | 8 | "test": "echo \"Error: no test specified\" && exit 1", |
| 8 | 9 | "compile": "gulp uglify", |
| 9 | 10 | "gulp-pre-commit": "gulp pre-commit", |
src/js/controller.js
| ... | ... | @@ -4,28 +4,29 @@ angular.module('focaBotoneraLateral') |
| 4 | 4 | '$location', |
| 5 | 5 | '$window', |
| 6 | 6 | 'focaBotoneraLateralService', |
| 7 | - function($scope, $location, $window, focaBotoneraLateralService) { | |
| 7 | + function ($scope, $location, $window, focaBotoneraLateralService) { | |
| 8 | 8 | |
| 9 | 9 | $scope.botones = focaBotoneraLateralService.botones; |
| 10 | 10 | |
| 11 | - $scope.pausar = function() { | |
| 11 | + $scope.pausar = function () { | |
| 12 | 12 | focaBotoneraLateralService.setLSItem(); |
| 13 | + focaBotoneraLateralService.setLSRuta(); | |
| 13 | 14 | $location.path('/'); |
| 14 | 15 | }; |
| 15 | 16 | |
| 16 | - $scope.cambioUsoTeclado = function() { | |
| 17 | + $scope.cambioUsoTeclado = function () { | |
| 17 | 18 | $scope.$parent.cambioUsoTeclado(); |
| 18 | 19 | }; |
| 19 | 20 | |
| 20 | - $scope.salir = function() { | |
| 21 | + $scope.salir = function () { | |
| 21 | 22 | $location.path('/'); |
| 22 | 23 | }; |
| 23 | 24 | |
| 24 | - $scope.cancelar = function() { | |
| 25 | + $scope.cancelar = function () { | |
| 25 | 26 | if ($scope.botones.pathCancelar) { |
| 26 | 27 | $location.path($scope.botones.pathCancelar); |
| 27 | 28 | } else { |
| 28 | 29 | $window.history.back(); |
| 29 | 30 | } |
| 30 | 31 | }; |
| 31 | - }]); | |
| 32 | + }]); |
src/js/service.js
| 1 | 1 | angular.module('focaBotoneraLateral') |
| 2 | 2 | .service('focaBotoneraLateralService', ['$localStorage', |
| 3 | - function($localStorage) { | |
| 3 | + function ($localStorage) { | |
| 4 | 4 | |
| 5 | - this.botones = { | |
| 6 | - teclado: true, | |
| 7 | - salir: false, | |
| 8 | - cancelar: false, | |
| 9 | - pausar: false, | |
| 10 | - guardar: false, | |
| 11 | - guardando: false, | |
| 12 | - funcionGuardar: undefined, | |
| 13 | - pathCancelar: undefined, | |
| 14 | - custom: [] | |
| 15 | - }; | |
| 5 | + this.botones = { | |
| 6 | + teclado: true, | |
| 7 | + salir: false, | |
| 8 | + cancelar: false, | |
| 9 | + pausar: false, | |
| 10 | + guardar: false, | |
| 11 | + guardando: false, | |
| 12 | + funcionGuardar: undefined, | |
| 13 | + pathCancelar: undefined, | |
| 14 | + custom: [] | |
| 15 | + }; | |
| 16 | 16 | |
| 17 | - this.pausarData = { | |
| 18 | - label: '', | |
| 19 | - val: '' | |
| 20 | - }; | |
| 17 | + this.pausarData = { | |
| 18 | + label: '', | |
| 19 | + val: '' | |
| 20 | + }; | |
| 21 | 21 | |
| 22 | - this.showTeclado = function(value) { | |
| 23 | - this.botones.teclado = value; | |
| 24 | - }; | |
| 25 | - this.showSalir = function(value) { | |
| 26 | - this.botones.custom = []; | |
| 27 | - this.botones.salir = value; | |
| 28 | - }; | |
| 29 | - this.showPausar = function(value) { | |
| 30 | - this.botones.custom = []; | |
| 31 | - this.botones.pausar = value; | |
| 32 | - }; | |
| 33 | - this.setPausarData = function(obj) { | |
| 34 | - this.pausarData = obj; | |
| 35 | - }; | |
| 36 | - this.showCancelar = function(value, path) { | |
| 37 | - this.botones.custom = []; | |
| 38 | - this.botones.cancelar = value; | |
| 39 | - this.botones.pathCancelar = (path) ? path : undefined; | |
| 40 | - }; | |
| 41 | - this.showGuardar = function(value, funcion) { | |
| 42 | - angular.element('#guardar').removeClass('guardado'); | |
| 43 | - this.botones.custom = []; | |
| 44 | - this.botones.guardar = value; | |
| 45 | - if (value) this.botones.funcionGuardar = funcion; | |
| 46 | - }; | |
| 47 | - this.addCustomButton = function(title, funcion) { | |
| 48 | - this.botones.custom.push({ | |
| 49 | - title: title, | |
| 50 | - funcion: funcion | |
| 51 | - }); | |
| 52 | - }; | |
| 53 | - this.startGuardar = function() { | |
| 54 | - this.botones.guardando = true; | |
| 55 | - }; | |
| 56 | - this.endGuardar = function(guardado) { | |
| 57 | - this.botones.guardando = false; | |
| 58 | - if (guardado) angular.element('#guardar').addClass('guardado'); | |
| 59 | - }; | |
| 22 | + this.rutasPausadas = { | |
| 23 | + label: 'rutas', | |
| 24 | + val: [] | |
| 25 | + }; | |
| 60 | 26 | |
| 61 | - this.setLSItem = function() { | |
| 62 | - $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val); | |
| 63 | - }; | |
| 64 | - }]); | |
| 27 | + this.showTeclado = function (value) { | |
| 28 | + this.botones.teclado = value; | |
| 29 | + }; | |
| 30 | + this.showSalir = function (value) { | |
| 31 | + this.botones.custom = []; | |
| 32 | + this.botones.salir = value; | |
| 33 | + }; | |
| 34 | + this.showPausar = function (value) { | |
| 35 | + this.botones.custom = []; | |
| 36 | + this.botones.pausar = value; | |
| 37 | + }; | |
| 38 | + this.setPausarData = function (obj) { | |
| 39 | + this.pausarData = obj; | |
| 40 | + }; | |
| 41 | + this.setRutasPausadas = function (obj) { | |
| 42 | + var auxArray = []; | |
| 43 | + this.rutasPausadas.val.push(obj.val); | |
| 44 | + angular.forEach(this.rutasPausadas.val, function (ruta) { | |
| 45 | + var exists = false; | |
| 46 | + angular.forEach(auxArray, function (val2) { | |
| 47 | + if (angular.equals(ruta, val2)) { exists = true }; | |
| 48 | + }); | |
| 49 | + if (exists == false && ruta !== "") { auxArray.push(ruta); } | |
| 50 | + }); | |
| 51 | + | |
| 52 | + this.rutasPausadas.val = auxArray; | |
| 53 | + }; | |
| 54 | + this.showCancelar = function (value, path) { | |
| 55 | + this.botones.custom = []; | |
| 56 | + this.botones.cancelar = value; | |
| 57 | + this.botones.pathCancelar = (path) ? path : undefined; | |
| 58 | + }; | |
| 59 | + this.showGuardar = function (value, funcion) { | |
| 60 | + angular.element('#guardar').removeClass('guardado'); | |
| 61 | + this.botones.custom = []; | |
| 62 | + this.botones.guardar = value; | |
| 63 | + if (value) this.botones.funcionGuardar = funcion; | |
| 64 | + }; | |
| 65 | + this.addCustomButton = function (title, funcion) { | |
| 66 | + this.botones.custom.push({ | |
| 67 | + title: title, | |
| 68 | + funcion: funcion | |
| 69 | + }); | |
| 70 | + }; | |
| 71 | + this.startGuardar = function () { | |
| 72 | + this.botones.guardando = true; | |
| 73 | + }; | |
| 74 | + this.endGuardar = function (guardado) { | |
| 75 | + this.botones.guardando = false; | |
| 76 | + if (guardado) angular.element('#guardar').addClass('guardado'); | |
| 77 | + }; | |
| 78 | + | |
| 79 | + this.setLSItem = function () { | |
| 80 | + $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val); | |
| 81 | + }; | |
| 82 | + | |
| 83 | + this.setLSRuta = function () { | |
| 84 | + $localStorage[this.rutasPausadas.label] = JSON.stringify(this.rutasPausadas.val); | |
| 85 | + }; | |
| 86 | + }]); |
src/views/botonera-lateral.html
| 1 | 1 | <div class="container botonera-lateral"> |
| 2 | 2 | <div class="row"> |
| 3 | - <div class="col-auto my-2 col-2 offset-10 d-none d-md-flex" style="min-height: 176px"> | |
| 3 | + <div class="col-auto my-2 col-2 offset-10 d-none d-lg-flex" style="min-height: 176px"> | |
| 4 | 4 | <div class="px-2 mt-auto"> |
| 5 | 5 | <div class="container"> |
| 6 | 6 | <div class="row"> |
| ... | ... | @@ -64,7 +64,7 @@ |
| 64 | 64 | </div> |
| 65 | 65 | <div class="container botonera-lateral teclado" ng-show="botones.teclado"> |
| 66 | 66 | <div class="row"> |
| 67 | - <div class="col-auto my-2 col-2 offset-10 d-none d-md-flex" style="min-height: 176px"> | |
| 67 | + <div class="col-auto my-2 col-2 offset-10 d-none d-lg-flex" style="min-height: 176px"> | |
| 68 | 68 | <div class="px-2 mt-auto"> |
| 69 | 69 | <div class="container"> |
| 70 | 70 | <div class="row"> |