Commit e7de1e41e1b8f187f7e9d5feae23db0e350e55a2
1 parent
28c80dd140
Exists in
master
funcion addCustomButton()
Showing
2 changed files
with
20 additions
and
2 deletions
Show diff stats
src/js/service.js
| ... | ... | @@ -7,22 +7,32 @@ angular.module('focaBotoneraLateral') |
| 7 | 7 | pausar: false, |
| 8 | 8 | guardar: false, |
| 9 | 9 | funcionGuardar: undefined, |
| 10 | - pathCancelar: undefined | |
| 10 | + pathCancelar: undefined, | |
| 11 | + custom: [] | |
| 11 | 12 | }; |
| 12 | 13 | |
| 13 | 14 | this.showSalir = function(value) { |
| 15 | + this.botones.custom = []; | |
| 14 | 16 | this.botones.salir = value; |
| 15 | 17 | }; |
| 16 | 18 | this.showPausar = function(value) { |
| 19 | + this.botones.custom = []; | |
| 17 | 20 | this.botones.pausar = value; |
| 18 | 21 | }; |
| 19 | 22 | this.showCancelar = function(value, path) { |
| 23 | + this.botones.custom = []; | |
| 20 | 24 | this.botones.cancelar = value; |
| 21 | 25 | this.botones.pathCancelar = (path) ? path : undefined; |
| 22 | 26 | }; |
| 23 | 27 | this.showGuardar = function(value, funcion) { |
| 28 | + this.botones.custom = []; | |
| 24 | 29 | this.botones.guardar = value; |
| 25 | 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 | }); |
src/views/botonera-lateral.html
| ... | ... | @@ -35,6 +35,14 @@ |
| 35 | 35 | class="btn btn-block border border-dark"> |
| 36 | 36 | <strong>SALIR</strong> |
| 37 | 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 | 46 | </div> |
| 39 | 47 | </div> |
| 40 | 48 | </div> |