Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

home.js 2.9KB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. const HomeRouter = {
  2. template: `
  3. <div>
  4. <div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
  5. <b-button id="escape-search-link"
  6. v-if="_isSearchActiv"
  7. @click="goBackToDashboard"
  8. icon-left="arrow-left"
  9. type="is-primary"
  10. @toggle-escape-search-link="toggleEscapeSearchLink"
  11. outlined>
  12. zurück zu allen Einträgen
  13. </b-button>
  14. <!--<b-button id="subscribe-btn" type="is-primary" v-if="_isSubscripeButtonActiv" @update-home-abo-button="updateHomeAboButton" @click="changeSubscribtion">
  15. {{ subscripeTagName }}
  16. </b-button>--><br><br>
  17. <MsgCard
  18. v-for="id in messagelist.slice().reverse()"
  19. :key="id"
  20. :msg="messages[id] || {}"
  21. :isBookmark="bookmarkArray[id]">
  22. </MsgCard>
  23. </div>
  24. </div>`,
  25. data: function () {
  26. return {
  27. messagelist: _messagelist,
  28. messages: _messages,
  29. isSearchActiv: _isSearchActiv,
  30. isSubscripeButtonActiv: _isSubscripeButtonActiv,
  31. isSubscriped: false,
  32. subscripeTagName: '',
  33. bookmarkArray: auth.bookmarks,
  34. vueRender: vueRender,
  35. };
  36. },
  37. methods: {
  38. updateHomeAboButton: function(content) {
  39. this.subscripeTagName = content;
  40. console.info( this.subscripeTagName);
  41. vueForceRender('key');
  42. },
  43. toggleEscapeSearchLink: function() {
  44. console.info('got called');
  45. this.isSearchActive = !this.isSearchActive;
  46. vueForceRender('key');
  47. console.info( this.isSearchActive);
  48. },
  49. list_messages: function() {
  50. messages();
  51. },
  52. goBackToDashboard: function() {
  53. _isSearchActiv = false;
  54. this.$emit('reset-searchtext','');
  55. // $("#escape-search-link").css("visibility", "hidden");
  56. // $("#subscribe-btn").css("visibility", "hidden");
  57. _isSubscripeButtonActiv = false;
  58. vueForceRender('key');
  59. vueForceRender('search');
  60. },
  61. changeSubscribtion: function(){
  62. var btnString = $("#btn-text").text();
  63. console.log(btnString);
  64. if(this.isSubscriped){
  65. this.subscripeTagName.replace(/deabonnieren/g, '') + "abonnieren";
  66. //console.log(btnString);
  67. // $("#btn-text").text(newBtnString);
  68. }else{
  69. this.subscripeTagName.replace(/abonnieren/g, '') + "deabonnieren";
  70. //console.log(newBtnString);
  71. // $("#btn-text").text(newBtnString);
  72. }
  73. this.isSubscriped = !this.isSubscriped;
  74. vueForceRender('key');
  75. }
  76. },
  77. mounted: function () {
  78. this.list_messages();
  79. //this.refresh_messages();
  80. }
  81. };
  82. function get_insert_message(id) {
  83. $.ajax({ url: "api/msg/id/"+id, method: "GET" }).done(function (msg) {
  84. Vue.set(_messages, id, msg);
  85. }).fail(function (e, f, g) {
  86. console.log("cannot load " + id + ".json: " + e + f + g);
  87. })
  88. }