cambio en routes e interfaz localizador al 5%

This commit is contained in:
Dani Herrero 2017-06-06 13:06:47 +02:00
parent 622884d31c
commit 9fcdb28d14
15 changed files with 124 additions and 52 deletions

View File

@ -22,7 +22,8 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
promises.push(modules[dep]()); promises.push(modules[dep]());
promises.push(new Promise(resolve => { promises.push(new Promise(resolve => {
$http.get(`/${dep}/validations`).then( $http.get(`/${dep}/validations`).then(
json => this.onValidationsReady(json, resolve) json => this.onValidationsReady(json, resolve),
json => resolve()
); );
})); }));

View File

@ -0,0 +1 @@
export * from './src/production';

View File

@ -0,0 +1,12 @@
{
"module": "production",
"name": "Production",
"icon": "group_work",
"routes": [
{
"url": "/production",
"state": "production",
"component": "vn-production-index"
}
]
}

View File

@ -0,0 +1,29 @@
<vn-card margin-large>
<vn-vertical pad-medium>
<vn-horizontal vn-one>
<vn-one>
<vn-title><span translate>Localizador</span></vn-title>
</vn-one>
<vn-one>
<vn-textfield vn-one label="Search" model="$ctrl.filter"></vn-textfield>
</vn-one>
<vn-one>
<vn-horizontal>
<vn-one></vn-one>
<vn-one>
<vn-textfield vn-one label="Search" model="$ctrl.Search"></vn-textfield>
</vn-one>
<vn-none>
<vn-icon-button icon="refresh"></vn-icon-button>
</vn-none>
</vn-horizontal>
</vn-one>
</vn-horizontal>
<vn-horizontal vn-one>
<vn-one>
</vn-one>
<vn-two></vn-two>
</vn-horizontal>
</vn-vertical>
</vn-card>

View File

@ -0,0 +1,13 @@
import ngModule from '../module';
export default class ProductionIndex {
search(index) {
index.filter.search = this.model.search;
index.accept();
}
}
ngModule.component('vnProductionIndex', {
template: require('./index.html'),
controller: ProductionIndex
});

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,5 @@
import {ng} from 'vendor';
import 'core';
const ngModule = ng.module('production', []);
export default ngModule;

View File

@ -0,0 +1,5 @@
export * from './module';
// import components
import './index/index';

View File

@ -2,7 +2,7 @@
<vn-horizontal> <vn-horizontal>
<h6 vn-one translate="Modules access"></h6> <h6 vn-one translate="Modules access"></h6>
</vn-horizontal> </vn-horizontal>
<vn-horizontal vn-one> <vn-module-container>
<a ng-repeat="mod in $ctrl.modules" ui-sref="{{::mod.route.state}}" class="{{::mod.name}} vn-module mdl-shadow--4dp"> <a ng-repeat="mod in $ctrl.modules" ui-sref="{{::mod.route.state}}" class="{{::mod.name}} vn-module mdl-shadow--4dp">
<vn-vertical> <vn-vertical>
<vn-one> <vn-one>

View File

@ -10,15 +10,23 @@ vn-home {
a:link{ a:link{
text-decoration: none; text-decoration: none;
} }
vn-module-container{
display: flex;
flex: 1;
flex-direction: row;
justify-content: center;
.vn-module{ .vn-module{
display: flex; display: flex;
flex: none; flex: none;
padding: 2em; padding: 2em;
margin: 10px;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
transition: opacity 0.7s ease; transition: opacity 0.7s ease;
h4{ h4{
text-transform: capitalize; text-transform: capitalize;
font-size: 16pt;
} }
vn-one{ vn-one{
text-align: center; text-align: center;
@ -36,6 +44,11 @@ vn-home {
background-color: #ffa410; background-color: #ffa410;
color: #ffffff; color: #ffffff;
} }
&.Production{
background-color: #95d600;
color: #ffffff;
}
} }
} }
}

View File

@ -9,9 +9,9 @@ export default class LeftMenu {
this.init(); this.init();
} }
init() { init() {
let station = this.$state.current.data.station || 'default'; let routes = this.$state.current.data.routes || [];
if (routes[station]) { if (routes.length) {
routes[station].routes.forEach(i => { routes.forEach(i => {
if (i.menu && this.aclService.routeHasPermission(i)) if (i.menu && this.aclService.routeHasPermission(i))
this.items.push({ this.items.push({
description: i.menu.description, description: i.menu.description,

View File

@ -50,7 +50,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) {
loader: loader(moduleName) loader: loader(moduleName)
}, },
data: { data: {
station: file routes: fileRoutes
} }
}); });
} }

View File

@ -114,7 +114,7 @@ gulp.task('webpack-dev-server', ['spliting'], function() {
// Locale // Locale
var localeFiles = `./${srcDir}/**/locale/*.json`; var localeFiles = `${srcDir}/**/locale/*.json`;
gulp.task('locales', function() { gulp.task('locales', function() {
var streams = []; var streams = [];
@ -132,22 +132,12 @@ gulp.task('locales', function() {
// Routes // Routes
var routeFiles = `./${srcDir}/**/routes.json`; var routeFiles = `${srcDir}/**/routes.json`;
gulp.task('routes', function() { gulp.task('routes', function() {
function cb(file) {
var relative = file.relative.replace(/\\/g, '/');
var dirname = relative.match(/^(.*)\/routes\.json$/)[1];
return {
dirname: dirname,
json: file.contents
};
}
return gulp.src(routeFiles) return gulp.src(routeFiles)
.pipe(wrap('\n"<%=dirname%>": <%=json%>', cb))
.pipe(concat('routes.js', {newLine: ','})) .pipe(concat('routes.js', {newLine: ','}))
.pipe(wrap('var routes = {<%=contents%>\n};')) .pipe(wrap('var routes = [<%=contents%>\n];'))
.pipe(gulp.dest(buildDir)); .pipe(gulp.dest(buildDir));
}); });

View File

@ -1,6 +1,7 @@
{ {
"salix": ["client"], "salix": ["client", "production"],
"auth": [], "auth": [],
"core": [], "core": [],
"client": [] "client": [],
"production": []
} }