Commit 9baa6fa77a25d0807baea19adc90dbd147325ea6
0 parents
Exists in
master
and in
1 other branch
Primera versión estable.
Showing
10 changed files
with
285 additions
and
0 deletions
Show diff stats
.gitignore
| File was created | 1 | /node_modules | |
| 2 | /dist | ||
| 3 | /tmp | ||
| 4 | package-lock\.json | ||
| 5 | |||
| 6 | src/etc/develop\.js | ||
| 7 |
.jshintrc
| File was created | 1 | { | |
| 2 | /* | ||
| 3 | * ENVIRONMENTS | ||
| 4 | * ================= | ||
| 5 | */ | ||
| 6 | |||
| 7 | // Define globals exposed by modern browsers. | ||
| 8 | "browser": true, | ||
| 9 | |||
| 10 | // Define globals exposed by jQuery. | ||
| 11 | "jquery": true, | ||
| 12 | |||
| 13 | // Define globals exposed by Node.js. | ||
| 14 | "node": true, | ||
| 15 | |||
| 16 | // Allow ES6. | ||
| 17 | "esversion": 6, | ||
| 18 | |||
| 19 | /* | ||
| 20 | * ENFORCING OPTIONS | ||
| 21 | * ================= | ||
| 22 | */ | ||
| 23 | |||
| 24 | // Force all variable names to use either camelCase style or UPPER_CASE | ||
| 25 | // with underscores. | ||
| 26 | "camelcase": true, | ||
| 27 | |||
| 28 | // Prohibit use of == and != in favor of === and !==. | ||
| 29 | "eqeqeq": true, | ||
| 30 | |||
| 31 | // Enforce tab width of 2 spaces. | ||
| 32 | "indent": 4, | ||
| 33 | |||
| 34 | // Prohibit use of a variable before it is defined. | ||
| 35 | "latedef": false, | ||
| 36 | |||
| 37 | // Enforce line length to 100 characters | ||
| 38 | "maxlen": 100, | ||
| 39 | |||
| 40 | // Require capitalized names for constructor functions. | ||
| 41 | "newcap": true, | ||
| 42 | |||
| 43 | // Enforce use of single quotation marks for strings. | ||
| 44 | "quotmark": "single", | ||
| 45 | |||
| 46 | // Enforce placing 'use strict' at the top function scope | ||
| 47 | "strict": false, | ||
| 48 | |||
| 49 | // Prohibit use of explicitly undeclared variables. | ||
| 50 | "undef": true, | ||
| 51 | |||
| 52 | // Warn when variables are defined but never used. | ||
| 53 | "unused": true, | ||
| 54 | |||
| 55 | // Para que funcione en angular | ||
| 56 | "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], | ||
| 57 | /* | ||
| 58 | * RELAXING OPTIONS | ||
| 59 | * ================= | ||
| 60 | */ | ||
| 61 | |||
| 62 | // Suppress warnings about == null comparisons. | ||
| 63 | "eqnull": true | ||
| 64 | } | ||
| 65 |
README.md
| File was created | 1 | Botonera principal |
gulpfile.js
| File was created | 1 | const templateCache = require('gulp-angular-templatecache'); | |
| 2 | const concat = require('gulp-concat'); | ||
| 3 | const htmlmin = require('gulp-htmlmin'); | ||
| 4 | const rename = require('gulp-rename'); | ||
| 5 | const uglify = require('gulp-uglify'); | ||
| 6 | const gulp = require('gulp'); | ||
| 7 | const pump = require('pump'); | ||
| 8 | const jshint = require('gulp-jshint'); | ||
| 9 | const replace = require('gulp-replace'); | ||
| 10 | const connect = require('gulp-connect'); | ||
| 11 | const clean = require('gulp-clean'); | ||
| 12 | |||
| 13 | var paths = { | ||
| 14 | srcJS: 'src/js/*.js', | ||
| 15 | srcViews: 'src/views/*.html', | ||
| 16 | tmp: 'tmp', | ||
| 17 | dist: 'dist/' | ||
| 18 | }; | ||
| 19 | |||
| 20 | gulp.task('clean', function(){ | ||
| 21 | return gulp.src(['tmp', 'dist'], {read: false}) | ||
| 22 | .pipe(clean()); | ||
| 23 | }); | ||
| 24 | |||
| 25 | gulp.task('templates', ['clean'], function() { | ||
| 26 | return pump( | ||
| 27 | [ | ||
| 28 | gulp.src(paths.srcViews), | ||
| 29 | htmlmin(), | ||
| 30 | templateCache('views.js', { | ||
| 31 | module: 'focaBotoneraPrincipal', | ||
| 32 | root: '' | ||
| 33 | }), | ||
| 34 | gulp.dest(paths.tmp) | ||
| 35 | ] | ||
| 36 | ); | ||
| 37 | }); | ||
| 38 | |||
| 39 | gulp.task('uglify', ['templates'], function() { | ||
| 40 | return pump( | ||
| 41 | [ | ||
| 42 | gulp.src([ | ||
| 43 | paths.srcJS, | ||
| 44 | 'tmp/views.js' | ||
| 45 | ]), | ||
| 46 | concat('foca-botonera-principal.js'), | ||
| 47 | replace('src/views/', ''), | ||
| 48 | gulp.dest(paths.tmp), | ||
| 49 | rename('foca-botonera-principal.min.js'), | ||
| 50 | uglify(), | ||
| 51 | gulp.dest(paths.dist) | ||
| 52 | ] | ||
| 53 | ); | ||
| 54 | }); | ||
| 55 | |||
| 56 | gulp.task('pre-commit', function() { | ||
| 57 | return pump( | ||
| 58 | [ | ||
| 59 | gulp.src(paths.srcJS), | ||
| 60 | jshint('.jshintrc'), | ||
| 61 | jshint.reporter('default'), | ||
| 62 | jshint.reporter('fail') | ||
| 63 | ] | ||
| 64 | ); | ||
| 65 | |||
| 66 | gulp.start('uglify'); | ||
| 67 | }); | ||
| 68 | |||
| 69 | gulp.task('webserver', function() { | ||
| 70 | pump [ | ||
| 71 | connect.server({port: 3000}) | ||
| 72 | ] | ||
| 73 | }); | ||
| 74 | |||
| 75 | gulp.task('clean-post-install', function(){ | ||
| 76 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | ||
| 77 | 'index.html'], {read: false}) | ||
| 78 | .pipe(clean()); | ||
| 79 | }); | ||
| 80 | |||
| 81 | gulp.task('default', ['webserver']); | ||
| 82 |
index.html
| File was created | 1 | <html ng-app="focaBotoneraPrincipal"> | |
| 2 | <head> | ||
| 3 | <meta charset="UTF-8"/> | ||
| 4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
| 5 | |||
| 6 | <!--CSS--> | ||
| 7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | ||
| 8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> | ||
| 9 | |||
| 10 | <!--VENDOR JS--> | ||
| 11 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | ||
| 12 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | ||
| 13 | <script src="node_modules/angular/angular.min.js"></script> | ||
| 14 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | ||
| 15 | |||
| 16 | <!-- BUILD --> | ||
| 17 | <script src="src/js/app.js"></script> | ||
| 18 | <script src="src/js/controller.js"></script> | ||
| 19 | <script src="src/js/service.js"></script> | ||
| 20 | |||
| 21 | <!-- /BUILD --> | ||
| 22 | |||
| 23 | <!-- CONFIG PARA DEVELOP --> | ||
| 24 | <script src="src/etc/develop.js"></script> | ||
| 25 | </head> | ||
| 26 | <body ng-controller="controller"> | ||
| 27 | </body> | ||
| 28 | </html> | ||
| 29 |
package.json
| File was created | 1 | { | |
| 2 | "name": "foca-botonera-principal", | ||
| 3 | "version": "0.0.1", | ||
| 4 | "description": "Botonera principal", | ||
| 5 | "scripts": { | ||
| 6 | "test": "echo \"Error: no test specified\" && exit 1", | ||
| 7 | "gulp-pre-commit": "gulp pre-commit", | ||
| 8 | "compile": "gulp uglify", | ||
| 9 | "postinstall": "npm run compile && gulp clean-post-install", | ||
| 10 | "install-dev": "npm install -D angular bootstrap font-awesome gulp gulp-angular-templatecache gulp-concat gulp-connect gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify gulp-clean jasmine-core jquery jshint pre-commit pump ui-bootstrap4" | ||
| 11 | }, | ||
| 12 | "pre-commit": [ | ||
| 13 | "gulp-pre-commit" | ||
| 14 | ], | ||
| 15 | "repository": { | ||
| 16 | "type": "git", | ||
| 17 | "url": "https://debo.suite.repo/modulos-npm/foca-botonera-principal" | ||
| 18 | }, | ||
| 19 | "author": "Foca Software", | ||
| 20 | "license": "ISC", | ||
| 21 | "peerDependencies": { | ||
| 22 | "angular": "^1.7.4", | ||
| 23 | "bootstrap": "^4.1.3", | ||
| 24 | "font-awesome": "^4.7.0", | ||
| 25 | "ui-bootstrap4": "^3.0.4", | ||
| 26 | "gulp": "^3.9.1", | ||
| 27 | "gulp-angular-templatecache": "^2.2.1", | ||
| 28 | "gulp-concat": "^2.6.1", | ||
| 29 | "gulp-connect": "^5.6.1", | ||
| 30 | "gulp-htmlmin": "^5.0.1", | ||
| 31 | "gulp-rename": "^1.4.0", | ||
| 32 | "gulp-replace": "^1.0.0", | ||
| 33 | "gulp-uglify": "^3.0.1", | ||
| 34 | "jquery": "^3.3.1", | ||
| 35 | "pump": "^3.0.0" | ||
| 36 | }, | ||
| 37 | "devDependencies": { | ||
| 38 | "angular": "^1.7.4", | ||
| 39 | "bootstrap": "^4.1.3", | ||
| 40 | "font-awesome": "^4.7.0", | ||
| 41 | "gulp": "3.9.1", | ||
| 42 | "gulp-angular-templatecache": "2.2.2", | ||
| 43 | "gulp-clean": "0.4.0", | ||
| 44 | "gulp-concat": "2.6.1", | ||
| 45 | "gulp-connect": "5.6.1", | ||
| 46 | "gulp-htmlmin": "5.0.1", | ||
| 47 | "gulp-jshint": "2.1.0", | ||
| 48 | "gulp-rename": "1.4.0", | ||
| 49 | "gulp-replace": "1.0.0", | ||
| 50 | "gulp-uglify": "3.0.1", | ||
| 51 | "jasmine-core": "^3.2.1", | ||
| 52 | "jquery": "^3.3.1", | ||
| 53 | "jshint": "2.9.6", | ||
| 54 | "pre-commit": "^1.2.2", | ||
| 55 | "pump": "3.0.0", | ||
| 56 | "ui-bootstrap4": "^3.0.4" | ||
| 57 | } | ||
| 58 | } | ||
| 59 |
src/js/app.js
| File was created | 1 | angular.module('focaBotoneraPrincipal', []); | |
| 2 |
src/js/controller.js
| File was created | 1 | angular.module('focaBotoneraPrincipal') | |
| 2 | .controller('focaBotoneraPrincipalController', [ | ||
| 3 | '$scope', '$location', | ||
| 4 | function($scope, $location) { | ||
| 5 | $scope.botones = [ | ||
| 6 | { | ||
| 7 | texto: 'Abrir Turno', | ||
| 8 | clase: 'botonera-principal-abrir-turno', | ||
| 9 | accion: '/turno-apertura' | ||
| 10 | }, | ||
| 11 | { | ||
| 12 | texto: 'Cerrar Turno', | ||
| 13 | clase: 'botonera-principal-cerrar-turno', | ||
| 14 | accion: '/turno-cierre' | ||
| 15 | }, | ||
| 16 | { | ||
| 17 | texto: 'Nota Pedido', | ||
| 18 | clase: 'botonera-principal-nota-pedido', | ||
| 19 | accion: '/venta-nota-pedido/crear' | ||
| 20 | } | ||
| 21 | ]; | ||
| 22 | |||
| 23 | $scope.irA = function(accion) { | ||
| 24 | console.log(accion); | ||
| 25 | $location.path(accion); | ||
| 26 | }; | ||
| 27 | |||
| 28 | $scope.logout = function() { | ||
| 29 | $location.path('/logout'); | ||
| 30 | }; | ||
| 31 | } | ||
| 32 | ]); | ||
| 33 |
src/js/route.js
| File was created | 1 | angular.module('focaBotoneraPrincipal') | |
| 2 | .config(['$routeProvider', function($routeProvider) { | ||
| 3 | $routeProvider.when('/', { | ||
| 4 | controller: 'focaBotoneraPrincipalController', | ||
| 5 | templateUrl: 'src/views/foca-botonera-principal.html' | ||
| 6 | }); | ||
| 7 | }]); | ||
| 8 |
src/views/foca-botonera-principal.html
| File was created | 1 | <menu class="botonera-principal"> | |
| 2 | <menuitem ng-class="boton.clase" ng-repeat="boton in botones"> | ||
| 3 | <button ng-click="irA(boton.accion)"> | ||
| 4 | <span ng-bind="boton.texto"></span> | ||
| 5 | </button> | ||
| 6 | </menuitem> | ||
| 7 | </menu> | ||
| 8 |