Commit aa29546865c2aa07b2fda36376e5a6d85687a17c

Authored by Pablo Marco del Pont
1 parent 770bbeb0eb
Exists in master

- Agrego archivo develop de ejemplo.

- Agregué ruta de develop al gitignore.
- Modifiqué el gulp para incluir las librerias necesarias.
- Agregué las tareas clean-post-install, webserver y default.
- Agregué archivo index para desarrollo.
- Agregué los paquetes necesarios en el package.json
- Agregué modulos ngRoute y ui.bootstrap a la aplicación.
- Modifiqué el controller para tomar la ruta anidada.
- Modifiqué la ruta de los templates.
- Modifiqué la vista del listado para ingresar a la ruta adecuada.
... ... @@ -2,3 +2,4 @@
2 2 /dist
3 3 /tmp
4 4 package-lock\.json
  5 +/src/etc/develop.js
1   -const templateCache = require('gulp-angular-templatecache');
2   -const concat = require('gulp-concat');
3 1 const clean = require('gulp-clean');
  2 +const concat = require('gulp-concat');
  3 +const connect = require('gulp-connect');
  4 +const gulp = require('gulp');
4 5 const htmlmin = require('gulp-htmlmin');
  6 +const jshint = require('gulp-jshint');
  7 +const pump = require('pump');
5 8 const rename = require('gulp-rename');
  9 +const templateCache = require('gulp-angular-templatecache');
6 10 const uglify = require('gulp-uglify-es').default;
7   -const gulp = require('gulp');
8   -const pump = require('pump');
9   -const jshint = require('gulp-jshint');
10 11  
11 12 var paths = {
  13 + dist: 'dist/',
12 14 srcJS: 'src/js/*.js',
13 15 srcViews: 'src/views/*.html',
14   - tmp: 'tmp',
15   - dist: 'dist/'
  16 + tmp: 'tmp'
16 17 };
17 18  
18   -gulp.task('templates', function() {
  19 +gulp.task('templates', ['clean'], function() {
19 20 return pump(
20 21 [
21 22 gulp.src(paths.srcViews),
... ... @@ -37,6 +38,8 @@ gulp.task('uglify', ['templates'], function() {
37 38 'tmp/views.js'
38 39 ]),
39 40 concat('foca-abm-plazo-pago.js'),
  41 + replace('src/views/', ''),
  42 + replace("['ngRoute', 'ui.bootstrap']", '[]'),
40 43 gulp.dest(paths.tmp),
41 44 rename('foca-abm-plazo-pago.min.js'),
42 45 uglify(),
... ... @@ -60,3 +63,18 @@ gulp.task('pre-commit', function() {
60 63 ]
61 64 );
62 65 });
  66 +
  67 +gulp.task('clean-post-install', function() {
  68 + return gulp.src([
  69 + 'src', 'tmp', '.jshintrc', 'readme.md', '.gitignore', 'gulpfile.js', 'index.html'
  70 + ], {read: false})
  71 + .pipe(clean());
  72 +});
  73 +
  74 +gulp.task('webserver', function() {
  75 + pump [
  76 + connect.server({port: 3000})
  77 + ]
  78 +});
  79 +
  80 +gulp.task('default', ['webserver']);
... ... @@ -0,0 +1,28 @@
  1 +<html ng-app="focaAbmPlazoPago">
  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/angular-route/angular-route.min.js"></script>
  15 + <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
  16 +
  17 + <!-- BUILD -->
  18 + <script src="src/js/app.js"></script>
  19 + <script src="src/js/route.js"></script>
  20 + <script src="src/js/controller.js"></script>
  21 + <script src="src/js/service.js"></script>
  22 + <script src="src/etc/develop.js"></script>
  23 + <!-- /BUILD -->
  24 +
  25 + <body>
  26 + <div ng-view></div>
  27 + </body>
  28 +</html>
... ... @@ -6,11 +6,13 @@
6 6 "scripts": {
7 7 "test": "echo \"Error: no test specified\" && exit 1",
8 8 "compile": "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"
  9 + "gulp-pre-commit": "gulp pre-commit",
  10 + "postinstall": "npm run compile && gulp clean-post-install",
  11 + "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es jquery jshint pump"
13 12 },
  13 + "pre-commit": [
  14 + "gulp-pre-commit"
  15 + ],
14 16 "repository": {
15 17 "type": "git",
16 18 "url": "https://192.168.0.11/modulos-npm/foca-abm-plazo-pago.git"
... ... @@ -32,24 +34,25 @@
32 34 "pump": "^3.0.x"
33 35 },
34 36 "devDependencies": {
  37 + "angular": "^1.7.5",
  38 + "angular-route": "^1.7.5",
  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",
35 44 "gulp-connect": "^5.6.1",
36   - "jasmine-core": "3.2.1",
37   - "pre-commit": "^1.2.2"
38   - },
39   - "dependencies": {
40   - "angular": "1.7.4",
41   - "bootstrap": "4.1.3",
42   - "font-awesome": "4.7.0",
43   - "gulp-angular-templatecache": "2.2.1",
44   - "gulp-clean": "0.4.0",
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-sequence": "1.0.0",
50   - "gulp-uglify-es": "1.0.4",
51   - "jquery": "3.3.1",
52   - "jshint": "2.9.6",
53   - "pump": "3.0.0"
  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-sequence": "^1.0.0",
  50 + "gulp-uglify-es": "^1.0.4",
  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.5"
54 57 }
55 58 }
src/etc/develop.ejemplo.js
... ... @@ -0,0 +1,4 @@
  1 +angular.module('focaAbmPlazoPago')
  2 + .constant("API_ENDPOINT", {
  3 + 'URL': '//127.0.0.1:9000'
  4 + });
1   -angular.module('focaAbmPlazoPago', []);
  1 +angular.module('focaAbmPlazoPago', ['ngRoute', 'ui.bootstrap']);
src/js/controller.js
... ... @@ -5,8 +5,8 @@ angular.module(&#39;focaAbmPlazoPago&#39;)
5 5 focaAbmPlazoPagoService.obtenerPlazosPago().then(function(datos) {
6 6 $scope.plazosPago = datos.data;
7 7 });
8   - $scope.editar = function(id) {
9   - $location.path('/plazo-pago/' + id);
  8 + $scope.editar = function(idPreciosCondiciones, id) {
  9 + $location.path('/precio-condicion/' + idPreciosCondiciones + '/plazo-pago/' + id);
10 10 };
11 11 $scope.solicitarConfirmacion = function(plazoPago) {
12 12 $uibModal.open({
... ... @@ -4,7 +4,7 @@ angular.module(&#39;focaAbmPlazoPago&#39;)
4 4 function($routeProvider) {
5 5 $routeProvider.when('/plazo-pago', {
6 6 controller: 'focaAbmPlazosPagoController',
7   - templateUrl: 'foca-abm-plazos-pago-listado.html'
  7 + templateUrl: 'src/views/foca-abm-plazos-pago-listado.html'
8 8 });
9 9 }
10 10 ])
... ... @@ -13,7 +13,7 @@ angular.module(&#39;focaAbmPlazoPago&#39;)
13 13 function($routeProvider) {
14 14 $routeProvider.when('/precio-condicion/:idPreciosCondiciones/plazo-pago/:id', {
15 15 controller: 'focaAbmPlazoPagoController',
16   - templateUrl: 'foca-abm-plazos-pago-item.html'
  16 + templateUrl: 'src/views/foca-abm-plazos-pago-item.html'
17 17 });
18 18 }
19 19 ]);
src/views/foca-abm-plazos-pago-listado.html
... ... @@ -3,7 +3,7 @@
3 3 <th>Item</th>
4 4 <th>Dias</th>
5 5 <th colspan="2" class="text-center">
6   - <button class="btn btn-default" ng-click="editar(0)">
  6 + <button class="btn btn-default" ng-click="editar(0, 0)">
7 7 <i class="fa fa-plus"></i>
8 8 </button>
9 9 </th>
... ... @@ -12,7 +12,10 @@
12 12 <td ng-bind="plazoPago.item"></td>
13 13 <td ng-bind="plazoPago.dias"></td>
14 14 <td>
15   - <button class="btn btn-default" ng-click="editar(plazoPago.id)">
  15 + <button
  16 + class="btn btn-default"
  17 + ng-click="editar(plazoPago.idPreciosCondiciones, plazoPago.id)"
  18 + >
16 19 <i class="fa fa-pencil"></i>
17 20 </button>
18 21 <button class="btn btn-default" ng-click="solicitarConfirmacion(plazoPago)">