2018-12-05 16:35:54 +01:00
|
|
|
const HomeRouter = {
|
2018-12-28 10:18:21 +01:00
|
|
|
template: `
|
2019-07-21 15:20:32 +02:00
|
|
|
<div>
|
2019-07-22 18:51:02 +02:00
|
|
|
<div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
|
2019-07-23 17:34:57 +02:00
|
|
|
<a id="escape-search-link" @click="goBackToDashboard">< zurück zu allen Einträgen</a>
|
|
|
|
<b-button id="subscribe-btn" type="is-primary" @click="changeSubscribtion"><div id="btn-text"></div></b-button>
|
2019-07-21 15:20:32 +02:00
|
|
|
<MsgCard
|
|
|
|
v-for="id in messagelist.slice().reverse()"
|
|
|
|
:key="id"
|
|
|
|
:msg="messages[id] || {}"
|
2019-07-23 17:38:11 +02:00
|
|
|
:isBookmark="bookmarkArray[id]"
|
2019-07-21 15:20:32 +02:00
|
|
|
></MsgCard>
|
|
|
|
</div>
|
2018-12-05 16:35:54 +01:00
|
|
|
</div>`,
|
2018-12-28 10:18:21 +01:00
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
messagelist: _messagelist,
|
|
|
|
messages: _messages,
|
2019-07-22 18:40:51 +02:00
|
|
|
isSearchActiv: _isSearchActiv,
|
2019-07-23 16:07:14 +02:00
|
|
|
isSubscripeButtonActiv: _isSubscripeButtonActiv,
|
|
|
|
bookmarkArray: auth.bookmarks,
|
2018-12-28 10:18:21 +01:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
2019-07-19 12:52:43 +02:00
|
|
|
list_messages: function() {
|
|
|
|
messages();
|
2019-07-22 18:40:51 +02:00
|
|
|
},
|
|
|
|
goBackToDashboard: function() {
|
|
|
|
//Home neu rendern ...
|
|
|
|
//windows.history.go();
|
2019-07-23 17:34:57 +02:00
|
|
|
router.push('/files')
|
|
|
|
router.push('/home')
|
|
|
|
$("#escape-search-link").css("visibility", "hidden");
|
|
|
|
$("#subscribe-btn").css("visibility", "hidden");
|
|
|
|
},
|
|
|
|
changeSubscribtion: function(){
|
|
|
|
var btnString = $("#btn-text").text();
|
|
|
|
//console.log(btnString);
|
2018-12-19 18:18:42 +01:00
|
|
|
|
2019-07-23 17:34:57 +02:00
|
|
|
if($("#btn-text").hasClass("subscribed")){
|
|
|
|
$("#btn-text").removeClass("subscribed");
|
|
|
|
var newBtnString = "#" + $("#btn-text").text(/deabonnieren/g, '') + "abonnieren";
|
|
|
|
//console.log(btnString);
|
|
|
|
$("#btn-text").text(newBtnString);
|
|
|
|
}else{
|
|
|
|
$("#btn-text").addClass("subscribed");
|
|
|
|
var newBtnString = "#" + $("#btn-text").text(/abonnieren/g, '') + "deabonnieren";
|
|
|
|
//console.log(newBtnString);
|
|
|
|
$("#btn-text").text(newBtnString);
|
|
|
|
|
|
|
|
}
|
2019-07-22 18:40:51 +02:00
|
|
|
}
|
2019-07-23 16:07:14 +02:00
|
|
|
|
2019-07-22 18:40:51 +02:00
|
|
|
},
|
2019-02-06 17:00:38 +01:00
|
|
|
mounted: function () {
|
|
|
|
this.list_messages();
|
|
|
|
//this.refresh_messages();
|
2019-01-31 19:01:40 +01:00
|
|
|
}
|
2018-12-05 16:35:54 +01:00
|
|
|
};
|
2018-12-28 10:18:21 +01:00
|
|
|
|
2019-02-06 17:00:38 +01:00
|
|
|
function get_insert_message(id) {
|
2019-06-20 17:17:45 +02:00
|
|
|
$.ajax({ url: "api/msg/id/"+id, method: "GET" }).done(function (msg) {
|
2018-12-28 10:18:21 +01:00
|
|
|
Vue.set(_messages, id, msg);
|
|
|
|
}).fail(function (e, f, g) {
|
|
|
|
console.log("cannot load " + id + ".json: " + e + f + g);
|
|
|
|
})
|
|
|
|
}
|