From d003166e33b104d546bb0d03b8a54c19afe8fff3 Mon Sep 17 00:00:00 2001 From: senta_mandutz Date: Sun, 21 Jul 2019 14:22:37 +0200 Subject: [PATCH] merge conflict --- public/index.html | 414 +++++++-------------------------- public/routes/createMessage.js | 112 ++++++--- 2 files changed, 160 insertions(+), 366 deletions(-) diff --git a/public/index.html b/public/index.html index 280c350..d737f5b 100644 --- a/public/index.html +++ b/public/index.html @@ -1,82 +1,75 @@ - - + - - - - - - + OHM News + + + + + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - - - - + + - - + + - - + - - - - - - + + - - - - - - - - - + + @@ -85,302 +78,53 @@ - - - + + - - OHM News + -
- - + + +
- +
- - - - - - - - function get_insert_tag(id) { - $.ajax({ - url: "api/tag/" + id, - method: "GET" - }).done(function(tag) { - data.push("#" + tag.name); - console.log("it worked!"); - }).fail(function(e, f, g) { - console.log("cannot load " + id + ".json: " + e + f + g); - }) - } - function searching(searchtext) { - isSearchActiv = true; - console.log("Searchtext: " + searchtext.replace(/#/g, '')); - $.ajax({ - url: "api/msg/search/" + searchtext.replace(/#/g, ''), - method: "GET" - }).done(jd => { - // NICHT SO wg. Vue: _messagelist = jd; - router.push('/home'); - _messagelist.splice(0, _messagelist.length); - _messagelist.push.apply(_messagelist, jd); - //console.log("jd: "+jd); - for (var e in jd) { - if (!_messages[jd[e]]) { - get_insert_message(jd[e]); - } - } - }).fail(function(e, f, g) { - console.log("searching: err: " + e + f + g); - }) - } - function messages() { - $.ajax({ - url: "api/msg/ids", - method: "GET" - }) - .done(jd => { - // NICHT SO wg. Vue: _messagelist = jd; - _messagelist.splice(0, _messagelist.length); - _messagelist.push.apply(_messagelist, jd); - //console.log("jd: "+jd); - for (var e in jd) { - if (!_messages[jd[e]]) { - get_insert_message(jd[e]); - } - } - }).fail(function(e, f, g) { - console.log("list_msg: err: " + e + f + g); - }); - } - - const search_data = []; - /* - export.default { - data: function () { - return { - selected: [], - taglist: data, - }; - }, - computed: { - filteredTagArray() { - this.taglist = data.filter((option) => { - return option - .toString() - .toLowerCase() - .indexOf(this.name.toLowerCase()) >= 0 - }) - }, - - }, - methods: { - evaluate(text) { - this.taglist = data.filter((option) => { - return option - .toString() - .toLowerCase() - .indexOf(text.toLowerCase()) >= 0 - }) - }, - }, - mounted: function () { - if ($(this).bootstrapMaterialDesign) - $(this).bootstrapMaterialDesign(); - }, - }; - */ - - - - - - - - - - - - - + + - diff --git a/public/routes/createMessage.js b/public/routes/createMessage.js index e0739d0..6a0c8da 100644 --- a/public/routes/createMessage.js +++ b/public/routes/createMessage.js @@ -2,42 +2,80 @@ var tagArray = []; const data=[]; const CreateMsgRouter = { template: ` -
-

Neue Nachricht erstellen

+
+
+
+

Neue Nachricht erstellen

+ + + - - - + + + - - - + + + + - - - - + + + - - - + ABBRECHEN + SENDEN +
+
- ABBRECHEN - SENDEN +
+
+

Neue Nachricht erstellen

+ + + + + + + + + + + + + + + + + + ABBRECHEN + SENDEN +
+
+
`, -
-`, data: function () { return { + auth: auth, + isDisabled: false, selected: [], taglist: data, }; @@ -51,7 +89,7 @@ const CreateMsgRouter = { var _subject = $("#subject").val(); var _message = $("#message").val(); var _tag = tagArray; - var _user = $("#user").val(); + var _user = auth.name ? auth.name : $("#user").val(); //console.log("Message Created: " + _tag + " " + _message + " " + _user); $.ajax({ url: "api/msg", @@ -103,14 +141,26 @@ const CreateMsgRouter = { } }, mounted: function () { - //this.list_tags(); + var userField = $('#user'); + if (auth != null && auth.mail != '') { +// userField.prop('placeholder',auth.name); + var authorName = auth.name.split(' '); + authorName = authorName[1] + ', ' + authorName[0]; + userField.val(authorName); + userField.prop('disabled',true); + } else { + userField.prop('placeholder','User'); + userField.prop('disabled',false); + } + + this.list_tags(); if ($(this).bootstrapMaterialDesign) $(this).bootstrapMaterialDesign(); }, }; function get_insert_tag(id){ - $.ajax({ url: "api/tag/"+id, method: "GET" }).done(function (tag) { + $.ajax({ url: "api/tag/id/"+id, method: "GET" }).done(function (tag) { data.push("#" + tag.name); console.log("Array:"+this.data); }).fail(function (e, f, g) {