Browse Source

merge conflict

master
Senta Mandutz 5 years ago
parent
commit
d003166e33
2 changed files with 161 additions and 367 deletions
  1. 80
    336
      public/index.html
  2. 81
    31
      public/routes/createMessage.js

+ 80
- 336
public/index.html View File

@@ -1,82 +1,75 @@
<!DOCTYPE html>
<html lang="en">

<html lang="de">
<head>
<!-- NOTE: Meta Tags -->
<meta charset="utf-8">
<meta name="description" content="Ohm management app">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OHM News</title>
<!-- NOTE: Meta Tags -->
<meta charset="utf-8">
<meta name="description" content="Ohm management app">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--for demonstration:-->
<!-- <meta http-equiv="refresh" content="10">
<!-- <meta http-equiv="refresh" content="30"> -->

<!-- NOTE: Define Theme Color -->
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#0046a0">

<!-- NOTE: Icon for tab recognition -->
<!-- highest resolution for Chrome & Opera -->
<link rel="icon" sizes="192x192" href="favicon.ico">
<!-- icons for Safari -> iOS Icons -->
<!-- icons for IE & Windows phone -->
<meta name="msapplication-square70x70logo" content="icon_smalltile.png">
<meta name="msapplication-square150x150logo" content="icon_mediumtile.png">
<meta name="msapplication-square310x310logo" content="icon_largetile.png">
<meta name="msapplication-wide310x150logo" content="icon_widetile.png">
<!-- NOTE: iOS - Add to Homescreen -->
<!-- Hide Safari UI Components -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- iOS Status bar: black or black-translucent -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- iOS App Name next to Icon -->
<meta name="apple-mobile-web-app-title" content="OHM News">
<!-- Icon: No transparency allowed -->
<link rel="apple-touch-icon" href="img/launcher/ios_launcher_app_icon_192.png"> <!-- iphone -->
<link rel="apple-touch-icon" sizes="152x152" href="img/launcher/ios_launcher_app_icon_152.png"><!-- ipad -->
<link rel="apple-touch-icon" sizes="180x180" href="img/launcher/ios_launcher_app_icon_180.png"><!-- iphone-retina -->
<link rel="apple-touch-icon" sizes="167x167" href="img/launcher/ios_launcher_app_icon_167.png"><!-- ipad-retina -->
<!-- Splash screen: If not set, will be white screen -->
<link rel="apple-touch-startup-image" sizes="2048x2732" href="ios-splash/apple_splash_2048.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1668x2224" href="ios-splash/apple_splash_1668.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1536x2048" href="ios-splash/apple_splash_1536.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1125x2436" href="ios-splash/apple_splash_1125.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="1242x2208" href="ios-splash/apple_splash_1242.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="750x1334" href="ios-splash/apple_splash_750.png" /><!-- Phone -->
<link rel="apple-touch-startup-image" sizes="640x1136" href="ios-splash/apple_splash_640.png" /><!-- Phone -->

<!-- NOTE: CSS -->
<!-- NOTE: Define Theme Color -->
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="#0046a0">

<!-- NOTE: Icon for tab recognition -->
<!-- highest resolution for Chrome & Opera -->
<link rel="icon" sizes="192x192" href="favicon.ico">
<!-- icons for Safari -> iOS Icons -->
<!-- icons for IE & Windows phone -->
<meta name="msapplication-square70x70logo" content="icon_smalltile.png">
<meta name="msapplication-square150x150logo" content="icon_mediumtile.png">
<meta name="msapplication-square310x310logo" content="icon_largetile.png">
<meta name="msapplication-wide310x150logo" content="icon_widetile.png">
<!-- NOTE: iOS - Add to Homescreen -->
<!-- Hide Safari UI Components -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- iOS Status bar: black or black-translucent -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- iOS App Name next to Icon -->
<meta name="apple-mobile-web-app-title" content="OHM News">
<!-- Icon: No transparency allowed -->
<link rel="apple-touch-icon" href="img/launcher/ios_launcher_app_icon_192.png"> <!-- iphone -->
<link rel="apple-touch-icon" sizes="152x152" href="img/launcher/ios_launcher_app_icon_152.png"><!-- ipad -->
<link rel="apple-touch-icon" sizes="180x180" href="img/launcher/ios_launcher_app_icon_180.png"><!-- iphone-retina -->
<link rel="apple-touch-icon" sizes="167x167" href="img/launcher/ios_launcher_app_icon_167.png"><!-- ipad-retina -->
<!-- Splash screen: If not set, will be white screen -->
<link rel="apple-touch-startup-image" sizes="2048x2732" href="ios-splash/apple_splash_2048.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1668x2224" href="ios-splash/apple_splash_1668.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1536x2048" href="ios-splash/apple_splash_1536.png" /><!-- Tablet -->
<link rel="apple-touch-startup-image" sizes="1125x2436" href="ios-splash/apple_splash_1125.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="1242x2208" href="ios-splash/apple_splash_1242.png" /><!-- Tablet ? Phone -->
<link rel="apple-touch-startup-image" sizes="750x1334" href="ios-splash/apple_splash_750.png" /><!-- Phone -->
<link rel="apple-touch-startup-image" sizes="640x1136" href="ios-splash/apple_splash_640.png" /><!-- Phone -->

<!-- NOTE: CSS -->
<!-- CSS_Material Design for Bootstrap fonts and icons -->
<link rel="stylesheet" href="lib/bootstrap-font-and-icons.css">
<link rel="stylesheet" href="lib/bootstrap-material-design-icons-2.5.94.min.css">
<!-- CSS_Buefy-->
<link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.css">
<!--<link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.min.css">-->
<!-- CSS_Custom Design -->
<link rel="stylesheet" type="text/css" href="style/style.css">

<!-- CSS_Material Design for Bootstrap fonts and icons -->
<link rel="stylesheet" href="lib/bootstrap-font-and-icons.css">
<!-- CSS_Material Design for Bootstrap minified CSS -->
<!--<link rel="stylesheet" href="lib/bootstrap-material-design.min.css">-->
<!-- NOTE: Call manifest.json -->
<link rel="manifest" href="manifest.json">

<!-- NOTE: Call manifest.json -->
<link rel="manifest" href="manifest.json">
<!-- NOTE: Material Icons e.g. seach -->
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.5.94/css/materialdesignicons.min.css">

<!-- NOTE: Load JQuery, Vue.js, VueRouter, Vuetify -->
<script src="lib/jquery-3.3.1.min.js"></script>
<!-- NOTE: Load .js Libraries -->
<script src="lib/vue-2.6.10.js"></script>
<script src="lib/vue-router-3.0.1.js"></script>

<!-- Buefy/Vuetify -->
<script src="lib/buefy-0.7.5.js"></script>
<!-- <script src="lib/buefy-0.7.5.min.js"></script>-->
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.5.94/css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.css">
<!--<link rel="stylesheet" type="text/css" href="lib/buefy-0.7.5.min.css">-->

<!-- <script src="lib/vuetify-1.5.14.js"></script>-->
<!-- <script src="lib/vuetify-1.5.14.min.js"></script>-->
<!-- <link rel="stylesheet" type="text/css" href="lib/vuetify-1.5.14.css">-->
<!-- <link rel="stylesheet" type="text/css" href="lib/vuetify-1.5.14.min.css">-->

<!-- CSS_Custom Design -->
<link rel="stylesheet" type="text/css" href="style/style.css">
<!-- <script src="lib/buefy-0.7.5.min.js"></script>-->
<script src="lib/jquery-3.3.1.min.js"></script>

<!-- NOTE: JavaScript Libs & Files -->
<!-- NOTE: Include .js Routes -->
<script src="routes/auth.js"></script><!-- Must load before profile.js -->
<script src="routes/home.js"></script>
<script src="routes/files.js"></script>
<script src="routes/createMessage.js"></script>
@@ -85,302 +78,53 @@
<script src="routes/msgCard.js"></script>
<script src="routes/messageData.js"></script>
<script src="routes/tagData.js"></script>
<script src="routes/profilCard.js"></script>
<script src="routes/profilData.js"></script>
<script src="routes/login.js"></script>
<script src="routes/majorData.js"></script>
<script src="routes/profilCard.js"></script>
<script src="routes/navRoutes.js"></script>

<title>OHM News</title>
<script src="search.js"></script>
</head>

<body>
<div id="api">
<div class="om-header-container">
<div class="om-header">
<a class="logo-img" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a>
<form class="om-searchbar" @submit.prevent="search()">
<b-field>
<b-autocomplete rounded v-model="searchtext" @keydown.native.enter="search" :data="filteredDataArray" placeholder="suche..." icon="magnify" @select="option => selected = option">
</b-autocomplete>

<!--<b-input
type="search"
v-model="searchtext"
icon="magnify"
placeholder="Suche...">
</b-input>-->
<!--<b-taginput
id="search-text"
type="search"
v-model="selected"
:data=taglist
autocomplete
allow-new:true
icon="magnify"
placeholder="Suche.."
@typing="getFilteredTags"
@input="saveTagsToArray">
</b-taginput>-->
<b-button type="is-light" @click="clear">X</b-button>
</b-field>
</form>
<a class="logo-img is-hidden-desktop" href="index.html"><img src="img/app_icon.png" width=45px height=45px></a>
<a class="logo-img is-hidden-touch" href="index.html"><img src="img/app_icon_desk.png" width=100px height=100px></a>
<search></search>
</div>
</div>

<div class="om-content">
<div id=xxx></div>
<nav-router></nav-router>
<router-view></router-view>
<router-view :key="auth.user"></router-view>
</div>
</div>

<!--<b-tabs type="is-toggle" expanded>
<b-tab-item><router-link to="/home" >
<b-icon
pack="fas"
icon="home"
size="is-small">
</b-icon>
</router-link></b-tab-item>
<b-tab-item icon="magnify"></b-tab-item>
<b-tab-item icon="plus-circle"></b-tab-item>
<b-tab-item icon="bookmark"></b-tab-item>
<b-tab-item icon="account"></b-tab-item>

</b-tabs>-->

<!--
<nav class="navbar is-fixed-bottom is-expanded is-light is-hoverable" role="navigation" aria-label="main navigation">
<div class="navbar-brand is-expanded">
<router-link to="/home" class="navbar-item is-expanded has-text-centered is-active">
<i class="material-icons">home</i>
</router-link>
<router-link to="/files" class="navbar-item is-expanded">
<i class="material-icons">language</i>
</router-link>
<router-link to="/createMessage" class="navbar-item is-expanded">
<i class="material-icons">add_circle</i>
</router-link>
<router-link to="/bookmark" class="navbar-item is-expanded">
<i class="material-icons">bookmark</i>
</router-link>
<router-link to="/profil" class="navbar-item is-expanded">
<i class="material-icons">person</i>
</router-link>
</div>
</nav>

<nav class="nav nav-tabs nav-justified om-nav" v-if="$route.path !=='/createMessage' ">
<router-link to="/home" class="navbar-item has-text-centered"><i class="material-icons">home</i></router-link>
<router-link to="/files" class="navbar-item has-text-centered"><i class="material-icons">language</i></router-link>
<router-link to="/createMessage" class="navbar-item has-text-centered outlined"><i class="material-icons">add_circle</i></router-link>
<router-link to="/bookmark" class="navbar-item has-text-centered"><i class="material-icons">bookmark</i></router-link>
<router-link to="/profil" class="navbar-item has-text-centered"><i class="material-icons">person</i></router-link>
</nav>
</div>
-->
<script>
var isSearchActive = false;
var tagArray = ["lorem"];

</script>

<!-- const routes = [
{ path: "/", component: HomeRouter },
{ path: "/home", component: HomeRouter },
{ path: "/files", component: FileRouter },
{ path: "/createMessage", component: CreateMsgRouter },
{ path: "/bookmark", component: BookmarkRouter },
{ path: "/profil", component: ProfilRouter },
];
const router = new VueRouter({
routes
}); -->

<script>
var app = new Vue({
new Vue({
router,
el: '#api',
data: function() {
return {
searchtext: "",
//isSearchActiv: false,
selected: [],
taglist: data,
};
components: {
// Locally registered components
},
computed: {
filteredDataArray() {
return this.taglist.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(this.searchtext.toLowerCase()) >= 0
})
}
data: {
// Locally registered variables
auth: auth,
},
methods: {

getFilteredTags(text) {
this.taglist = data.filter((option) => {
return option
.toString()
.toLowerCase()
.indexOf(text.toLowerCase()) >= 0
})
this.search();
},
saveTagsToArray: function() {
tagArray = this.selected;
console.info(tagArray);
},
search: function() {

searching(this.searchtext);
},
list_messages: function() {
messages();
},
list_tags: function() {
$.ajax({
url: "api/tag/ids",
method: "GET"
})
.done(jd => {
// NICHT SO wg. Vue: _messagelist = jd;
if(data == ""){
_taglist.splice(0, _taglist.length);
_taglist.push.apply(_taglist, jd);
console.log("tag: jd: " + jd);
for (var e in jd) {
if (!_tags[jd[e]]) {
get_insert_tag(jd[e]);
}
}
}
}).fail(function(e, f, g) {
console.log("err: " + e + f + g);
});
},

clear: function() {
console.log("clear");

isSearchActiv = false;
this.searchtext = "";
this.list_messages();
},

computed:{
// Methods to change data appearance, does cache results
},
mounted: function() {
//this.search();
this.list_tags();
methods: {
// Methods to change data content, run always again
},
});
</script>

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();
},
};
*/

</script>

<!-- CDN_Vue.js minified lib -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script> -->
<!-- CDN_jQuery minified lib -->
<!--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>-->
<!-- Load Popper.js -->
<script src="lib/popper-1.12.6.js"></script>
<!-- Load Bootstrap.js -->
<script src="lib/bootstrap-material-design.js"></script>
<!-- NOTE: Call main.js -->
<script src="main.js"></script>
<!-- NOTE: Call SW registration -->
<script src="registerSW.js"></script>

</body>

</html>

+ 81
- 31
public/routes/createMessage.js View File

@@ -2,42 +2,80 @@ var tagArray = [];
const data=[];
const CreateMsgRouter = {
template: `
<div class="content card om-card">
<h4>Neue Nachricht erstellen</h4>
<div class="content">
<div class="is-hidden-desktop">
<div id="mobile" class="content card om-card">
<h4>Neue Nachricht erstellen</h4>
<b-field>
<b-input placeholder="User" id="user"></b-input>
</b-field>

<b-field>
<b-input placeholder="User" id="user"></b-input>
</b-field>
<b-field>
<b-input placeholder="Betreff" id="subject"></b-input>
</b-field>

<b-field>
<b-input placeholder="Betreff" id="subject"></b-input>
</b-field>
<b-field label="Tags">
<b-taginput
id="tag"
v-model="selected"
:data=taglist
autocomplete
allow-new:false
icon="label"
placeholder="#"
@typing="getFilteredTags"
@input="saveTagsToArray">
</b-taginput>
</b-field>

<b-field label="Tags">
<b-taginput
id="tag"
v-model="selected"
:data=taglist
autocomplete
allow-new:false
icon="label"
placeholder="#"
@typing="getFilteredTags"
@input="saveTagsToArray">
</b-taginput>
</b-field>
<b-field>
<b-input placeholder="Nachricht" id="message" type="textarea"></b-input>
</b-field>

<b-field>
<b-input placeholder="Nachricht" id="message" type="textarea"></b-input>
</b-field>
<b-button @click="$router.go(-1)">ABBRECHEN</b-button>
<b-button type="is-primary" @click="createMsg">SENDEN</b-button>
</div>
</div>

<b-button @click="$router.go(-1)">ABBRECHEN</b-button>
<b-button type="is-primary" @click="createMsg">SENDEN</b-button>
<div class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
<div id="desktop" class="content card om-card">
<h4>Neue Nachricht erstellen</h4>
<b-field>
<b-input placeholder="User" id="user"></b-input>
</b-field>

<b-field>
<b-input placeholder="Betreff" id="subject"></b-input>
</b-field>

<b-field label="Tags">
<b-taginput
id="tag"
v-model="selected"
:data=taglist
autocomplete
allow-new:false
icon="label"
placeholder="#"
@typing="getFilteredTags"
@input="saveTagsToArray">
</b-taginput>
</b-field>

<b-field>
<b-input placeholder="Nachricht" id="message" type="textarea"></b-input>
</b-field>

<b-button @click="$router.go(-1)">ABBRECHEN</b-button>
<b-button type="is-primary" @click="createMsg">SENDEN</b-button>
</div>
</div>
</div>`,

</div>
`,
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) {

Loading…
Cancel
Save