From 9baa6fa77a25d0807baea19adc90dbd147325ea6 Mon Sep 17 00:00:00 2001 From: Pablo Marco del Pont Date: Wed, 24 Oct 2018 16:30:47 -0300 Subject: [PATCH] =?UTF-8?q?Primera=20versi=C3=B3n=20estable.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +++ .jshintrc | 64 +++++++++++++++++++++++++++ README.md | 1 + gulpfile.js | 81 ++++++++++++++++++++++++++++++++++ index.html | 28 ++++++++++++ package.json | 58 ++++++++++++++++++++++++ src/js/app.js | 1 + src/js/controller.js | 32 ++++++++++++++ src/js/route.js | 7 +++ src/views/foca-botonera-principal.html | 7 +++ 10 files changed, 285 insertions(+) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 README.md create mode 100644 gulpfile.js create mode 100644 index.html create mode 100644 package.json create mode 100644 src/js/app.js create mode 100644 src/js/controller.js create mode 100644 src/js/route.js create mode 100644 src/views/foca-botonera-principal.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf9275c --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/dist +/tmp +package-lock\.json + +src/etc/develop\.js diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..d8cbb07 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,64 @@ +{ + /* + * ENVIRONMENTS + * ================= + */ + + // Define globals exposed by modern browsers. + "browser": true, + + // Define globals exposed by jQuery. + "jquery": true, + + // Define globals exposed by Node.js. + "node": true, + + // Allow ES6. + "esversion": 6, + + /* + * ENFORCING OPTIONS + * ================= + */ + + // Force all variable names to use either camelCase style or UPPER_CASE + // with underscores. + "camelcase": true, + + // Prohibit use of == and != in favor of === and !==. + "eqeqeq": true, + + // Enforce tab width of 2 spaces. + "indent": 4, + + // Prohibit use of a variable before it is defined. + "latedef": false, + + // Enforce line length to 100 characters + "maxlen": 100, + + // Require capitalized names for constructor functions. + "newcap": true, + + // Enforce use of single quotation marks for strings. + "quotmark": "single", + + // Enforce placing 'use strict' at the top function scope + "strict": false, + + // Prohibit use of explicitly undeclared variables. + "undef": true, + + // Warn when variables are defined but never used. + "unused": true, + + // Para que funcione en angular + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], + /* + * RELAXING OPTIONS + * ================= + */ + + // Suppress warnings about == null comparisons. + "eqnull": true +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..d785f2e --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Botonera principal \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..6bac238 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,81 @@ +const templateCache = require('gulp-angular-templatecache'); +const concat = require('gulp-concat'); +const htmlmin = require('gulp-htmlmin'); +const rename = require('gulp-rename'); +const uglify = require('gulp-uglify'); +const gulp = require('gulp'); +const pump = require('pump'); +const jshint = require('gulp-jshint'); +const replace = require('gulp-replace'); +const connect = require('gulp-connect'); +const clean = require('gulp-clean'); + +var paths = { + srcJS: 'src/js/*.js', + srcViews: 'src/views/*.html', + tmp: 'tmp', + dist: 'dist/' +}; + +gulp.task('clean', function(){ + return gulp.src(['tmp', 'dist'], {read: false}) + .pipe(clean()); +}); + +gulp.task('templates', ['clean'], function() { + return pump( + [ + gulp.src(paths.srcViews), + htmlmin(), + templateCache('views.js', { + module: 'focaBotoneraPrincipal', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify', ['templates'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-botonera-principal.js'), + replace('src/views/', ''), + gulp.dest(paths.tmp), + rename('foca-botonera-principal.min.js'), + uglify(), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('pre-commit', function() { + return pump( + [ + gulp.src(paths.srcJS), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); + + gulp.start('uglify'); +}); + +gulp.task('webserver', function() { + pump [ + connect.server({port: 3000}) + ] +}); + +gulp.task('clean-post-install', function(){ + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', + 'index.html'], {read: false}) + .pipe(clean()); +}); + +gulp.task('default', ['webserver']); diff --git a/index.html b/index.html new file mode 100644 index 0000000..7e25385 --- /dev/null +++ b/index.html @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..4ad20bb --- /dev/null +++ b/package.json @@ -0,0 +1,58 @@ +{ + "name": "foca-botonera-principal", + "version": "0.0.1", + "description": "Botonera principal", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gulp-pre-commit": "gulp pre-commit", + "compile": "gulp uglify", + "postinstall": "npm run compile && gulp clean-post-install", + "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" + }, + "pre-commit": [ + "gulp-pre-commit" + ], + "repository": { + "type": "git", + "url": "https://debo.suite.repo/modulos-npm/foca-botonera-principal" + }, + "author": "Foca Software", + "license": "ISC", + "peerDependencies": { + "angular": "^1.7.4", + "bootstrap": "^4.1.3", + "font-awesome": "^4.7.0", + "ui-bootstrap4": "^3.0.4", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.1", + "gulp-concat": "^2.6.1", + "gulp-connect": "^5.6.1", + "gulp-htmlmin": "^5.0.1", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-uglify": "^3.0.1", + "jquery": "^3.3.1", + "pump": "^3.0.0" + }, + "devDependencies": { + "angular": "^1.7.4", + "bootstrap": "^4.1.3", + "font-awesome": "^4.7.0", + "gulp": "3.9.1", + "gulp-angular-templatecache": "2.2.2", + "gulp-clean": "0.4.0", + "gulp-concat": "2.6.1", + "gulp-connect": "5.6.1", + "gulp-htmlmin": "5.0.1", + "gulp-jshint": "2.1.0", + "gulp-rename": "1.4.0", + "gulp-replace": "1.0.0", + "gulp-uglify": "3.0.1", + "jasmine-core": "^3.2.1", + "jquery": "^3.3.1", + "jshint": "2.9.6", + "pre-commit": "^1.2.2", + "pump": "3.0.0", + "ui-bootstrap4": "^3.0.4" + } +} diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..fb579a6 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1 @@ +angular.module('focaBotoneraPrincipal', []); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..a77d4f3 --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,32 @@ +angular.module('focaBotoneraPrincipal') + .controller('focaBotoneraPrincipalController', [ + '$scope', '$location', + function($scope, $location) { + $scope.botones = [ + { + texto: 'Abrir Turno', + clase: 'botonera-principal-abrir-turno', + accion: '/turno-apertura' + }, + { + texto: 'Cerrar Turno', + clase: 'botonera-principal-cerrar-turno', + accion: '/turno-cierre' + }, + { + texto: 'Nota Pedido', + clase: 'botonera-principal-nota-pedido', + accion: '/venta-nota-pedido/crear' + } + ]; + + $scope.irA = function(accion) { + console.log(accion); + $location.path(accion); + }; + + $scope.logout = function() { + $location.path('/logout'); + }; + } + ]); diff --git a/src/js/route.js b/src/js/route.js new file mode 100644 index 0000000..51fe99c --- /dev/null +++ b/src/js/route.js @@ -0,0 +1,7 @@ +angular.module('focaBotoneraPrincipal') + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/', { + controller: 'focaBotoneraPrincipalController', + templateUrl: 'src/views/foca-botonera-principal.html' + }); + }]); diff --git a/src/views/foca-botonera-principal.html b/src/views/foca-botonera-principal.html new file mode 100644 index 0000000..5ce18e5 --- /dev/null +++ b/src/views/foca-botonera-principal.html @@ -0,0 +1,7 @@ + + + + + -- 1.9.1