SocialDragon/socialdragon/assets/js/app.js
2017-01-20 02:54:55 +01:00

41 lines
1.1 KiB
JavaScript

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