Modified controllers to be more effective
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
let m = require('mithril')
|
||||
let post = require('../models/post')
|
||||
let listAdmin = require('./listAdmin')
|
||||
|
||||
var allpost = {
|
||||
oninit: function() {
|
||||
post.curStatus = 3
|
||||
post.loadList()
|
||||
setInterval(function() {
|
||||
post.loadList()
|
||||
}, post.interval)
|
||||
},
|
||||
view: function() {
|
||||
return m(listAdmin)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = allpost
|
||||
@@ -1,18 +0,0 @@
|
||||
let m = require('mithril')
|
||||
let post = require('../models/post')
|
||||
let listAdmin = require('./listAdmin')
|
||||
|
||||
var inactivepost = {
|
||||
oninit: function() {
|
||||
post.curStatus = 0
|
||||
post.loadList()
|
||||
setInterval(function() {
|
||||
post.loadList()
|
||||
}, post.interval)
|
||||
},
|
||||
view: function() {
|
||||
return m(listAdmin)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = inactivepost
|
||||
@@ -2,9 +2,9 @@ let m = require('mithril')
|
||||
let post = require('../models/post')
|
||||
let listAdmin = require('./listAdmin')
|
||||
|
||||
var activepost = {
|
||||
oninit: function() {
|
||||
post.curStatus = 1
|
||||
var showPost = {
|
||||
oninit: function(vnode) {
|
||||
post.curStatus = vnode.attrs.status
|
||||
post.loadList()
|
||||
setInterval(function() {
|
||||
post.loadList()
|
||||
@@ -15,4 +15,4 @@ var activepost = {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = activepost
|
||||
module.exports = showPost
|
||||
@@ -1,18 +0,0 @@
|
||||
let m = require('mithril')
|
||||
let post = require('../models/post')
|
||||
let listAdmin = require('./listAdmin')
|
||||
|
||||
var soonpost = {
|
||||
oninit: function() {
|
||||
post.curStatus = 2
|
||||
post.loadList()
|
||||
setInterval(function() {
|
||||
post.loadList()
|
||||
}, post.interval)
|
||||
},
|
||||
view: function() {
|
||||
return m(listAdmin)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = soonpost
|
||||
@@ -1,19 +1,15 @@
|
||||
let m = require('mithril')
|
||||
|
||||
let allPost = require('./components/allPost')
|
||||
let activePost = require('./components/activePost')
|
||||
let soonPost = require('./components/soonPost')
|
||||
let inactivePost = require('./components/inactivePost')
|
||||
let secondaryNav = require('./components/secondaryNav')
|
||||
let showPost = require('./components/showPost')
|
||||
|
||||
var root = document.getElementById('mit')
|
||||
|
||||
m.mount(document.getElementById('navigasi'), secondaryNav)
|
||||
|
||||
m.route(root, '', {
|
||||
'': allPost,
|
||||
'/': allPost,
|
||||
'/active': activePost,
|
||||
'/soon': soonPost,
|
||||
'/inactive': inactivePost,
|
||||
'': { view: function() { return m(showPost, { 'status': 3 }) } },
|
||||
'/': { view: function() { return m(showPost, { 'status': 3 }) } },
|
||||
'/active': { view: function() { return m(showPost, { 'status': 1 }) } },
|
||||
'/soon': { view: function() { return m(showPost, { 'status': 2 }) } },
|
||||
'/inactive': { view: function() { return m(showPost, { 'status': 0 }) } },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user