Commit 26c496d71a93f16190b88f91f1a44d421bbcbfe7
1 parent
b155399b40
Exists in
master
boton pausar funcionando
Showing
3 changed files
with
25 additions
and
6 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -8,6 +8,11 @@ angular.module('focaBotoneraLateral') |
| 8 | 8 | |
| 9 | 9 | $scope.botones = focaBotoneraLateralService.botones; |
| 10 | 10 | |
| 11 | + $scope.pausar = function() { | |
| 12 | + focaBotoneraLateralService.setLSItem(); | |
| 13 | + $location.path('/'); | |
| 14 | + }; | |
| 15 | + | |
| 11 | 16 | $scope.cambioUsoTeclado = function() { |
| 12 | 17 | $scope.$parent.cambioUsoTeclado(); |
| 13 | 18 | }; |
| ... | ... | @@ -17,9 +22,9 @@ angular.module('focaBotoneraLateral') |
| 17 | 22 | }; |
| 18 | 23 | |
| 19 | 24 | $scope.cancelar = function() { |
| 20 | - if($scope.botones.pathCancelar) { | |
| 25 | + if ($scope.botones.pathCancelar) { | |
| 21 | 26 | $location.path($scope.botones.pathCancelar); |
| 22 | - }else { | |
| 27 | + } else { | |
| 23 | 28 | $window.history.back(); |
| 24 | 29 | } |
| 25 | 30 | }; |
src/js/service.js
| 1 | 1 | angular.module('focaBotoneraLateral') |
| 2 | - .service('focaBotoneraLateralService', function() { | |
| 2 | + .service('focaBotoneraLateralService', ['$localStorage', | |
| 3 | + function($localStorage) { | |
| 3 | 4 | |
| 4 | 5 | this.botones = { |
| 5 | 6 | teclado: true, |
| ... | ... | @@ -13,6 +14,11 @@ angular.module('focaBotoneraLateral') |
| 13 | 14 | custom: [] |
| 14 | 15 | }; |
| 15 | 16 | |
| 17 | + this.pausarData = { | |
| 18 | + label: '', | |
| 19 | + val: '' | |
| 20 | + }; | |
| 21 | + | |
| 16 | 22 | this.showTeclado = function(value) { |
| 17 | 23 | this.botones.teclado = value; |
| 18 | 24 | }; |
| ... | ... | @@ -24,6 +30,9 @@ angular.module('focaBotoneraLateral') |
| 24 | 30 | this.botones.custom = []; |
| 25 | 31 | this.botones.pausar = value; |
| 26 | 32 | }; |
| 33 | + this.setPausarData = function(obj) { | |
| 34 | + this.pausarData = obj; | |
| 35 | + }; | |
| 27 | 36 | this.showCancelar = function(value, path) { |
| 28 | 37 | this.botones.custom = []; |
| 29 | 38 | this.botones.cancelar = value; |
| ... | ... | @@ -33,7 +42,7 @@ angular.module('focaBotoneraLateral') |
| 33 | 42 | angular.element('#guardar').removeClass('guardado'); |
| 34 | 43 | this.botones.custom = []; |
| 35 | 44 | this.botones.guardar = value; |
| 36 | - if(value) this.botones.funcionGuardar = funcion; | |
| 45 | + if (value) this.botones.funcionGuardar = funcion; | |
| 37 | 46 | }; |
| 38 | 47 | this.addCustomButton = function(title, funcion) { |
| 39 | 48 | this.botones.custom.push({ |
| ... | ... | @@ -46,6 +55,10 @@ angular.module('focaBotoneraLateral') |
| 46 | 55 | }; |
| 47 | 56 | this.endGuardar = function(guardado) { |
| 48 | 57 | this.botones.guardando = false; |
| 49 | - if(guardado) angular.element('#guardar').addClass('guardado'); | |
| 58 | + if (guardado) angular.element('#guardar').addClass('guardado'); | |
| 59 | + }; | |
| 60 | + | |
| 61 | + this.setLSItem = function() { | |
| 62 | + $localStorage[this.pausarData.label] = JSON.stringify(this.pausarData.val); | |
| 50 | 63 | }; |
| 51 | - }); | |
| 64 | + }]); |