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:
nelo 2016-10-07 11:48:49 +02:00
commit 0bfbc5e064
18 changed files with 98 additions and 53 deletions

View File

@ -1 +1 @@
export * from './src/app'
export * from './src/app'

View File

@ -2,5 +2,4 @@ import {bootstrap} from './bootstrap';
import * as spliting from './spliting';
import * as routes from './routes';
bootstrap();

View File

@ -1,11 +1,8 @@
import * as core from '@salix/core';
import * as spliting from './spliting';
import * as routes from './fake';
core.module.config(function ($stateProvider, $urlRouterProvider) {
core.splitingRegister.registerGraph(routes.graphRoutes.graphDependendies);
function loader(route) {
@ -29,5 +26,5 @@ core.module.config(function ($stateProvider, $urlRouterProvider) {
loader: loader(route)
}
})
}, this);
});
});

View File

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

View File

@ -1,4 +0,0 @@
{
"route": "buys",
"template": "buys.template"
}

View File

@ -1,11 +1,15 @@
/**
* export public module
*/
export * from './module'
export * from './util'
export {SplitingRegister as splitingRegister} from './splitingregister'
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
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 BUTTONMT,factory as buttonmt} from './button/button.mt'
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'
@ -20,4 +24,4 @@ export {NAME as TEXTFIELDMT,factory as textfieldmt} from './textfield/textfield.
export {NAME as TEXTFIELDBT,factory as textfieldbt} from './textfield/textfield.bt'
export {NAME as LABEL,directive as LabelDirective} from './label/label'
export {NAME as LABELMT,factory as labelmt} from './label/label.mt'
export {NAME as LABELBT,factory as labelbt} from './label/label.bt'
export {NAME as LABELBT,factory as labelbt} from './label/label.bt'

View File

@ -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 ())

View File

@ -1,2 +1,4 @@
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'

View File

@ -0,0 +1 @@
<vn-button text='customer add'></vn-button>

View File

@ -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);

View File

@ -1 +1 @@
<div>index from component</div>
<customer-add users="$ctrl.users"></customer-add>

View File

@ -4,11 +4,10 @@ import {module} from '../../module';
export const NAME = 'customerIndex';
export const COMPONENT = {
template: template,
controller: function() {
this.user = {name: 'world'};
controller :function(){
this.users = {id:10,name:"xxxx"};
}
};
module.component(NAME, COMPONENT);

View File

@ -1,4 +0,0 @@
{
"route": "sales",
"template": "sales.template"
}

View File

@ -1,16 +1,13 @@
var gulp = require ('gulp');
var jsoncombine = require ('gulp-jsoncombine');
function combineFunc (data)
{
return new Buffer (JSON.stringify (data));
}
var concat = require ('gulp-concat');
var babel = require ('gulp-babel');
gulp.task ('default', function ()
{
var json = gulp.src ('./@salix/**/routing.json')
.pipe (jsoncombine ('salix.routes.json', combineFunc))
.pipe (gulp.dest ('./build'));
var js = gulp.src ('./@salix/crud/**/routes.js')
.pipe (concat ('salix.routes.js'))
.pipe (babel ({presets: ['es2015']}))
.pipe (gulp.dest ('./build/private'));
});

View File

@ -11,6 +11,10 @@
<a ui-sref="edit">edit</a>
<a ui-sref="delete">delete</a>
</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>
</html>

View File

@ -16,18 +16,23 @@
"oclazyload": "^0.6.3"
},
"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-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": {
"build": "webpack --progress --colors --watch"
"build": "webpack --progress --colors --watch",
"dev": "webpack-dev-server --progress --colors --inline --hot",
"gulp": "gulp",
"express": "node server.js"
}
}

View File

@ -1,11 +1,9 @@
var express = require ('express');
var cors = require ('cors');
function getRoutes (req, res)
{
var routes = require ('./build/salix.routes.json');
res.send (JSON.stringify (routes));
}
var port = 3000;
var routesUrl = '/private/salix.routes.js';
function getDefault (res, res)
{
@ -14,11 +12,11 @@ function getDefault (res, res)
function onListen ()
{
console.log ('HTTP server started.');
console.log ('HTTP server started on port '+ port);
}
var app = express ();
app.get ('/routes.json', getRoutes);
app.all (/.*/, getDefault);
app.listen (8080, onListen);
app.use ('/private', cors (), express.static (__dirname +'/build/private'));
app.all (/.*/, cors (), getDefault);
app.listen (port, onListen);

View File

@ -8,9 +8,9 @@ module.exports =
'salix.app': ['@salix/app']
},
output: {
path: path.join(__dirname, 'build'),
path: path.join(__dirname, 'build', 'public'),
filename: '[name].js',
publicPath: 'build/',
publicPath: 'build/public/',
chunkFilename: "[name].js"
},
module: {
@ -39,5 +39,6 @@ module.exports =
__dirname,
'node_modules'
]
}
},
devtool: 'cheap-module-eval-source-map' // 'source-map'
};