Disable modal animation
This commit is contained in:
parent
8e600051b8
commit
d982446429
|
@ -6,15 +6,17 @@ Vue.component('modal', {
|
|||
|
||||
var app = new Vue({
|
||||
delimiters: ['[[', ']]'],
|
||||
el: '#app, #image-modal',
|
||||
el: '#app',
|
||||
data: {
|
||||
mode: state,
|
||||
items: data,
|
||||
currentItem: false,
|
||||
showModal: false
|
||||
showModal: false,
|
||||
inboxCount: false
|
||||
},
|
||||
created: function () {
|
||||
window.addEventListener('keyup', this.handleKeyup);
|
||||
this.loadStats();
|
||||
},
|
||||
methods: {
|
||||
detailPopup: function (itm, event) {
|
||||
|
@ -68,6 +70,19 @@ var app = new Vue({
|
|||
this.showModal = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
loadStats: function () {
|
||||
var req = new XMLHttpRequest();
|
||||
req.addEventListener("load", function () {
|
||||
stats = JSON.parse(req.responseText);
|
||||
if (stats) {
|
||||
app.inboxCount = stats.Count.Items.Inbox;
|
||||
} else {
|
||||
console.warn("Loading stats failed!");
|
||||
}
|
||||
});
|
||||
req.open("GET", "/admin/stats");
|
||||
req.send();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -79,6 +94,11 @@ exampleSocket.onopen = function (event) {
|
|||
};
|
||||
exampleSocket.onmessage = function (event) {
|
||||
item = JSON.parse(event.data);
|
||||
if (item.State === 0) {
|
||||
app.inboxCount++;
|
||||
} else {
|
||||
app.loadStats();
|
||||
}
|
||||
if (item.State === state) {
|
||||
app.items.push(item);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<!-- template for the modal component -->
|
||||
<script type="text/x-template" id="modal-template">
|
||||
<transition name="modal">
|
||||
<!--<transition name="modal">-->
|
||||
<div class="modal-mask">
|
||||
<div class="modal-wrapper">
|
||||
<div class="modal-container">
|
||||
|
@ -28,13 +28,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
<!--</transition>-->
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<div class="mdl-layout mdl-js-layout mdl-layout--no-desktop-drawer-button mdl-layout--fixed-header">
|
||||
<div class="mdl-layout mdl-js-layout mdl-layout--no-desktop-drawer-button mdl-layout--fixed-header" id="app">
|
||||
{{ template "menu.html" . }}
|
||||
<main class="mdl-layout__content" id="app" v-cloak="v-cloak">
|
||||
<main class="mdl-layout__content" 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)">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<div class="mdl-layout-spacer"></div>
|
||||
<!-- Navigation -->
|
||||
<nav class="mdl-navigation mdl-layout--large-screen-only">
|
||||
<a class="mdl-navigation__link is-active" href="/admin/inbox">Inbox</a>
|
||||
<a class="mdl-navigation__link is-active" href="/admin/inbox"><span class="mdl-badge" :data-badge="(inboxCount) ? inboxCount : false">Inbox</span></a>
|
||||
<a class="mdl-navigation__link" href="/admin/approved">Approved</a>
|
||||
<a class="mdl-navigation__link" href="/admin/rejected">Rejected</a>
|
||||
</nav>
|
||||
|
|
|
@ -61,12 +61,10 @@ func rejectSnap(c *gin.Context) {
|
|||
|
||||
func stats(c *gin.Context) {
|
||||
var ST Stats
|
||||
database.Db.Begin()
|
||||
database.Db.Model(database.Item{}).Where("state = ?", database.Inbox).Count(&ST.Count.Items.Inbox)
|
||||
database.Db.Model(database.Item{}).Where("state = ?", database.Approved).Count(&ST.Count.Items.Approved)
|
||||
database.Db.Model(database.Item{}).Where("state = ?", database.Rejected).Count(&ST.Count.Items.Rejected)
|
||||
database.Db.Model(database.User{}).Where("blocked = ?", false).Count(&ST.Count.Users.Unblocked)
|
||||
database.Db.Model(database.User{}).Where("blocked = ?", true).Count(&ST.Count.Users.Blocked)
|
||||
database.Db.Commit()
|
||||
c.JSON(200, ST)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue