Merge remote-tracking branch 'origin/developer' into developer

This commit is contained in:
2019-02-03 01:00:49 +01:00
565 changed files with 154393 additions and 25 deletions
+4
View File
@@ -32,4 +32,8 @@ const CreateMsgRouter = {
},
methods: {
},
mounted: function() {
if ($(this).bootstrapMaterialDesign)
$(this).bootstrapMaterialDesign();
},
};
+27 -9
View File
@@ -14,7 +14,7 @@ const HomeRouter = {
};
},
methods: {
refresh_messages: function () {
/*refresh_messages: function () {
_messages.push({ //////// alt
id: 42,
subject: "xxx",
@@ -22,23 +22,41 @@ const HomeRouter = {
user: "nobody",
tags: "foo"
});
},
},*/
list_messages: function () {
console.log("egal");
$.get('api/ids/').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);
});
}
},
/*mounted: function() {
this.refresh_messages();
}*/
mounted: function() {
this.list_messages();
/*this.refresh_messages();*/
}
};
function get_insert_message(id) {
$.get(id + ".json").done(function (msg) {
function get_insert_message(msg_id) {
$.get(api/msg/{msg_id}).done(function (msg) {
// _messages[id] = msg;
Vue.set(_messages, id, msg);
}).fail(function (e, f, g) {
console.log("cannot load " + id + ".json: " + e + f + g);
})
}
$(document).ready(function () {
/*$(document).ready(function () {
console.log("egal");
$.get('list.json').done(function (jd) {
// _messagelist = jd;
@@ -54,4 +72,4 @@ $(document).ready(function () {
}).fail(function (e, f, g) {
console.log("egal3: " + e + f + g);
});
});
});*/
+39 -1
View File
@@ -79,7 +79,29 @@
<router-link to="/bookmark" class="nav-item nav-link"><i class="material-icons">bookmark</i></router-link>
<router-link to="/profil" class="nav-item nav-link"><i class="material-icons">person</i></router-link>
</nav>
<!--test to put information into db by ajax-->
<div class="container">
<div class="col-sm-4">
<h3>Ajax Test</h3>
<div>
<form id="messageForm">
<div class="form-group">
<label for="id">Id:</label>
<input type="text" class="form-control" id="id" placeholder="Enter Id"/>
</div>
<div class="form-group">
<label for="message">Message:</label>
<input type="text" class="form-control" id="message" placeholder="Enter Message"/>
</div>
<div id="res">
</div>
<button type="submit" class="btn btn-default" @click.prevent=testform>Submit</button>
</form>
</div>
</div>
</div>
</div>
<script>
@@ -96,7 +118,23 @@
});
var app = new Vue({
router,
el: '#api'
el: '#api',
methods: {
testform: function() {
var id=$("#id").val();
var message=$("#message").val();
console.log ("test "+id+" "+message);
$.ajax ({ url: "/api/test/"+id, data: {msg: message}, method: "GET" }) .done (have_result) .fail (have_error);
function have_result (res) {
console.log (res);
$("#res").text (res[0].message);
}
function have_error (err) {
console.log ("error:");
console.log (err);
}
},
},
});
</script>