Commit e7de1e41e1b8f187f7e9d5feae23db0e350e55a2
1 parent
28c80dd140
Exists in
master
and in
1 other branch
funcion addCustomButton()
Showing
2 changed files
with
20 additions
and
2 deletions
Show diff stats
src/js/service.js
1 | angular.module('focaBotoneraLateral') | 1 | angular.module('focaBotoneraLateral') |
2 | .service('focaBotoneraLateralService', function() { | 2 | .service('focaBotoneraLateralService', function() { |
3 | 3 | ||
4 | this.botones = { | 4 | this.botones = { |
5 | salir: false, | 5 | salir: false, |
6 | cancelar: false, | 6 | cancelar: false, |
7 | pausar: false, | 7 | pausar: false, |
8 | guardar: false, | 8 | guardar: false, |
9 | funcionGuardar: undefined, | 9 | funcionGuardar: undefined, |
10 | pathCancelar: undefined | 10 | pathCancelar: undefined, |
11 | custom: [] | ||
11 | }; | 12 | }; |
12 | 13 | ||
13 | this.showSalir = function(value) { | 14 | this.showSalir = function(value) { |
15 | this.botones.custom = []; | ||
14 | this.botones.salir = value; | 16 | this.botones.salir = value; |
15 | }; | 17 | }; |
16 | this.showPausar = function(value) { | 18 | this.showPausar = function(value) { |
19 | this.botones.custom = []; | ||
17 | this.botones.pausar = value; | 20 | this.botones.pausar = value; |
18 | }; | 21 | }; |
19 | this.showCancelar = function(value, path) { | 22 | this.showCancelar = function(value, path) { |
23 | this.botones.custom = []; | ||
20 | this.botones.cancelar = value; | 24 | this.botones.cancelar = value; |
21 | this.botones.pathCancelar = (path) ? path : undefined; | 25 | this.botones.pathCancelar = (path) ? path : undefined; |
22 | }; | 26 | }; |
23 | this.showGuardar = function(value, funcion) { | 27 | this.showGuardar = function(value, funcion) { |
28 | this.botones.custom = []; | ||
24 | this.botones.guardar = value; | 29 | this.botones.guardar = value; |
25 | if(value) this.botones.funcionGuardar = funcion; | 30 | if(value) this.botones.funcionGuardar = funcion; |
26 | }; | 31 | }; |
27 | 32 | this.addCustomButton = function(title, funcion){ | |
33 | this.botones.custom.push({ | ||
34 | title: title, | ||
35 | funcion: funcion | ||
36 | }); | ||
37 | }; | ||
28 | }); | 38 | }); |
29 | 39 |
src/views/botonera-lateral.html
1 | <div class="container botonera-lateral"> | 1 | <div class="container botonera-lateral"> |
2 | <div class="row"> | 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-md-flex" style="min-height: 176px"> |
4 | <div class="px-2 mt-auto"> | 4 | <div class="px-2 mt-auto"> |
5 | <div class="container"> | 5 | <div class="container"> |
6 | <div class="row"> | 6 | <div class="row"> |
7 | <button | 7 | <button |
8 | ng-click="botones.funcionGuardar()" | 8 | ng-click="botones.funcionGuardar()" |
9 | ng-show="botones.guardar" | 9 | ng-show="botones.guardar" |
10 | type="button" | 10 | type="button" |
11 | title="Guardar" | 11 | title="Guardar" |
12 | class="btn btn-block border border-dark"> | 12 | class="btn btn-block border border-dark"> |
13 | <strong>GUARDAR</strong> | 13 | <strong>GUARDAR</strong> |
14 | </button> | 14 | </button> |
15 | <button | 15 | <button |
16 | ng-show="botones.pausar" | 16 | ng-show="botones.pausar" |
17 | type="button" | 17 | type="button" |
18 | title="Pausar" | 18 | title="Pausar" |
19 | class="btn btn-block border border-dark"> | 19 | class="btn btn-block border border-dark"> |
20 | <strong>PAUSAR</strong> | 20 | <strong>PAUSAR</strong> |
21 | </button> | 21 | </button> |
22 | <button | 22 | <button |
23 | ng-click="cancelar()" | 23 | ng-click="cancelar()" |
24 | ng-show="botones.cancelar" | 24 | ng-show="botones.cancelar" |
25 | type="button" | 25 | type="button" |
26 | title="Cancelar" | 26 | title="Cancelar" |
27 | class="btn btn-block border border-dark"> | 27 | class="btn btn-block border border-dark"> |
28 | <strong>CANCELAR</strong> | 28 | <strong>CANCELAR</strong> |
29 | </button> | 29 | </button> |
30 | <button | 30 | <button |
31 | ng-click="salir()" | 31 | ng-click="salir()" |
32 | ng-show="botones.salir" | 32 | ng-show="botones.salir" |
33 | type="button" | 33 | type="button" |
34 | title="Salir" | 34 | title="Salir" |
35 | class="btn btn-block border border-dark"> | 35 | class="btn btn-block border border-dark"> |
36 | <strong>SALIR</strong> | 36 | <strong>SALIR</strong> |
37 | </button> | 37 | </button> |
38 | <button | ||
39 | ng-repeat="boton in botones.custom" | ||
40 | ng-click="boton.funcion()" | ||
41 | type="button" | ||
42 | title="{{boton.title}}" | ||
43 | class="btn btn-block border border-dark"> | ||
44 | <strong class="text-uppercase">{{boton.title}}</strong> | ||
45 | </button> | ||
38 | </div> | 46 | </div> |
39 | </div> | 47 | </div> |
40 | </div> | 48 | </div> |
41 | </div> | 49 | </div> |
42 | </div> | 50 | </div> |
43 | </div> | 51 | </div> |
44 | <div class="container botonera-lateral teclado"> | 52 | <div class="container botonera-lateral teclado"> |
45 | <div class="row"> | 53 | <div class="row"> |
46 | <div class="col-auto my-2 col-2 offset-10 d-none d-md-flex" style="min-height: 176px"> | 54 | <div class="col-auto my-2 col-2 offset-10 d-none d-md-flex" style="min-height: 176px"> |
47 | <div class="px-2 mt-auto"> | 55 | <div class="px-2 mt-auto"> |
48 | <div class="container"> | 56 | <div class="container"> |
49 | <div class="row"> | 57 | <div class="row"> |
50 | <div | 58 | <div |
51 | class="btn-group-toggle btn btn-block btn-default border border-dark" | 59 | class="btn-group-toggle btn btn-block btn-default border border-dark" |
52 | data-toggle="buttons" | 60 | data-toggle="buttons" |
53 | ng-click="cambioUsoTeclado()" | 61 | ng-click="cambioUsoTeclado()" |
54 | title="Activar/desactivar teclado"> | 62 | title="Activar/desactivar teclado"> |
55 | <label | 63 | <label |
56 | class=" active boton-activar-teclado mb-0" | 64 | class=" active boton-activar-teclado mb-0" |
57 | ng-class="{'teclado-activar': usarTeclado}"> | 65 | ng-class="{'teclado-activar': usarTeclado}"> |
58 | <input | 66 | <input |
59 | type="checkbox" | 67 | type="checkbox" |
60 | autocomplete="off" | 68 | autocomplete="off" |
61 | > | 69 | > |
62 | <strong>TECLADO</strong> | 70 | <strong>TECLADO</strong> |
63 | </label> | 71 | </label> |
64 | </div> | 72 | </div> |
65 | </div> | 73 | </div> |
66 | </div> | 74 | </div> |
67 | </div> | 75 | </div> |
68 | </div> | 76 | </div> |
69 | </div> | 77 | </div> |
70 | </div> | 78 | </div> |
71 | 79 |