Commit b0902d7eeed0f3daab8e652e7ee331b5decbb429
1 parent
1839af92b6
Exists in
master
- Modifiqué la vista para hacer foco al entrar y seleccionar nombre al presionar enter.
- Agregué gulp clean y watch.
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const concat = require('gulp-concat'); | 2 | const concat = require('gulp-concat'); |
3 | const htmlmin = require('gulp-htmlmin'); | 3 | const htmlmin = require('gulp-htmlmin'); |
4 | const rename = require('gulp-rename'); | 4 | const rename = require('gulp-rename'); |
5 | const uglify = require('gulp-uglify-es').default; | 5 | const uglify = require('gulp-uglify-es').default; |
6 | const gulp = require('gulp'); | 6 | const gulp = require('gulp'); |
7 | const pump = require('pump'); | 7 | const pump = require('pump'); |
8 | const jshint = require('gulp-jshint'); | 8 | const jshint = require('gulp-jshint'); |
9 | const replace = require('gulp-replace'); | 9 | const replace = require('gulp-replace'); |
10 | const connect = require('gulp-connect'); | 10 | const connect = require('gulp-connect'); |
11 | const clean = require('gulp-clean'); | 11 | const clean = require('gulp-clean'); |
12 | 12 | ||
13 | var paths = { | 13 | var paths = { |
14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
17 | dist: 'dist/' | 17 | dist: 'dist/' |
18 | }; | 18 | }; |
19 | 19 | ||
20 | gulp.task('templates', function() { | 20 | gulp.task('clean', function(){ |
21 | return gulp.src(['tmp', 'dist'], {read: false}) | ||
22 | .pipe(clean()); | ||
23 | }); | ||
24 | |||
25 | gulp.task('templates', ['clean'], function() { | ||
21 | return pump( | 26 | return pump( |
22 | [ | 27 | [ |
23 | gulp.src(paths.srcViews), | 28 | gulp.src(paths.srcViews), |
24 | htmlmin(), | 29 | htmlmin(), |
25 | templateCache('views.js', { | 30 | templateCache('views.js', { |
26 | module: 'focaBusquedaCliente', | 31 | module: 'focaBusquedaCliente', |
27 | root: '' | 32 | root: '' |
28 | }), | 33 | }), |
29 | gulp.dest(paths.tmp) | 34 | gulp.dest(paths.tmp) |
30 | ] | 35 | ] |
31 | ); | 36 | ); |
32 | }); | 37 | }); |
33 | 38 | ||
34 | gulp.task('uglify', ['templates'], function() { | 39 | gulp.task('uglify', ['templates'], function() { |
35 | return pump( | 40 | return pump( |
36 | [ | 41 | [ |
37 | gulp.src([ | 42 | gulp.src([ |
38 | paths.srcJS, | 43 | paths.srcJS, |
39 | 'tmp/views.js' | 44 | 'tmp/views.js' |
40 | ]), | 45 | ]), |
41 | concat('foca-busqueda-cliente.js'), | 46 | concat('foca-busqueda-cliente.js'), |
42 | replace("'ui.bootstrap'", ''), | 47 | replace("'ui.bootstrap'", ''), |
43 | replace('src/views/', ''), | 48 | replace('src/views/', ''), |
44 | gulp.dest(paths.tmp), | 49 | gulp.dest(paths.tmp), |
45 | rename('foca-busqueda-cliente.min.js'), | 50 | rename('foca-busqueda-cliente.min.js'), |
46 | uglify(), | 51 | uglify(), |
47 | gulp.dest(paths.dist) | 52 | gulp.dest(paths.dist) |
48 | ] | 53 | ] |
49 | ); | 54 | ); |
50 | }); | 55 | }); |
51 | 56 | ||
52 | gulp.task('pre-commit', function() { | 57 | gulp.task('pre-commit', function() { |
53 | return pump( | 58 | return pump( |
54 | [ | 59 | [ |
55 | gulp.src(paths.srcJS), | 60 | gulp.src(paths.srcJS), |
56 | jshint('.jshintrc'), | 61 | jshint('.jshintrc'), |
57 | jshint.reporter('default'), | 62 | jshint.reporter('default'), |
58 | jshint.reporter('fail') | 63 | jshint.reporter('fail') |
59 | ] | 64 | ] |
60 | ); | 65 | ); |
61 | }); | 66 | }); |
62 | 67 | ||
63 | 68 | ||
64 | gulp.task('webserver', function() { | 69 | gulp.task('webserver', function() { |
65 | pump [ | 70 | pump [ |
66 | connect.server({port: 3000}) | 71 | connect.server({port: 3000}) |
67 | ] | 72 | ] |
68 | }); | 73 | }); |
69 | 74 | ||
70 | gulp.task('clean-post-install', function() { | 75 | gulp.task('clean-post-install', function() { |
71 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 76 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
72 | 'index.html'], {read: false}) | 77 | 'index.html'], {read: false}) |
73 | .pipe(clean()); | 78 | .pipe(clean()); |
74 | }); | 79 | }); |
75 | 80 | ||
76 | gulp.task('default', ['webserver']); | 81 | gulp.task('default', ['webserver']); |
82 | |||
83 | gulp.task('watch', function(){ | ||
84 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | ||
85 | }); | ||
77 | 86 |
src/views/foca-busqueda-cliente-modal.html
1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
2 | <h3 class="modal-title">Búsqueda de cliente</h3> | 2 | <h3 class="modal-title">Búsqueda de cliente</h3> |
3 | </div> | 3 | </div> |
4 | <div class="modal-body"> | 4 | <div class="modal-body"> |
5 | <form> | 5 | <form> |
6 | <div class="form-group row"> | 6 | <div class="form-group row"> |
7 | <label class="col-sm-4 col-form-label">Nombre o CUIT</label> | 7 | <label class="col-sm-4 col-form-label">Nombre o CUIT</label> |
8 | <div class="col-sm-8"> | 8 | <div class="col-sm-8"> |
9 | <input | 9 | <input |
10 | type="text" | 10 | type="text" |
11 | ng-model="cliente" | 11 | ng-model="cliente" |
12 | placeholder="Nombre o CUIT" | 12 | placeholder="Nombre o CUIT" |
13 | uib-typeahead=" | 13 | uib-typeahead=" |
14 | cliente.cod + ' ' + cliente.nom + ' (' + cliente.cuit + ')' | 14 | cliente.cod + ' ' + cliente.nom + ' (' + cliente.cuit + ')' |
15 | for cliente | 15 | for cliente |
16 | in obtenerClientesPorNombreOCuit($viewValue) | 16 | in obtenerClientesPorNombreOCuit($viewValue) |
17 | " | 17 | " |
18 | typeahead-loading="cargandoClientes" | 18 | typeahead-loading="cargandoClientes" |
19 | typeahead-no-results="sinResultados" | 19 | typeahead-no-results="sinResultados" |
20 | typeahead-on-select="seleccionar($item)" | 20 | typeahead-on-select="seleccionar($item)" |
21 | class="form-control" | 21 | class="form-control" |
22 | foca-focus="true" | ||
23 | ng-keypress="$event.keyCode === 13 && aceptar()" | ||
22 | > | 24 | > |
23 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | 25 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> |
24 | <div ng-show="sinResultados"> | 26 | <div ng-show="sinResultados"> |
25 | <i class="fa fa-minus"></i> No se encontraron resultados. | 27 | <i class="fa fa-minus"></i> No se encontraron resultados. |
26 | </div> | 28 | </div> |
27 | </div> | 29 | </div> |
28 | </div> | 30 | </div> |
29 | </form> | 31 | </form> |
30 | </div> | 32 | </div> |
31 | <div class="modal-footer"> | 33 | <div class="modal-footer"> |
32 | <button class="btn" ng-click="aceptar()">Aceptar</button> | 34 | <button class="btn" ng-click="aceptar()">Aceptar</button> |
33 | <button class="btn" ng-click="cancelar()">Cancelar</button> | 35 | <button class="btn" ng-click="cancelar()">Cancelar</button> |
34 | </div> | 36 | </div> |
35 | 37 |