diff --git a/public/index.html b/public/index.html
index d737f5b..f47097a 100644
--- a/public/index.html
+++ b/public/index.html
@@ -69,6 +69,7 @@
+
@@ -76,8 +77,6 @@
-
-
diff --git a/public/routes/auth.js b/public/routes/auth.js
index 351da04..96be5fc 100644
--- a/public/routes/auth.js
+++ b/public/routes/auth.js
@@ -1,5 +1,3 @@
-var auth = {};
-
function clearAuthState() {
auth.user = ''; // Login name
auth.name = ''; // Full name
diff --git a/public/routes/createMessage.js b/public/routes/createMessage.js
index e7c9779..8fd69f1 100644
--- a/public/routes/createMessage.js
+++ b/public/routes/createMessage.js
@@ -1,4 +1,3 @@
-var tagArray = [];
const CreateMsgRouter = {
template: `
@@ -73,7 +72,6 @@ const CreateMsgRouter = {
data: function () {
return {
- auth: auth,
isDisabled: false,
selected: [],
searchtext : "",
@@ -92,14 +90,14 @@ const CreateMsgRouter = {
},
methods: {
saveTagsToArray: function() {
- tagArray = this.selected;
+ tagArray = this.selected;
console.info(tagArray);
},
createMsg: function () {
var _subject = $("#subject").val();
var _message = $("#message").val();
var _tag = tagArray;
- var _user = auth.name ? auth.name : $("#user").val();
+ var _user = auth.name != '' ? auth.name : $("#user").val();
//console.log("Message Created: " + _tag + " " + _message + " " + _user);
$.ajax({
url: "api/msg",
diff --git a/public/routes/files.js b/public/routes/files.js
index 450db47..805dbd3 100644
--- a/public/routes/files.js
+++ b/public/routes/files.js
@@ -1,5 +1,3 @@
-var tagArray = [];
-
const FileRouter = {
template: `
diff --git a/public/routes/home.js b/public/routes/home.js
index 63518a4..dd838ce 100644
--- a/public/routes/home.js
+++ b/public/routes/home.js
@@ -24,47 +24,9 @@ const HomeRouter = {
};
},
methods: {
- /*refresh_messages: function () {
- _messages.push({ //////// alt
- id: 42,
- subject: "xxx",
- message: "warum habt ihr auch so viel",
- user: "nobody",
- tags: "foo"
- });
- },*/
list_messages: function() {
messages();
}
- /*list_messages: function () {
- $.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]);
- }
- }
- if(!($".om-searchbar" = "")){
- for (var e in jd) {
- if (!_messages[jd[e]]) {
- get_insert_message(jd[e]);
- }
- }
- }else{
- for (var e in jd) {
- if (!_messages[jd[e]]) {
- get_search_message(jd[e]);
- }
- }
- }
- }).fail(function (e, f, g) {
- console.log("list_msg: err: " + e + f + g);
- });
- }*/
},
mounted: function () {
@@ -80,28 +42,3 @@ function get_insert_message(id) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
}
-
-/*function get_search_message(phrase) {
- $.ajax({ url: "api/msg/search/"+phrase, method: "GET" }).done(function (msg) {
- Vue.set(_messages, id, msg);
- }).fail(function (e, f, g) {
- console.log("cannot load " + id + ".json: " + e + f + g);
- })
-}
-$(document).ready(function () {
- console.log("egal");
- $.get('list.json').done(function (jd) {
- // _messagelist = jd;
- _messagelist.splice(0, _messagelist.length);
- _messagelist.push.apply(_messagelist, jd);
- console.log("egal2");
- //$('#xxx').text(jd[0]);
- for (var e in jd) {
- if (!_messages[jd[e]]) {
- get_insert_message(jd[e]);
- }
- }
- }).fail(function (e, f, g) {
- console.log("egal3: " + e + f + g);
- });
-});*/
diff --git a/public/routes/initGlobals.js b/public/routes/initGlobals.js
new file mode 100644
index 0000000..281f773
--- /dev/null
+++ b/public/routes/initGlobals.js
@@ -0,0 +1,18 @@
+// Global Variables
+// User
+var auth = {},
+ majorList = [],
+
+ // Message
+ _messagelist = [],
+ _messages = {},
+
+ // Tag
+ _taglist = [],
+ _tags = [],
+ tagArray = [],
+
+ // Search
+ isSearchActive = false,
+ data = [],
+ search_data = [];
diff --git a/public/routes/majorData.js b/public/routes/majorData.js
index 37aa3b5..f9779ba 100644
--- a/public/routes/majorData.js
+++ b/public/routes/majorData.js
@@ -1,4 +1,4 @@
-var majorList = [
+majorList = [
{id:'B-AC',name:'Bachelor Angewandte Chemie'},
{id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'},
{id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'},
diff --git a/public/routes/messageData.js b/public/routes/messageData.js
deleted file mode 100644
index 64431ba..0000000
--- a/public/routes/messageData.js
+++ /dev/null
@@ -1,2 +0,0 @@
-_messagelist = [];
-_messages = {};
diff --git a/public/routes/tagData.js b/public/routes/tagData.js
deleted file mode 100644
index 3ef34ad..0000000
--- a/public/routes/tagData.js
+++ /dev/null
@@ -1,2 +0,0 @@
-_taglist = [];
-_tags = [];
diff --git a/public/search.js b/public/search.js
index 9aba881..1a327c0 100644
--- a/public/search.js
+++ b/public/search.js
@@ -1,9 +1,3 @@
-var isSearchActive = false,
- tagArray = ["lorem"];
-
-const data=[],
- search_data = [];
-
Vue.component('search',{
template: `