Implement approve/reject of items in admin UI

This commit is contained in:
Marvin Scholz 2017-01-20 02:54:55 +01:00
parent cf135a9af5
commit 623bedfad0
2 changed files with 32 additions and 12 deletions

View file

@ -17,6 +17,24 @@ var app = new Vue({
// `this` inside methods points to the Vue instance // `this` inside methods points to the Vue instance
this.currentItem = itm; this.currentItem = itm;
this.showModal = true; 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;
} }
} }
}) })

View file

@ -20,19 +20,10 @@
<div class="modal-footer"> <div class="modal-footer">
<slot name="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')"> <button class="mdl-button mdl-js-button mdl-button--icon close" @click="$emit('close')">
<i class="material-icons">close</i> <i class="material-icons">close</i>
</button> </button>
</slot> </slot>
</slot>
</div> </div>
</div> </div>
</div> </div>
@ -64,6 +55,17 @@
</video> </video>
<img class="sd-res-media-both" alt="" v-bind:src="currentItem.Path" v-if="!currentItem.IsVideo" /> <img class="sd-res-media-both" alt="" v-bind:src="currentItem.Path" v-if="!currentItem.IsVideo" />
</div> </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> </modal>
</div> </div>
</main> </main>