Correciones varias

This commit is contained in:
Juan Ferrer Toribio 2017-03-07 17:11:56 +01:00
parent 398ede37d0
commit 7059eadfc7
13 changed files with 43 additions and 51 deletions

View File

@ -7,3 +7,5 @@ rules:
max-len: 0
eqeqeq: 0
operator-linebreak: 0
radix: 0
guard-for-in: 0

View File

@ -10,7 +10,7 @@ class Controller {
};
}
onSubmit() {
this.$scope.watcher.submit().then (
this.$scope.watcher.submit().then(
() => this.$state.go('clientCard.addresses')
);
}
@ -22,5 +22,5 @@ export const COMPONENT = {
template: require('./index.html'),
controllerAs: 'addressData',
controller: Controller
}
};
module.component(NAME, COMPONENT);

View File

@ -6,7 +6,7 @@
data="addressData.address"
form="form">
</vn-watcher>
<form name="form" ng-submit="addressData.onSubmit()" pad-medium>
<form name="form" ng-submit="watcher.submitBack()" pad-medium>
<vn-card>
<vn-vertical pad-large>
<vn-title>Consignatario</vn-title>

View File

@ -1,20 +1,13 @@
import {module} from '../module';
class Controller {
constructor($scope, $window, $stateParams) {
this.$scope = $scope;
this.$window = $window;
constructor($stateParams) {
this.address = {
id: $stateParams.addressId
};
}
onSubmit() {
this.$scope.watcher.submit().then (
() => this.$window.history.back()
);
}
}
Controller.$inject = ['$scope', '$window', '$stateParams'];
Controller.$inject = ['$stateParams'];
export const NAME = 'vnAddressEdit';
export const COMPONENT = {

View File

@ -22,7 +22,7 @@
</vn-card>
<vn-button-bar>
<vn-submit label="Crear y continuar"></vn-submit>
<vn-button label="Crear" ng-click="$ctrl.onCreate()"></vn-button>
<vn-button label="Crear" ng-click="watcher.submitBack()"></vn-button>
</vn-button-bar>
</div>
</form>

View File

@ -1,10 +1,9 @@
import {module} from '../module';
class Controller {
constructor($scope, $state, $window) {
constructor($scope, $state) {
this.$scope = $scope;
this.$state = $state;
this.$window = $window;
this.client = {
active: true
};
@ -14,13 +13,8 @@ class Controller {
json => this.$state.go('clientCard.basicData', {id: json.data.id})
);
}
onCreate() {
this.$scope.watcher.submit().then(
() => this.$window.history.back()
);
}
}
Controller.$inject = ['$scope', '$state', '$window'];
Controller.$inject = ['$scope', '$state'];
export const component = {
template: require('./index.html'),

View File

@ -46,11 +46,27 @@ export default class Watcher extends Component {
);
});
}
/**
* Submits the data and goes back in the history.
*/
submitBack() {
this.submit().then(
() => this.window.history.back()
);
}
/**
* Submits the data to the server.
*
* @return {Promise} The http request promise
*/
submit() {
if (this.form && !this.form.$valid) {
return new Promise(
(resolve, reject) => this.invalidForm(reject)
);
if (this.form) {
this.form.$setSubmitted();
if (!this.form.$valid)
return new Promise(
(resolve, reject) => this.invalidForm(reject)
);
}
if (!this.dataChanged()) {
return new Promise(

View File

@ -87,8 +87,7 @@ gulp.task('webpack-dev-server', ['spliting'], function(callback) {
chunks: false,
chunkModules: false
}
})
.listen(8081, '0.0.0.0', function(err) {
}).listen(8081, '0.0.0.0', function(err) {
if (err) throw new gutil.PluginError('webpack-dev-server', err);
});
});
@ -100,14 +99,13 @@ var localeFiles = `./${srcDir}/**/locale/*.json`;
gulp.task('locales', function() {
var streams = [];
for (var mod in modules) {
for (var mod in modules)
for (var lang of langs) {
var localeFiles = `./client/${mod}/**/locale/${lang}.json`;
streams.push(gulp.src(localeFiles)
.pipe(extend(`${lang}.json`))
.pipe(gulp.dest(`${buildDir}/locale/${mod}`)));
}
}
return merge(streams);
});

View File

@ -38,6 +38,7 @@
"gulp-extend": "^0.2.0",
"gulp-util": "^3.0.7",
"gulp-wrap": "^0.13.0",
"gulp-yaml": "^1.0.1",
"html-loader": "^0.4.4",
"merge-stream": "^1.0.1",
"node-sass": "^3.11.0",

View File

@ -6,7 +6,6 @@ var express=require('express');
var path = require('path');
var app = module.exports = loopback();
// modificado
app.set('view engine', 'ejs');
app.set('views',path.join(__dirname,'../client'));
@ -14,10 +13,7 @@ app.use(loopback.static(path.resolve(__dirname, '../client')));
app.set('applications',require("./application.json"));
// fin
app.start = function() {
// start the web server
return app.listen(function() {
app.emit('started');
var baseUrl = app.get('url').replace(/\/$/, '');
@ -29,12 +25,8 @@ app.start = function() {
});
};
// Bootstrap the application, configure models, datasources and middleware.
// Sub-apps like REST API are mounted via boot scripts.
boot(app, __dirname, function(err) {
if (err) throw err;
// start the server if `$ node server.js`
if (require.main === module)
app.start();
});

View File

@ -1,6 +1,4 @@
'use strict';
module.exports = function enableAuthentication(server) {
// enable authentication
// server.enableAuth();
//server.enableAuth();
};

View File

@ -1,8 +1,6 @@
'use strict';
module.exports = function(server) {
// Install a `/` route that returns server status
var router = server.loopback.Router();
router.get('/status', server.loopback.status());
server.use(router);
var router = server.loopback.Router();
router.get('/status', server.loopback.status());
server.use(router);
};

View File

@ -1,11 +1,11 @@
export const $module = () => {
return new Promise(resolve => {
require.ensure([], () => {
require('$module');
resolve('$module');
}, '$module');
});
return new Promise(resolve => {
require.ensure([], () => {
require('$module');
resolve('$module');
}, '$module');
});
};
core.splitingRegister.register('$module', $module);