Commit 1e463c2d3a5e86b0312d0796c795bd5d44e9b1a7
1 parent
5e56b7f1df
Exists in
master
and in
1 other branch
- Apliqué cambios de estilo para achicar elementos.
- Añadí tareas clean y watch al gulp.
Showing
2 changed files
with
30 additions
and
21 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'); | 5 | const uglify = require('gulp-uglify'); |
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: 'focaBusquedaProductos', | 31 | module: 'focaBusquedaProductos', |
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-productos.js'), | 46 | concat('foca-busqueda-productos.js'), |
42 | replace('src/views/', ''), | 47 | replace('src/views/', ''), |
43 | replace("['ui.bootstrap', 'focaDirectivas']", '[]'), | 48 | replace("['ui.bootstrap', 'focaDirectivas']", '[]'), |
44 | gulp.dest(paths.tmp), | 49 | gulp.dest(paths.tmp), |
45 | rename('foca-busqueda-productos.min.js'), | 50 | rename('foca-busqueda-productos.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 | gulp.start('uglify'); | 67 | gulp.start('uglify'); |
63 | }); | 68 | }); |
64 | 69 | ||
65 | gulp.task('webserver', function() { | 70 | gulp.task('webserver', function() { |
66 | pump [ | 71 | pump [ |
67 | connect.server({port: 3000}) | 72 | connect.server({port: 3000}) |
68 | ] | 73 | ] |
69 | }); | 74 | }); |
70 | 75 | ||
71 | gulp.task('clean-post-install', function(){ | 76 | gulp.task('clean-post-install', function(){ |
72 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 77 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
73 | 'index.html'], {read: false}) | 78 | 'index.html'], {read: false}) |
74 | .pipe(clean()); | 79 | .pipe(clean()); |
75 | }); | 80 | }); |
76 | 81 | ||
77 | gulp.task('default', ['webserver']); | ||
82 | gulp.task('default', ['webserver']); | ||
83 | |||
84 | gulp.task('watch', function() { | ||
85 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) | ||
86 | }); |
src/views/modal-busqueda-productos.html
1 | <div class="modal-header"> | 1 | <div class="modal-header py-1"> |
2 | <h3 class="modal-title">Busqueda de Productos</h3> | 2 | <h5 class="modal-title">Busqueda de Productos</h5> |
3 | </div> | 3 | </div> |
4 | <div class="modal-body" id="modal-body"> | 4 | <div class="modal-body" id="modal-body"> |
5 | <div class="input-group mb-3"> | 5 | <div class="input-group"> |
6 | <input | 6 | <input |
7 | type="text" | 7 | type="text" |
8 | class="form-control" | 8 | class="form-control" |
9 | placeholder="Busqueda" | 9 | placeholder="Busqueda" |
10 | ng-model="filters" | 10 | ng-model="filters" |
11 | ng-change="search()" | 11 | ng-change="search()" |
12 | ng-keydown="busquedaDown($event.keyCode)" | 12 | ng-keydown="busquedaDown($event.keyCode)" |
13 | ng-keypress="busquedaPress($event.keyCode)" | 13 | ng-keypress="busquedaPress($event.keyCode)" |
14 | foca-focus="selectedProducto == -1" | 14 | foca-focus="selectedProducto == -1" |
15 | ng-focus="selectedProducto = -1" | 15 | ng-focus="selectedProducto = -1" |
16 | > | 16 | > |
17 | <table class="table table-striped table-sm"> | 17 | <table class="table table-striped table-sm"> |
18 | <thead> | 18 | <thead> |
19 | <tr> | 19 | <tr> |
20 | <th>Sec.</th> | 20 | <th>Sec.</th> |
21 | <th>Cod.</th> | 21 | <th>Cod.</th> |
22 | <th>Descripción</th> | 22 | <th>Descripción</th> |
23 | <th>P. Base</th> | 23 | <th>P. Base</th> |
24 | <th></th> | 24 | <th></th> |
25 | </tr> | 25 | </tr> |
26 | </thead> | 26 | </thead> |
27 | <tbody> | 27 | <tbody> |
28 | <tr class="selectable" | 28 | <tr class="selectable" |
29 | ng-repeat="(key,producto) in currentPageProductos" | 29 | ng-repeat="(key,producto) in currentPageProductos" |
30 | ng-click="select(producto)"> | 30 | ng-click="select(producto)"> |
31 | <td ng-bind="producto.sector"></td> | 31 | <td ng-bind="producto.sector"></td> |
32 | <td ng-bind="producto.codigo"></td> | 32 | <td ng-bind="producto.codigo"></td> |
33 | <td ng-bind="producto.descripcion"></td> | 33 | <td ng-bind="producto.descripcion"></td> |
34 | <td ng-bind="producto.precio | currency"></td> | 34 | <td ng-bind="producto.precio | currency"></td> |
35 | <td> | 35 | <td> |
36 | <button | 36 | <button |
37 | type="button" | 37 | type="button" |
38 | class="btn p-2 float-right" | 38 | class="btn btn-xs p-1 float-right" |
39 | ng-class="{ | 39 | ng-class="{ |
40 | 'btn-secondary': selectedProducto != key, | 40 | 'btn-secondary': selectedProducto != key, |
41 | 'btn-primary': selectedProducto == key | 41 | 'btn-primary': selectedProducto == key |
42 | }" | 42 | }" |
43 | foca-focus="selectedProducto == {{key}}" | 43 | foca-focus="selectedProducto == {{key}}" |
44 | ng-keydown="itemProducto($event.keyCode)" | 44 | ng-keydown="itemProducto($event.keyCode)" |
45 | > | 45 | > |
46 | <i class="fa fa-arrow-right" aria-hidden="true"></i> | 46 | <i class="fa fa-arrow-right" aria-hidden="true"></i> |
47 | </button> | 47 | </button> |
48 | </td> | 48 | </td> |
49 | </tr> | 49 | </tr> |
50 | </tbody> | 50 | </tbody> |
51 | </table> | 51 | </table> |
52 | <nav> | 52 | <nav> |
53 | <ul class="pagination justify-content-end"> | 53 | <ul class="pagination pagination-sm justify-content-end mb-0"> |
54 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | 54 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> |
55 | <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> | 55 | <a class="page-link" href="#" ng-click="selectPage(currentPage - 1)"> |
56 | <span aria-hidden="true">«</span> | 56 | <span aria-hidden="true">«</span> |
57 | <span class="sr-only">Anterior</span> | 57 | <span class="sr-only">Anterior</span> |
58 | </a> | 58 | </a> |
59 | </li> | 59 | </li> |
60 | <li | 60 | <li |
61 | class="page-item" | 61 | class="page-item" |
62 | ng-repeat="pagina in paginas" | 62 | ng-repeat="pagina in paginas" |
63 | ng-class="{'active': pagina == currentPage}" | 63 | ng-class="{'active': pagina == currentPage}" |
64 | > | 64 | > |
65 | <a | 65 | <a |
66 | class="page-link" | 66 | class="page-link" |
67 | href="#" | 67 | href="#" |
68 | ng-click="selectPage(pagina)" | 68 | ng-click="selectPage(pagina)" |
69 | ng-bind="pagina" | 69 | ng-bind="pagina" |
70 | ></a> | 70 | ></a> |
71 | </li> | 71 | </li> |
72 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | 72 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> |
73 | <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> | 73 | <a class="page-link" href="#" ng-click="selectPage(currentPage + 1)"> |
74 | <span aria-hidden="true">»</span> | 74 | <span aria-hidden="true">»</span> |
75 | <span class="sr-only">Siguiente</span> | 75 | <span class="sr-only">Siguiente</span> |
76 | </a> | 76 | </a> |
77 | </li> | 77 | </li> |
78 | </ul> | 78 | </ul> |
79 | </nav> | 79 | </nav> |
80 | </div> | 80 | </div> |
81 | </div> | 81 | </div> |
82 | <div class="modal-footer"> | 82 | <div class="modal-footer py-1"> |
83 | <button class="btn btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | 83 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
84 | </div> | 84 | </div> |
85 | 85 |