Commit 4f41a73a63e8c085cda96ca510c020f5d0982b69
1 parent
9baa6fa77a
Exists in
master
- Agregué tasks clean y watch al gulp.
- Agregué componente swiper.
Showing
3 changed files
with
127 additions
and
9 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('clean', function(){ | 20 | gulp.task('clean', function() { |
21 | return gulp.src(['tmp', 'dist'], {read: false}) | 21 | return gulp.src(['tmp', 'dist'], {read: false}) |
22 | .pipe(clean()); | 22 | .pipe(clean()); |
23 | }); | 23 | }); |
24 | 24 | ||
25 | gulp.task('templates', ['clean'], function() { | 25 | gulp.task('templates', ['clean'], function() { |
26 | return pump( | 26 | return pump( |
27 | [ | 27 | [ |
28 | gulp.src(paths.srcViews), | 28 | gulp.src(paths.srcViews), |
29 | htmlmin(), | 29 | htmlmin(), |
30 | templateCache('views.js', { | 30 | templateCache('views.js', { |
31 | module: 'focaBotoneraPrincipal', | 31 | module: 'focaBotoneraPrincipal', |
32 | root: '' | 32 | root: '' |
33 | }), | 33 | }), |
34 | gulp.dest(paths.tmp) | 34 | gulp.dest(paths.tmp) |
35 | ] | 35 | ] |
36 | ); | 36 | ); |
37 | }); | 37 | }); |
38 | 38 | ||
39 | gulp.task('uglify', ['templates'], function() { | 39 | gulp.task('uglify', ['templates'], function() { |
40 | return pump( | 40 | return pump( |
41 | [ | 41 | [ |
42 | gulp.src([ | 42 | gulp.src([ |
43 | paths.srcJS, | 43 | paths.srcJS, |
44 | 'tmp/views.js' | 44 | 'tmp/views.js' |
45 | ]), | 45 | ]), |
46 | concat('foca-botonera-principal.js'), | 46 | concat('foca-botonera-principal.js'), |
47 | replace('src/views/', ''), | 47 | replace('src/views/', ''), |
48 | gulp.dest(paths.tmp), | 48 | gulp.dest(paths.tmp), |
49 | rename('foca-botonera-principal.min.js'), | 49 | rename('foca-botonera-principal.min.js'), |
50 | uglify(), | 50 | uglify(), |
51 | gulp.dest(paths.dist) | 51 | gulp.dest(paths.dist) |
52 | ] | 52 | ] |
53 | ); | 53 | ); |
54 | }); | 54 | }); |
55 | 55 | ||
56 | gulp.task('pre-commit', function() { | 56 | gulp.task('pre-commit', function() { |
57 | return pump( | 57 | return pump( |
58 | [ | 58 | [ |
59 | gulp.src(paths.srcJS), | 59 | gulp.src(paths.srcJS), |
60 | jshint('.jshintrc'), | 60 | jshint('.jshintrc'), |
61 | jshint.reporter('default'), | 61 | jshint.reporter('default'), |
62 | jshint.reporter('fail') | 62 | jshint.reporter('fail') |
63 | ] | 63 | ] |
64 | ); | 64 | ); |
65 | 65 | ||
66 | gulp.start('uglify'); | 66 | gulp.start('uglify'); |
67 | }); | 67 | }); |
68 | 68 | ||
69 | gulp.task('webserver', function() { | 69 | gulp.task('webserver', function() { |
70 | pump [ | 70 | pump [ |
71 | connect.server({port: 3000}) | 71 | connect.server({port: 3000}) |
72 | ] | 72 | ] |
73 | }); | 73 | }); |
74 | 74 | ||
75 | gulp.task('clean-post-install', function(){ | 75 | gulp.task('clean-post-install', function(){ |
76 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 76 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
77 | 'index.html'], {read: false}) | 77 | 'index.html'], {read: false}) |
78 | .pipe(clean()); | 78 | .pipe(clean()); |
79 | }); | 79 | }); |
80 | 80 | ||
81 | gulp.task('default', ['webserver']); | 81 | gulp.task('default', ['webserver']); |
82 | |||
83 | gulp.task('watch', function() { | ||
84 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']) | ||
85 | }); | ||
82 | 86 |
src/js/controller.js
1 | angular.module('focaBotoneraPrincipal') | 1 | angular.module('focaBotoneraPrincipal') |
2 | .controller('focaBotoneraPrincipalController', [ | 2 | .controller('focaBotoneraPrincipalController', [ |
3 | '$scope', '$location', | 3 | '$scope', '$location', |
4 | function($scope, $location) { | 4 | function($scope, $location) { |
5 | // TODO: Tomar estos datos desde el servicio | ||
5 | $scope.botones = [ | 6 | $scope.botones = [ |
6 | { | 7 | { |
7 | texto: 'Abrir Turno', | 8 | texto: 'Abrir Turno', |
8 | clase: 'botonera-principal-abrir-turno', | 9 | clase: 'botonera-principal-abrir-turno', |
9 | accion: '/turno-apertura' | 10 | accion: '/turno-apertura' |
10 | }, | 11 | }, |
11 | { | 12 | { |
12 | texto: 'Cerrar Turno', | 13 | texto: 'Cerrar Turno', |
13 | clase: 'botonera-principal-cerrar-turno', | 14 | clase: 'botonera-principal-cerrar-turno', |
14 | accion: '/turno-cierre' | 15 | accion: '/turno-cierre' |
15 | }, | 16 | }, |
16 | { | 17 | { |
17 | texto: 'Nota Pedido', | 18 | texto: 'Nota Pedido', |
18 | clase: 'botonera-principal-nota-pedido', | 19 | clase: 'botonera-principal-nota-pedido', |
19 | accion: '/venta-nota-pedido/crear' | 20 | accion: '/venta-nota-pedido/crear' |
21 | }, | ||
22 | { | ||
23 | texto: '', | ||
24 | clase: 'botonera-principal-vacio', | ||
25 | accion: '/' | ||
26 | }, | ||
27 | { | ||
28 | texto: '', | ||
29 | clase: 'botonera-principal-vacio', | ||
30 | accion: '/' | ||
31 | }, | ||
32 | { | ||
33 | texto: '', | ||
34 | clase: 'botonera-principal-vacio', | ||
35 | accion: '/' | ||
36 | }, | ||
37 | { | ||
38 | texto: '', | ||
39 | clase: 'botonera-principal-vacio', | ||
40 | accion: '/' | ||
41 | }, | ||
42 | { | ||
43 | texto: '', | ||
44 | clase: 'botonera-principal-vacio', | ||
45 | accion: '/' | ||
46 | }, | ||
47 | { | ||
48 | texto: '', | ||
49 | clase: 'botonera-principal-vacio', | ||
50 | accion: '/' | ||
51 | }, | ||
52 | { | ||
53 | texto: '', | ||
54 | clase: 'botonera-principal-vacio', | ||
55 | accion: '/' | ||
56 | }, | ||
57 | { | ||
58 | texto: '', | ||
59 | clase: 'botonera-principal-vacio', | ||
60 | accion: '/' | ||
61 | }, | ||
62 | { | ||
63 | texto: '', | ||
64 | clase: 'botonera-principal-vacio', | ||
65 | accion: '/' | ||
66 | }, | ||
67 | { | ||
68 | texto: '', | ||
69 | clase: 'botonera-principal-vacio', | ||
70 | accion: '/' | ||
71 | }, | ||
72 | { | ||
73 | texto: '', | ||
74 | clase: 'botonera-principal-vacio', | ||
75 | accion: '/' | ||
76 | }, | ||
77 | { | ||
78 | texto: '', | ||
79 | clase: 'botonera-principal-vacio', | ||
80 | accion: '/' | ||
81 | }, | ||
82 | { | ||
83 | texto: '', | ||
84 | clase: 'botonera-principal-vacio', | ||
85 | accion: '/' | ||
86 | }, | ||
87 | { | ||
88 | texto: '', | ||
89 | clase: 'botonera-principal-vacio', | ||
90 | accion: '/' | ||
91 | }, | ||
92 | { | ||
93 | texto: '', | ||
94 | clase: 'botonera-principal-vacio', | ||
95 | accion: '/' | ||
96 | }, | ||
97 | { | ||
98 | texto: '', | ||
99 | clase: 'botonera-principal-vacio', | ||
100 | accion: '/' | ||
101 | }, | ||
102 | { | ||
103 | texto: '', | ||
104 | clase: 'botonera-principal-vacio', | ||
105 | accion: '/' | ||
106 | }, | ||
107 | { | ||
108 | texto: '', | ||
109 | clase: 'botonera-principal-vacio', | ||
110 | accion: '/' | ||
20 | } | 111 | } |
21 | ]; | 112 | ]; |
22 | 113 | ||
114 | $scope.paginas = []; | ||
115 | $scope.paginas.push($scope.botones.slice(0, 15)); | ||
116 | $scope.paginas.push($scope.botones.slice(15, 30)); | ||
117 | |||
23 | $scope.irA = function(accion) { | 118 | $scope.irA = function(accion) { |
24 | console.log(accion); | ||
25 | $location.path(accion); | 119 | $location.path(accion); |
26 | }; | 120 | }; |
27 | 121 | ||
28 | $scope.logout = function() { | 122 | $scope.logout = function() { |
29 | $location.path('/logout'); | 123 | $location.path('/logout'); |
30 | }; | 124 | }; |
31 | } | 125 | } |
32 | ]); | 126 | ]); |
src/views/foca-botonera-principal.html
1 | <menu class="botonera-principal"> | 1 | <div class="botonera-principal"> |
2 | <menuitem ng-class="boton.clase" ng-repeat="boton in botones"> | 2 | <div class="row"> |
3 | <button ng-click="irA(boton.accion)"> | 3 | <div class="offset-4 col-4 py-2"> |
4 | <span ng-bind="boton.texto"></span> | 4 | <img class="botonera-principal-logo" src="./img/logo.png"/> |
5 | </button> | 5 | </div> |
6 | </menuitem> | 6 | </div> |
7 | </menu> | 7 | <div class="row"> |
8 | <div class="col-12"> | ||
9 | <swiper on-init="inicioSwiper"> | ||
10 | <slides> | ||
11 | <slide ng-repeat="pagina in paginas"> | ||
12 | <menu class="botonera-principal-menu"> | ||
13 | <menuitem ng-class="boton.clase" ng-repeat="boton in pagina"> | ||
14 | <button ng-click="irA(boton.accion)"> | ||
15 | <span ng-bind="boton.texto"></span> | ||
16 | </button> | ||
17 | </menuitem> | ||
18 | </menu> | ||
19 | </slide> | ||
20 | </slides> | ||
21 | <prev></prev> | ||
22 | <next></next> | ||
23 | <pagination></pagination> | ||
24 | </swiper> | ||
25 | </div> | ||
26 | </div> | ||
27 | </div> | ||
8 | 28 |