From dd7bad469ca77169b376c393916d64b5c412ed37 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 5 Dec 2017 14:00:27 +0100 Subject: [PATCH] Fix notification associated pages count=0 --- view/vue-config.js | 14 ++++++++++++++ view/vue/header.vue | 13 +++---------- view/vue/menu.vue | 14 +++----------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/view/vue-config.js b/view/vue-config.js index 2eaf861..aeab430 100644 --- a/view/vue-config.js +++ b/view/vue-config.js @@ -49,6 +49,20 @@ if( /^\/(\w+)(?:\/?.*)$/.test(window.gstore.data.URI) ){ // Functions window.gstore.add('func', { + nav: function(router, uri){ + + // {1} Update view (vue-router) // + router.push('/'+uri); + + // {2} Activate current menu_item // + window.gstore.data.menu_item_active = uri; + + // {3} Manage notifications // + for( var notif of window.gstore.data.notif ) + if( notif.link == uri ) // if notif links to current page + notif.count = 0; + + }, toggleMenuSize: function(){ window.gstore.data.min_menu=!window.gstore.data.min_menu; }, sendMessage: function(msg){ /* (1) Send message to WebSocket */ diff --git a/view/vue/header.vue b/view/vue/header.vue index 745135d..b3ea3a9 100644 --- a/view/vue/header.vue +++ b/view/vue/header.vue @@ -12,7 +12,7 @@
-
+
@@ -25,15 +25,8 @@ export default { name: 'HEADER', data(){ return { gstore: window.gstore.data }; }, methods: { - show_notif(index, link){ - - // {1} Load link // - window.gstore.data.menu_item_active = link; - - // {2} Reset notification count to 0 // - window.gstore.data.notif[index].count = 0; - - + show_notif(uri){ + window.gstore.data.func.nav(this.$router, uri); } } } diff --git a/view/vue/menu.vue b/view/vue/menu.vue index 286fe20..a32b2b7 100644 --- a/view/vue/menu.vue +++ b/view/vue/menu.vue @@ -4,7 +4,7 @@