Commit 4501fbbbd64357b0c7f950e7c509f49ef13cc72c
1 parent
9d7a255c25
Exists in
master
and in
1 other branch
template ejemplo de modulo modal
Showing
10 changed files
with
258 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": true, | ||
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 |
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 | |||
12 | var paths = { | ||
13 | srcJS: 'src/js/*.js', | ||
14 | srcViews: 'src/views/*.html', | ||
15 | tmp: 'tmp', | ||
16 | dist: 'dist/' | ||
17 | }; | ||
18 | |||
19 | gulp.task('templates', function() { | ||
20 | pump( | ||
21 | [ | ||
22 | gulp.src(paths.srcViews), | ||
23 | replace('views/', ''), | ||
24 | htmlmin(), | ||
25 | templateCache('views.js', { | ||
26 | module: 'focaBusquedaProductos', | ||
27 | root: '' | ||
28 | }), | ||
29 | gulp.dest(paths.tmp) | ||
30 | ] | ||
31 | ); | ||
32 | }); | ||
33 | |||
34 | gulp.task('uglify', function() { | ||
35 | pump( | ||
36 | [ | ||
37 | gulp.src([ | ||
38 | paths.srcJS, | ||
39 | 'tmp/views.js' | ||
40 | ]), | ||
41 | concat('foca-busqueda-productos.js'), | ||
42 | gulp.dest(paths.tmp), | ||
43 | rename('foca-busqueda-productos.min.js'), | ||
44 | uglify(), | ||
45 | gulp.dest(paths.dist) | ||
46 | ] | ||
47 | ); | ||
48 | }); | ||
49 | |||
50 | gulp.task('pre-commit', function() { | ||
51 | pump( | ||
52 | [ | ||
53 | gulp.src(paths.srcJS), | ||
54 | jshint('.jshintrc'), | ||
55 | jshint.reporter('default'), | ||
56 | jshint.reporter('fail') | ||
57 | ] | ||
58 | ); | ||
59 | |||
60 | gulp.start('uglify'); | ||
61 | gulp.start('templates'); | ||
62 | }); | ||
63 | |||
64 | gulp.task('webserver', function() { | ||
65 | pump [ | ||
66 | connect.server({port: 3000}) | ||
67 | ] | ||
68 | }); | ||
69 | |||
70 | gulp.task('default', ['webserver']); |
index.html
File was created | 1 | <html ng-app="focaBusquedaProductos"> | |
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 | |||
20 | <!-- /BUILD --> | ||
21 | |||
22 | <!-- CONFIG PARA DEVELOP --> | ||
23 | <script src="src/etc/develop.js"></script> | ||
24 | <script type="text/javascript"> | ||
25 | angular.module('focaBusquedaProductos') | ||
26 | .controller('controller', ['$uibModal', function($uibModal) { | ||
27 | var modalInstance = $uibModal.open( | ||
28 | { | ||
29 | ariaLabelledBy: 'Busqueda de Productos', | ||
30 | templateUrl: 'src/views/modal-busqueda-productos.html', | ||
31 | controller: 'modalBusquedaProductosCtrl', | ||
32 | size: 'md' | ||
33 | } | ||
34 | ); | ||
35 | }]); | ||
36 | </script> | ||
37 | </head> | ||
38 | <body ng-controller="controller"> | ||
39 | </body> | ||
40 | </html> | ||
41 |
package.json
File was created | 1 | { | |
2 | "name": "foca-navegacion-doble", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Menu de navegacion de doble entrada", | ||
5 | "main": "index.js", | ||
6 | "scripts": { | ||
7 | "test": "echo \"Error: no test specified\" && exit 1", | ||
8 | "compile": "gulp templates && gulp uglify", | ||
9 | "pre-commit": [ | ||
10 | "gulp-pre-commit" | ||
11 | ], | ||
12 | "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", | ||
13 | "install-dev": "npm install angular bootstrap jquery font-awesome gulp gulp-concat gulp-jshint gulp-rename gulp-replace gulp-uglify-es jshint pump gulp-connect jasmine-core pre-commit" | ||
14 | }, | ||
15 | "repository": { | ||
16 | "type": "git", | ||
17 | "url": "https://192.168.0.11/modulos-npm/foca-navegacion-doble" | ||
18 | }, | ||
19 | "author": "Nicolás Guarnieri", | ||
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.1", | ||
43 | "gulp-concat": "^2.6.1", | ||
44 | "gulp-connect": "^5.6.1", | ||
45 | "gulp-htmlmin": "^5.0.1", | ||
46 | "gulp-jshint": "^2.1.0", | ||
47 | "gulp-rename": "^1.4.0", | ||
48 | "gulp-replace": "^1.0.0", | ||
49 | "gulp-uglify": "^3.0.1", | ||
50 | "jasmine-core": "^3.2.1", | ||
51 | "jquery": "^3.3.1", | ||
52 | "jshint": "^2.9.6", | ||
53 | "pre-commit": "^1.2.2", | ||
54 | "pump": "^3.0.0", | ||
55 | "ui-bootstrap4": "^3.0.4" | ||
56 | } | ||
57 | } | ||
58 |
src/etc/develop.js.ejemplo
File was created | 1 | angular.module('focaBusquedaProductos') | |
2 | .constant("API_ENDPOINT", { | ||
3 | 'URL': '//127.0.0.1:9000' | ||
4 | }); | ||
5 |
src/js/app.js
File was created | 1 | angular.module('focaBusquedaProductos', ['ui.bootstrap']); | |
2 |
src/js/controller.js
File was created | 1 | angular.module('focaBusquedaProductos') | |
2 | .controller('modalBusquedaProductosCtrl', | ||
3 | ['$uibModalInstance', function($uibModalInstance) { | ||
4 | |||
5 | }] | ||
6 | ) |
src/js/service.js
src/views/modal-busqueda-productos.html
File was created | 1 | <div class="modal-header"> | |
2 | <h3 class="modal-title" id="modal-title">I'm a modal!</h3> | ||
3 | </div> | ||
4 | <div class="modal-body" id="modal-body"> | ||
5 | Esto es una prueba espero que funcione | ||
6 | </div> | ||
7 | <div class="modal-footer"> | ||
8 | <button class="btn btn-primary" type="button">OK</button> | ||
9 | <button class="btn btn-warning" type="button">Cancel</button> | ||
10 | </div> | ||
11 |