2017-01-20 00:21:44 +00:00
|
|
|
//$(document).foundation()
|
|
|
|
|
|
|
|
Vue.component('modal', {
|
|
|
|
template: '#modal-template'
|
|
|
|
})
|
|
|
|
|
|
|
|
var app = new Vue({
|
|
|
|
delimiters: ['[[', ']]'],
|
|
|
|
el: '#app, #image-modal',
|
|
|
|
data: {
|
|
|
|
items: data,
|
|
|
|
currentItem: false,
|
|
|
|
showModal: false
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
detailPopup: function (itm, event) {
|
|
|
|
// `this` inside methods points to the Vue instance
|
|
|
|
this.currentItem = itm;
|
|
|
|
this.showModal = true;
|
2017-01-20 01:54:55 +00:00
|
|
|
},
|
|
|
|
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;
|
2017-01-20 02:07:28 +00:00
|
|
|
var index = this.items.indexOf(this.currentItem);
|
|
|
|
if (index > -1) {
|
|
|
|
this.items.splice(index, 1);
|
|
|
|
}
|
2017-01-20 01:54:55 +00:00
|
|
|
},
|
|
|
|
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;
|
2017-01-20 02:07:28 +00:00
|
|
|
var index = this.items.indexOf(this.currentItem);
|
|
|
|
if (index > -1) {
|
|
|
|
this.items.splice(index, 1);
|
|
|
|
}
|
2017-01-20 00:21:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|