Merge branch 'master' of ssh://git.verdnatura.es:/var/lib/git/salix
# Conflicts: # @salix/app/src/routes.js # @salix/compras/index.js # @salix/crud/src/crud.js
This commit is contained in:
commit
0bfbc5e064
|
@ -2,5 +2,4 @@ import {bootstrap} from './bootstrap';
|
||||||
import * as spliting from './spliting';
|
import * as spliting from './spliting';
|
||||||
import * as routes from './routes';
|
import * as routes from './routes';
|
||||||
|
|
||||||
|
|
||||||
bootstrap();
|
bootstrap();
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
import * as core from '@salix/core';
|
import * as core from '@salix/core';
|
||||||
|
|
||||||
import * as spliting from './spliting';
|
import * as spliting from './spliting';
|
||||||
import * as routes from './fake';
|
import * as routes from './fake';
|
||||||
|
|
||||||
|
|
||||||
core.module.config(function ($stateProvider, $urlRouterProvider) {
|
core.module.config(function ($stateProvider, $urlRouterProvider) {
|
||||||
|
|
||||||
core.splitingRegister.registerGraph(routes.graphRoutes.graphDependendies);
|
core.splitingRegister.registerGraph(routes.graphRoutes.graphDependendies);
|
||||||
|
|
||||||
function loader(route) {
|
function loader(route) {
|
||||||
|
@ -29,5 +26,5 @@ core.module.config(function ($stateProvider, $urlRouterProvider) {
|
||||||
loader: loader(route)
|
loader: loader(route)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, this);
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
export * from './src/compras';
|
export * from './src/compras';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"route": "buys",
|
|
||||||
"template": "buys.template"
|
|
||||||
}
|
|
|
@ -1,11 +1,15 @@
|
||||||
/**
|
/**
|
||||||
* export public module
|
* export public module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './module'
|
export * from './module'
|
||||||
export * from './util'
|
export * from './util'
|
||||||
|
|
||||||
export {SplitingRegister as splitingRegister} from './splitingregister'
|
export {SplitingRegister as splitingRegister} from './splitingregister'
|
||||||
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
|
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
|
||||||
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
|
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
|
||||||
|
export {NAME as ROUTESLOADER, RoutesLoader} from './routesLoader'
|
||||||
|
|
||||||
export {NAME as BUTTON,directive as ButtonDirective} from './button/button'
|
export {NAME as BUTTON,directive as ButtonDirective} from './button/button'
|
||||||
export {NAME as BUTTONMT,factory as buttonmt} from './button/button.mt'
|
export {NAME as BUTTONMT,factory as buttonmt} from './button/button.mt'
|
||||||
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'
|
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
import {module as _module} from './module'
|
||||||
|
import * as util from './util'
|
||||||
|
|
||||||
|
export const NAME = util.getProviderName ('RoutesLoader')
|
||||||
|
|
||||||
|
export class RoutesLoader
|
||||||
|
{
|
||||||
|
constructor () {}
|
||||||
|
|
||||||
|
$get ($http)
|
||||||
|
{
|
||||||
|
let script = document.currentScript || (() => {
|
||||||
|
let scripts = document.getElementsByTagName ('script');
|
||||||
|
return scripts[scripts.length - 1];
|
||||||
|
}) ();
|
||||||
|
|
||||||
|
let routesCdn = script.getAttribute ('routes-cdn');
|
||||||
|
|
||||||
|
return $http
|
||||||
|
({
|
||||||
|
method: 'GET',
|
||||||
|
url: routesCdn
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_module.provider (NAME, () => new RoutesLoader ())
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
export * from './module';
|
export * from './module';
|
||||||
export {NAME as CUSTOMER_INDEX, COMPONENT as CUSTOMER_INDEX_COMPONENT} from './customer/index'
|
export {NAME as CUSTOMER_INDEX, COMPONENT as CUSTOMER_INDEX_COMPONENT} from './customer/index'
|
||||||
|
export {NAME as CUSTOMER_ADD, COMPONENT as CUSTOMER_ADD_COMPONENT} from './customer/index/add'
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<vn-button text='customer add'></vn-button>
|
|
@ -0,0 +1,16 @@
|
||||||
|
import template from './add.html';
|
||||||
|
import {module} from '../../module';
|
||||||
|
|
||||||
|
export const NAME = 'customerAdd';
|
||||||
|
|
||||||
|
export const COMPONENT = {
|
||||||
|
template: template,
|
||||||
|
bindings :{
|
||||||
|
users: '<'
|
||||||
|
},
|
||||||
|
controller :function($scope, $element, $attrs){
|
||||||
|
console.log(this.users);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.component(NAME, COMPONENT);
|
|
@ -1 +1 @@
|
||||||
<div>index from component</div>
|
<customer-add users="$ctrl.users"></customer-add>
|
|
@ -5,10 +5,9 @@ export const NAME = 'customerIndex';
|
||||||
export const COMPONENT = {
|
export const COMPONENT = {
|
||||||
template: template,
|
template: template,
|
||||||
controller :function(){
|
controller :function(){
|
||||||
this.user = {name: 'world'};
|
this.users = {id:10,name:"xxxx"};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.component(NAME, COMPONENT);
|
module.component(NAME, COMPONENT);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"route": "sales",
|
|
||||||
"template": "sales.template"
|
|
||||||
}
|
|
15
gulpfile.js
15
gulpfile.js
|
@ -1,16 +1,13 @@
|
||||||
|
|
||||||
var gulp = require ('gulp');
|
var gulp = require ('gulp');
|
||||||
var jsoncombine = require ('gulp-jsoncombine');
|
var concat = require ('gulp-concat');
|
||||||
|
var babel = require ('gulp-babel');
|
||||||
function combineFunc (data)
|
|
||||||
{
|
|
||||||
return new Buffer (JSON.stringify (data));
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task ('default', function ()
|
gulp.task ('default', function ()
|
||||||
{
|
{
|
||||||
var json = gulp.src ('./@salix/**/routing.json')
|
var js = gulp.src ('./@salix/crud/**/routes.js')
|
||||||
.pipe (jsoncombine ('salix.routes.json', combineFunc))
|
.pipe (concat ('salix.routes.js'))
|
||||||
.pipe (gulp.dest ('./build'));
|
.pipe (babel ({presets: ['es2015']}))
|
||||||
|
.pipe (gulp.dest ('./build/private'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
<a ui-sref="edit">edit</a>
|
<a ui-sref="edit">edit</a>
|
||||||
<a ui-sref="delete">delete</a>
|
<a ui-sref="delete">delete</a>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="build/salix.app.js" selector="#app"></script>
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="build/public/salix.app.js"
|
||||||
|
selector="#app">
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
25
package.json
25
package.json
|
@ -16,18 +16,23 @@
|
||||||
"oclazyload": "^0.6.3"
|
"oclazyload": "^0.6.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "^3.9.1",
|
|
||||||
"gulp-jsoncombine": "^1.0.3",
|
|
||||||
"webpack": "*",
|
|
||||||
"webpack-dev-server": "*",
|
|
||||||
"raw-loader": "*",
|
|
||||||
"css-loader": "^0.25.0",
|
|
||||||
"style-loader": "^0.13.1",
|
|
||||||
"babel-loader": "*",
|
|
||||||
"babel-core": "*",
|
"babel-core": "*",
|
||||||
"babel-preset-es2015": "*"
|
"babel-loader": "*",
|
||||||
|
"babel-preset-es2015": "*",
|
||||||
|
"cors": "^2.8.1",
|
||||||
|
"css-loader": "^0.25.0",
|
||||||
|
"gulp": "^3.9.1",
|
||||||
|
"gulp-babel": "^6.1.2",
|
||||||
|
"gulp-concat": "^2.6.0",
|
||||||
|
"raw-loader": "*",
|
||||||
|
"style-loader": "^0.13.1",
|
||||||
|
"webpack": "*",
|
||||||
|
"webpack-dev-server": "*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --progress --colors --watch"
|
"build": "webpack --progress --colors --watch",
|
||||||
|
"dev": "webpack-dev-server --progress --colors --inline --hot",
|
||||||
|
"gulp": "gulp",
|
||||||
|
"express": "node server.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
server.js
16
server.js
|
@ -1,11 +1,9 @@
|
||||||
|
|
||||||
var express = require ('express');
|
var express = require ('express');
|
||||||
|
var cors = require ('cors');
|
||||||
|
|
||||||
function getRoutes (req, res)
|
var port = 3000;
|
||||||
{
|
var routesUrl = '/private/salix.routes.js';
|
||||||
var routes = require ('./build/salix.routes.json');
|
|
||||||
res.send (JSON.stringify (routes));
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefault (res, res)
|
function getDefault (res, res)
|
||||||
{
|
{
|
||||||
|
@ -14,11 +12,11 @@ function getDefault (res, res)
|
||||||
|
|
||||||
function onListen ()
|
function onListen ()
|
||||||
{
|
{
|
||||||
console.log ('HTTP server started.');
|
console.log ('HTTP server started on port '+ port);
|
||||||
}
|
}
|
||||||
|
|
||||||
var app = express ();
|
var app = express ();
|
||||||
app.get ('/routes.json', getRoutes);
|
app.use ('/private', cors (), express.static (__dirname +'/build/private'));
|
||||||
app.all (/.*/, getDefault);
|
app.all (/.*/, cors (), getDefault);
|
||||||
app.listen (8080, onListen);
|
app.listen (port, onListen);
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ module.exports =
|
||||||
'salix.app': ['@salix/app']
|
'salix.app': ['@salix/app']
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, 'build'),
|
path: path.join(__dirname, 'build', 'public'),
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
publicPath: 'build/',
|
publicPath: 'build/public/',
|
||||||
chunkFilename: "[name].js"
|
chunkFilename: "[name].js"
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
|
@ -39,5 +39,6 @@ module.exports =
|
||||||
__dirname,
|
__dirname,
|
||||||
'node_modules'
|
'node_modules'
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
devtool: 'cheap-module-eval-source-map' // 'source-map'
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue