Merge branch 'master' of git.1750studios.com:AniNite/SocialDragon

This commit is contained in:
Andreas Mieke 2017-01-20 03:09:12 +01:00
commit 0269f6eb1c
4 changed files with 46 additions and 15 deletions

View file

@ -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);
}
}
}
})

View file

@ -20,19 +20,10 @@
<div class="modal-footer">
<slot name="footer">
<slot name="actions">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored modal-default-button">
<i class="material-icons">check</i> Approve
</button>
<button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent">
<i class="material-icons">cancel</i> Reject
</button>
<button class="mdl-button mdl-js-button mdl-button--icon close" @click="$emit('close')">
<i class="material-icons">close</i>
</button>
</slot>
<button class="mdl-button mdl-js-button mdl-button--icon close" @click="$emit('close')">
<i class="material-icons">close</i>
</button>
</slot>
</div>
</div>
</div>
@ -43,7 +34,7 @@
<body>
<div class="mdl-layout mdl-js-layout mdl-layout--no-desktop-drawer-button mdl-layout--fixed-header">
{{ template "menu.html" . }}
<main class="mdl-layout__content" id="app">
<main class="mdl-layout__content" id="app" v-cloak="v-cloak">
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--3-col" v-for="item in items">
<a v-on:click="detailPopup(item)">
@ -64,6 +55,17 @@
</video>
<img class="sd-res-media-both" alt="" v-bind:src="currentItem.Path" v-if="!currentItem.IsVideo" />
</div>
<div slot="footer">
<button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored modal-default-button" @click="approveItem(currentItem.ID)">
<i class="material-icons">check</i> Approve
</button>
<button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent" @click="rejectItem(currentItem.ID)">
<i class="material-icons">cancel</i> Reject
</button>
<button class="mdl-button mdl-js-button mdl-button--icon close" @click="showModal = false">
<i class="material-icons">close</i>
</button>
</div>
</modal>
</div>
</main>

View file

@ -1,6 +1,5 @@
</main>
</div>
<script src="/static/js/vendor/vue.min.js"></script>
<script src="/static/js/app.js"></script>
<script src="/static/js/app.js"></script>
</body>
</html>

View file

@ -10,7 +10,11 @@
<link rel="stylesheet" href="/static/css/vendor/material.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="/static/css/app.css">
<style media="screen">
[v-cloak] { display: none; }
</style>
<!-- Scripts -->
<script src="/static/js/vendor/material.min.js"></script>
<script src="/static/js/vendor/vue.min.js"></script>
</head>