This commit is contained in:
Juan Ferrer Toribio 2017-03-01 09:55:17 +01:00
parent 0ef8995724
commit 2cc7d96dce
18 changed files with 37 additions and 87 deletions

View File

@ -6,7 +6,7 @@ root = true
[*]
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true

View File

@ -1 +1 @@
export * from './src/auth'
export * from './src/auth';

View File

@ -1,4 +1,4 @@
export * from './module';
import './config';
export {component as Login} from './login/login'
export {component as Login} from './login/login';

View File

@ -7,8 +7,8 @@ export const component = {
};
module.component('vnLogin', component);
controller.$inject = ['$http', '$element'];
function controller($http, $element) {
controller.$inject = ['$http', '$element', '$window'];
function controller($http, $element, $window) {
Object.assign(this, {
submit: function() {
let model = this.model;
@ -19,16 +19,16 @@ function controller($http, $element) {
}
this.loading = true;
model.appId = window.location.href;
model.appId = $window.location.href;
$http.post('/auth', this.model).then(
(json) => this.onLoginOk(json),
(json) => this.onLoginErr(json)
json => this.onLoginOk(json),
json => this.onLoginErr(json)
);
},
onLoginOk: function(json) {
this.loading = false;
let data = json.data;
window.location = `${data.location}?access_token=${data.location}`;
$window.location = `${data.location}?access_token=${data.location}`;
},
onLoginErr: function(json) {
this.loading = false;

View File

@ -1,2 +1 @@
export * from './src/core'
export * from './src/core';

View File

@ -1,4 +1,3 @@
var path = require('path');
var gulp = require('gulp');
var gutil = require('gulp-util');
var wrap = require('gulp-wrap');
@ -12,7 +11,7 @@ var WebpackDevServer = require('webpack-dev-server');
// Configuration
var srcDir = './client'
var srcDir = './client';
var buildDir = './services/nginx/static';
var langs = ['es', 'en'];
@ -33,22 +32,22 @@ gulp.task('spliting', function() {
var importTpl = fs.readFileSync('./spliting/import.tpl.js', 'utf8');
var requireTpl = fs.readFileSync('./spliting/require.tpl.js', 'utf8');
for(var modName in modules) {
for (var modName in modules) {
var deps = modules[modName];
var splitFile = `${srcDir}/${modName}/src/spliting.js`;
try {
fs.unlinkSync(splitFile);
}
catch(e) {}
} catch (e) {}
fs.appendFileSync(splitFile, importTpl);
var i = deps.length;
while(i--)
while (i--) {
fs.appendFileSync(splitFile,
requireTpl.replace(/\$module/g, deps[i]));
}
}
});
// Webpack
@ -67,12 +66,13 @@ gulp.task('webpack', ['spliting'], function(callback) {
gulp.task('webpack-dev-server', ['spliting'], function(callback) {
var configCopy = Object.create(webpackConfig);
for (var entry in configCopy.entry)
for (var entry in configCopy.entry) {
configCopy.entry[entry]
.unshift('webpack-dev-server/client?http://0.0.0.0:8081/');
}
var compiler = webpack(configCopy);
var devServer = new WebpackDevServer(compiler, {
new WebpackDevServer(compiler, {
publicPath: '/',
contentBase: buildDir,
quiet: false,
@ -100,13 +100,14 @@ var localeFiles = `./${srcDir}/**/locale/*.json`;
gulp.task('locales', function() {
var streams = [];
for(var mod in modules)
for(var lang of langs) {
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

@ -27,9 +27,10 @@
"cors": "^2.8.1",
"css-loader": "^0.25.0",
"del": "^2.2.2",
"eslint": "^3.7.1",
"eslint": "^3.16.1",
"eslint-config-angular": "^0.5.0",
"eslint-config-google": "^0.6.0",
"eslint-config-xo": "^0.17.0",
"eslint-plugin-angular": "^1.4.1",
"file-loader": "^0.9.0",
"gulp": "^3.9.1",

View File

@ -1,13 +0,0 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -1 +0,0 @@
/client/

View File

@ -1,3 +0,0 @@
{
"extends": "loopback"
}

View File

@ -1,13 +0,0 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -1 +0,0 @@
/client/

View File

@ -1,3 +0,0 @@
{
"extends": "loopback"
}

View File

@ -80,7 +80,6 @@
"description": "Send invoices by email"
}
},
"validations": [],
"relations": {
"account": {
"type": "hasOne",
@ -98,6 +97,7 @@
"where": {"name": "Verdnatura"}
}
},
"validations": [],
"acls": [],
"methods": {}
}

View File

@ -1,13 +0,0 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

View File

@ -1 +0,0 @@
/client/

View File

@ -1,3 +0,0 @@
{
"extends": "loopback"
}