cambio en routes e interfaz localizador al 5%
This commit is contained in:
parent
622884d31c
commit
9fcdb28d14
|
@ -8,7 +8,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
|
|||
this._loadedModules = {};
|
||||
}
|
||||
load(moduleName) {
|
||||
if(this._loadedModules[moduleName])
|
||||
if (this._loadedModules[moduleName])
|
||||
return;
|
||||
|
||||
this._loadedModules[moduleName] = true;
|
||||
|
@ -17,18 +17,19 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
|
|||
let modules = splitingRegister.modules;
|
||||
let promises = [];
|
||||
|
||||
for(let dep of deps) {
|
||||
for (let dep of deps) {
|
||||
this._loadedModules[dep] = true;
|
||||
promises.push(modules[dep]());
|
||||
promises.push(new Promise(resolve => {
|
||||
$http.get(`/${dep}/validations`).then(
|
||||
json => this.onValidationsReady(json, resolve)
|
||||
json => this.onValidationsReady(json, resolve),
|
||||
json => resolve()
|
||||
);
|
||||
}));
|
||||
|
||||
$translatePartialLoader.addPart(dep);
|
||||
// FIXME: https://github.com/angular-translate/angular-translate/pull/1674
|
||||
//promises.push($translate.refresh());
|
||||
// promises.push($translate.refresh());
|
||||
setTimeout (() => $translate.refresh(), 500);
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
|
|||
});
|
||||
}
|
||||
parseValidation(val) {
|
||||
switch(val.validation) {
|
||||
switch (val.validation) {
|
||||
case 'custom':
|
||||
// TODO: Reemplazar eval
|
||||
val.customValidator = eval(`(${val.customValidator})`);
|
||||
|
@ -53,11 +54,11 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
|
|||
}
|
||||
onValidationsReady(json, resolve) {
|
||||
let entities = json.data;
|
||||
for(let entity in entities) {
|
||||
for (let entity in entities) {
|
||||
let fields = entities[entity].validations;
|
||||
for(let field in fields) {
|
||||
for (let field in fields) {
|
||||
let validations = fields[field];
|
||||
for(let validation of validations)
|
||||
for (let validation of validations)
|
||||
this.parseValidation(validation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export * from './src/production';
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"module": "production",
|
||||
"name": "Production",
|
||||
"icon": "group_work",
|
||||
"routes": [
|
||||
{
|
||||
"url": "/production",
|
||||
"state": "production",
|
||||
"component": "vn-production-index"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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>
|
|
@ -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
|
||||
});
|
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -0,0 +1 @@
|
|||
{}
|
|
@ -0,0 +1,5 @@
|
|||
import {ng} from 'vendor';
|
||||
import 'core';
|
||||
|
||||
const ngModule = ng.module('production', []);
|
||||
export default ngModule;
|
|
@ -0,0 +1,5 @@
|
|||
export * from './module';
|
||||
|
||||
|
||||
// import components
|
||||
import './index/index';
|
|
@ -2,7 +2,7 @@
|
|||
<vn-horizontal>
|
||||
<h6 vn-one translate="Modules access"></h6>
|
||||
</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">
|
||||
<vn-vertical>
|
||||
<vn-one>
|
||||
|
|
|
@ -10,32 +10,45 @@ vn-home {
|
|||
a:link{
|
||||
text-decoration: none;
|
||||
}
|
||||
.vn-module{
|
||||
vn-module-container{
|
||||
display: flex;
|
||||
flex: none;
|
||||
padding: 2em;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
transition: opacity 0.7s ease;
|
||||
h4{
|
||||
text-transform: capitalize;
|
||||
}
|
||||
vn-one{
|
||||
text-align: center;
|
||||
}
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
|
||||
i{
|
||||
font-size: 50px !important;
|
||||
margin: 0 auto;
|
||||
.vn-module{
|
||||
display: flex;
|
||||
flex: none;
|
||||
padding: 2em;
|
||||
margin: 10px;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
transition: opacity 0.7s ease;
|
||||
h4{
|
||||
text-transform: capitalize;
|
||||
font-size: 16pt;
|
||||
}
|
||||
vn-one{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
i{
|
||||
font-size: 50px !important;
|
||||
margin: 0 auto;
|
||||
}
|
||||
&:hover{
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&.Clients{
|
||||
background-color: #ffa410;
|
||||
color: #ffffff;
|
||||
}
|
||||
&.Production{
|
||||
background-color: #95d600;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
}
|
||||
&:hover{
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&.Clients{
|
||||
background-color: #ffa410;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -9,9 +9,9 @@ export default class LeftMenu {
|
|||
this.init();
|
||||
}
|
||||
init() {
|
||||
let station = this.$state.current.data.station || 'default';
|
||||
if (routes[station]) {
|
||||
routes[station].routes.forEach(i => {
|
||||
let routes = this.$state.current.data.routes || [];
|
||||
if (routes.length) {
|
||||
routes.forEach(i => {
|
||||
if (i.menu && this.aclService.routeHasPermission(i))
|
||||
this.items.push({
|
||||
description: i.menu.description,
|
||||
|
|
|
@ -50,7 +50,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) {
|
|||
loader: loader(moduleName)
|
||||
},
|
||||
data: {
|
||||
station: file
|
||||
routes: fileRoutes
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
16
gulpfile.js
16
gulpfile.js
|
@ -114,7 +114,7 @@ gulp.task('webpack-dev-server', ['spliting'], function() {
|
|||
|
||||
// Locale
|
||||
|
||||
var localeFiles = `./${srcDir}/**/locale/*.json`;
|
||||
var localeFiles = `${srcDir}/**/locale/*.json`;
|
||||
|
||||
gulp.task('locales', function() {
|
||||
var streams = [];
|
||||
|
@ -132,22 +132,12 @@ gulp.task('locales', function() {
|
|||
|
||||
// Routes
|
||||
|
||||
var routeFiles = `./${srcDir}/**/routes.json`;
|
||||
var routeFiles = `${srcDir}/**/routes.json`;
|
||||
|
||||
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)
|
||||
.pipe(wrap('\n"<%=dirname%>": <%=json%>', cb))
|
||||
.pipe(concat('routes.js', {newLine: ','}))
|
||||
.pipe(wrap('var routes = {<%=contents%>\n};'))
|
||||
.pipe(wrap('var routes = [<%=contents%>\n];'))
|
||||
.pipe(gulp.dest(buildDir));
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"salix": ["client"],
|
||||
"salix": ["client", "production"],
|
||||
"auth": [],
|
||||
"core": [],
|
||||
"client": []
|
||||
"client": [],
|
||||
"production": []
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue