diff --git a/socialdragon/assets/js/app.js b/socialdragon/assets/js/app.js index 5494ba5..f5240c7 100644 --- a/socialdragon/assets/js/app.js +++ b/socialdragon/assets/js/app.js @@ -17,6 +17,32 @@ var app = new Vue({ // `this` inside methods points to the Vue instance this.currentItem = itm; this.showModal = true; + }, + approveItem: function (id) { + var req = new XMLHttpRequest(); + req.addEventListener("load", function () { + console.log("Approved ID " + id); + }); + req.open("POST", "/admin/approve/" + id); + req.send(); + this.showModal = false; + var index = this.items.indexOf(this.currentItem); + if (index > -1) { + this.items.splice(index, 1); + } + }, + rejectItem: function (id) { + var req = new XMLHttpRequest(); + req.addEventListener("load", function () { + console.log("Rejected ID " + id); + }); + req.open("POST", "/admin/reject/" + id); + req.send(); + this.showModal = false; + var index = this.items.indexOf(this.currentItem); + if (index > -1) { + this.items.splice(index, 1); + } } } }) diff --git a/socialdragon/templates/admin.html b/socialdragon/templates/admin.html index 62433ea..25f9ddd 100644 --- a/socialdragon/templates/admin.html +++ b/socialdragon/templates/admin.html @@ -20,19 +20,10 @@ @@ -43,7 +34,7 @@
{{ template "menu.html" . }} -
+
diff --git a/socialdragon/templates/footer.html b/socialdragon/templates/footer.html index 9775deb..95a9b92 100644 --- a/socialdragon/templates/footer.html +++ b/socialdragon/templates/footer.html @@ -1,6 +1,5 @@
- - + diff --git a/socialdragon/templates/header.html b/socialdragon/templates/header.html index ce07ac0..edf87bd 100644 --- a/socialdragon/templates/header.html +++ b/socialdragon/templates/header.html @@ -10,7 +10,11 @@ + +