diff --git a/public_html/page/home.php b/public_html/page/home.php index a3235d6..6f716d8 100644 --- a/public_html/page/home.php +++ b/public_html/page/home.php @@ -13,6 +13,7 @@ + diff --git a/webpack/data/common.js b/webpack/data/common.js new file mode 100644 index 0000000..c91a88b --- /dev/null +++ b/webpack/data/common.js @@ -0,0 +1,41 @@ +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'); diff --git a/webpack/data/home.js b/webpack/data/home.js new file mode 100644 index 0000000..8fe87e0 --- /dev/null +++ b/webpack/data/home.js @@ -0,0 +1 @@ +gstore.add('blo', 12); diff --git a/webpack/lib/gstore.js b/webpack/lib/gstore.js new file mode 100644 index 0000000..0d297e8 --- /dev/null +++ b/webpack/lib/gstore.js @@ -0,0 +1,14 @@ +/* classe GlobalStore */ +export class GlobalStore{ + + constructor(){ + + this.get = {}; + + } + + add(field, value){ + this.get[field] = value; + } + +} \ No newline at end of file diff --git a/webpack/page/home.js b/webpack/page/home.js index 04be724..1c5d8c0 100644 --- a/webpack/page/home.js +++ b/webpack/page/home.js @@ -9,13 +9,17 @@ import {APIClient} from '../lib/api-client' /* (3) Vues */ import wrapper_vue from '../vue/wrapper.vue' +/* (4) Data */ +require('../data/common'); +require('../data/home'); + + /* (2) Initialisation ---------------------------------------------------------*/ /* (1) API */ -window.api = new APIClient(gstore.data.is_local ? 'http://ptut.com:8080/api/v/1.0/' : 'https://ptut.xdrm.io/api/v/1.0/'); - +window.api = new APIClient(gstore.get.is_local ? 'http://ptut.com:8080/api/v/1.0/' : 'https://ptut.xdrm.io/api/v/1.0/'); /* (2) Render view */ new Vue({ diff --git a/webpack/scss/layout.scss b/webpack/scss/layout.scss index e69de29..849364a 100644 --- a/webpack/scss/layout.scss +++ b/webpack/scss/layout.scss @@ -0,0 +1,20 @@ +* { + margin: none; + padding: none; +} + +body{ + position: fixed; + display: block; + top: 0; + left: 0; + width: 100%; + height: 100%; + + background: #ccc; + + font-size: 16px; + font-family: 'Open Sans'; + + color: #333; +} \ No newline at end of file diff --git a/webpack/vue/header.vue b/webpack/vue/header.vue new file mode 100644 index 0000000..df96e0d --- /dev/null +++ b/webpack/vue/header.vue @@ -0,0 +1,25 @@ + + + + \ No newline at end of file diff --git a/webpack/vue/menu.vue b/webpack/vue/menu.vue new file mode 100644 index 0000000..c4c7e82 --- /dev/null +++ b/webpack/vue/menu.vue @@ -0,0 +1,28 @@ + + + + \ No newline at end of file diff --git a/webpack/vue/wrapper.vue b/webpack/vue/wrapper.vue index e69de29..da0867f 100644 --- a/webpack/vue/wrapper.vue +++ b/webpack/vue/wrapper.vue @@ -0,0 +1,28 @@ + + + + \ No newline at end of file