From 0e9628436e853044d6f342754c9bcc979e0d3b4f Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 15 Dec 2016 11:26:15 +0100 Subject: [PATCH] file.relative solucionado --- @salix/core/src/inputAttrsNormalizer.js | 3 +- @salix/crud/src/client/basic-data/index.html | 16 +++++------ @salix/crud/src/client/basic-data/index.js | 3 +- @salix/crud/src/client/card/card.js | 6 ++-- @salix/crud/src/client/fiscal-data/index.html | 28 +++++++++---------- @salix/gulpfile.js | 13 +++++++-- 6 files changed, 36 insertions(+), 33 deletions(-) diff --git a/@salix/core/src/inputAttrsNormalizer.js b/@salix/core/src/inputAttrsNormalizer.js index 39da1bcf54..927fb10df2 100644 --- a/@salix/core/src/inputAttrsNormalizer.js +++ b/@salix/core/src/inputAttrsNormalizer.js @@ -6,8 +6,7 @@ export class InputAttrsNormalizer { $get(){ return { normalize: function(attrs) { -/* - if (!attrs.entity) +/* if (!attrs.entity) throw new Error(`Attribute 'entity' not defined on input`); if (!attrs.field) throw new Error(`Attribute 'field' not defined on input`); diff --git a/@salix/crud/src/client/basic-data/index.html b/@salix/crud/src/client/basic-data/index.html index 03c6b8d6d6..228c996995 100644 --- a/@salix/crud/src/client/basic-data/index.html +++ b/@salix/crud/src/client/basic-data/index.html @@ -1,20 +1,20 @@
Datos básicos - - + + - - + + - - + + - - + + diff --git a/@salix/crud/src/client/basic-data/index.js b/@salix/crud/src/client/basic-data/index.js index c26858545a..ade9623184 100644 --- a/@salix/crud/src/client/basic-data/index.js +++ b/@salix/crud/src/client/basic-data/index.js @@ -15,8 +15,7 @@ export const COMPONENT = { json => console.error(json.data.error.message) ); }; - }, - controllerAs: 'client' + } }; COMPONENT.controller.$inject = ['$http']; module.component(NAME, COMPONENT); diff --git a/@salix/crud/src/client/card/card.js b/@salix/crud/src/client/card/card.js index 041b285590..37279a1ee7 100644 --- a/@salix/crud/src/client/card/card.js +++ b/@salix/crud/src/client/card/card.js @@ -8,10 +8,7 @@ export const COMPONENT = { template: template, controllerAs: 'card', controller: function($http, $stateParams) { - let clientRoutes = routes['src/client/routes.js'].routes; - this.items = []; this.client = null; - $http.get(`/client/api/Clients/${$stateParams.id}`).then( (json) => { this.client = json.data; @@ -24,7 +21,8 @@ export const COMPONENT = { (json) => console.error (json.data.error.message) ); - clientRoutes.forEach ((i) => { + this.items = []; + routes['client'].routes.forEach ((i) => { if (i.description) this.items.push ({ description: i.description, diff --git a/@salix/crud/src/client/fiscal-data/index.html b/@salix/crud/src/client/fiscal-data/index.html index c7f9532e3f..bd5f1fc6d7 100644 --- a/@salix/crud/src/client/fiscal-data/index.html +++ b/@salix/crud/src/client/fiscal-data/index.html @@ -2,46 +2,46 @@ Datos fiscales y de facturación - + - + - + - + - + - - - + + +
Información de facturación
- + - + - +
Documentación
- - - + + + diff --git a/@salix/gulpfile.js b/@salix/gulpfile.js index 706630d36f..29c2ed3f4f 100644 --- a/@salix/gulpfile.js +++ b/@salix/gulpfile.js @@ -8,7 +8,7 @@ var babel = require('gulp-babel'); var fs = require('fs'); var del = require('del'); var webpack = require('webpack'); -var WebpackDevServer = require("webpack-dev-server"); +var WebpackDevServer = require('webpack-dev-server'); var webpackConfig = require('./webpack.config.js'); // Clean @@ -100,11 +100,18 @@ gulp.task('webpack-dev-server', ['spliting'], function() { var routeFiles = './crud/**/routes.js'; gulp.task('routes', function() { - var fileTpl = '\n"<%=file.relative%>": <%=contents%>'; + var fileTpl = '\n"<%=dirname%>": <%=contents%>'; var globalTpl = 'var routes = {<%=contents%>\n}'; + var regex = new RegExp('^src/(.*)/routes\.js$'); + + function cb(file) { + var relative = file.relative.replace('\\', '/'); + var dirname = relative.match(regex)[1]; + return {dirname: dirname}; + } return gulp.src(routeFiles) - .pipe(wrap(fileTpl)) + .pipe(wrap(fileTpl, cb)) .pipe(concat('salix.routes.js', {newLine: ','})) .pipe(wrap(globalTpl)) .pipe(babel({presets: ['es2015']}))