diff --git a/public/routes/home.js b/public/routes/home.js index dd838ce..dea33ce 100644 --- a/public/routes/home.js +++ b/public/routes/home.js @@ -2,6 +2,8 @@ const HomeRouter = { template: ` <div> <div id="om-msg-cards" class="is-hidden-desktop"> + <a v-if="isSearchActiv" @click="goBackToDashboard">< zurück zu allen Einträgen</a> + <b-button class="subscribe-btn" v-if="isSubscripeButtonActiv" type="is-primary" @click="">#IPSUM ABONNIEREN</b-button> <MsgCard v-for="id in messagelist.slice().reverse()" :key="id" @@ -10,6 +12,8 @@ const HomeRouter = { </div> <div id="om-msg-cards" class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop"> + <a v-if="isSearchActiv" @click="goBackToDashboard">< zurück zu allen Einträgen</a> + <b-button class="subscribe-btn" v-if="isSubscripeButtonActiv" type="is-primary" @click="">#IPSUM ABONNIEREN</b-button> <MsgCard v-for="id in messagelist.slice().reverse()" :key="id" @@ -21,14 +25,21 @@ const HomeRouter = { return { messagelist: _messagelist, messages: _messages, + isSearchActiv: _isSearchActiv, + isSubscripeButtonActiv: _isSubscripeButtonActiv }; }, methods: { list_messages: function() { messages(); - } - }, + }, + goBackToDashboard: function() { + //Home neu rendern ... + //windows.history.go(); + _isSearchActiv = false; + } + }, mounted: function () { this.list_messages(); //this.refresh_messages(); diff --git a/public/routes/initGlobals.js b/public/routes/initGlobals.js index 281f773..631d873 100644 --- a/public/routes/initGlobals.js +++ b/public/routes/initGlobals.js @@ -8,11 +8,14 @@ var auth = {}, _messages = {}, // Tag - _taglist = [], + _taglist = ["efi","wichtig"], _tags = [], tagArray = [], // Search - isSearchActive = false, + _isSearchActiv = false, + _isSubscripeButtonActiv = false, data = [], - search_data = []; + search_data = [] + + diff --git a/public/search.js b/public/search.js index 1a327c0..ef38c38 100644 --- a/public/search.js +++ b/public/search.js @@ -69,9 +69,7 @@ Vue.component('search',{ }); }, clear: function() { - console.log("clear"); - - isSearchActiv = false; + _isSearchActiv = false; this.searchtext = ""; this.list_messages(); }, @@ -95,7 +93,7 @@ function get_insert_tag(id) { } function searching(searchtext) { - isSearchActiv = true; + _isSearchActiv = true; console.log("Searchtext: " + searchtext.replace(/#/g, '')); $.ajax({ url: "api/msg/search/" + searchtext.replace(/#/g, ''), @@ -113,6 +111,9 @@ function searching(searchtext) { }).fail(function(e, f, g) { console.log("searching: err: " + e + f + g); }) + + _isSubscripeButtonActiv = (_taglist.indexOf(searchtext.replace(/#/g, '')) > -1); + console.log("isSubscripeButtonActiv: " + _isSubscripeButtonActiv); } function messages() { diff --git a/public/style/style.css b/public/style/style.css index 6eb2023..f646ef7 100644 --- a/public/style/style.css +++ b/public/style/style.css @@ -241,3 +241,7 @@ button.clearButton { float: right; } } + +.subscribe-btn{ + float:right; +}