ptut-vhost/webpack/data/common.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

import {GlobalStore} from '../lib/gstore'
window.gstore = new GlobalStore();
/* (1) Main components
---------------------------------------------------------*/
/* (1) Header */
gstore.add('header_title', 'ndli1718');
/* (2) Menu */
gstore.add('menu_item', {
dashboard: {
label: 'Accueil',
theme: 'dashboard'
}, emergency: {
label: 'Urgences',
theme: 'emergency'
}, event: {
label: 'Signalements',
theme: 'event'
}, inbox: {
label: 'Messagerie',
theme: 'inbox'
}
});
gstore.add('URI', document.URL.replace(/^(?:\/\/|[^\/]+)*/, ''));
gstore.add('is_local', document.URL.replace(/^http:\/\/([^\/]+)(?::\d+)?\/?.*$/, '$1') == 'ptut.com');
gstore.add('min_menu', false);
// // Proccess current page from url
// if( /^\/(\w+)(?:\/?.*)$/.test(gstore.data.URI) ){
// var mi_keys = Object.keys( gstore.data.menu_item );
// // if current page exists
// if( !!~mi_keys.indexOf(RegExp.$1) ) gstore.add('menu_item_active', RegExp.$1);
// else gstore.add('menu_item_active', 'dashboard');
// }else
// gstore.add('menu_item_active', 'dashboard');