Fixed entry post issue
This commit is contained in:
parent
b3c27d513d
commit
b4fe18f5b5
@ -27,8 +27,9 @@ class Pengumuman
|
||||
$sql = "SELECT
|
||||
pengumuman.id, pengumuman.category as category,
|
||||
kategori.category as categoryName, kategori.background as background, kategori.foreground as foreground,
|
||||
pengumuman.created_at, pengumuman.valid_at, pengumuman.expired_at, pengumuman.creator, pengumuman.edited_at, pengumuman.content, pengumuman.status, pengumuman.delay
|
||||
FROM pengumuman INNER JOIN kategori ON pengumuman.category = kategori.id";
|
||||
pengumuman.created_at, pengumuman.valid_at, pengumuman.expired_at, pengumuman.creator, pengumuman.edited_at, pengumuman.content, pengumuman.status, pengumuman.delay,
|
||||
users.full_name as creatorName
|
||||
FROM pengumuman INNER JOIN kategori ON pengumuman.category = kategori.id INNER JOIN users ON pengumuman.creator = users.id";
|
||||
|
||||
if ($conditions) {
|
||||
$sql .= " WHERE";
|
||||
@ -71,11 +72,11 @@ class Pengumuman
|
||||
public static function showAll($table, $conditions = [])
|
||||
{
|
||||
$sql = "SELECT
|
||||
pengumuman.id, pengumuman.category as category,
|
||||
kategori.background as background, kategori.foreground as foreground,
|
||||
created_at, valid_at, expired_at, creator, edited_at, content, pengumuman.status, delay,
|
||||
users.full_name as creatorName
|
||||
FROM pengumuman INNER JOIN kategori ON pengumuman.category = kategori.id INNER JOIN users ON pengumuman.creator = users.id";
|
||||
pengumuman.id, pengumuman.category as category,
|
||||
kategori.category as categoryName, kategori.background as background, kategori.foreground as foreground,
|
||||
pengumuman.created_at, pengumuman.valid_at, pengumuman.expired_at, pengumuman.creator, pengumuman.edited_at, pengumuman.content, pengumuman.status, pengumuman.delay,
|
||||
users.full_name as creatorName
|
||||
FROM pengumuman INNER JOIN kategori ON pengumuman.category = kategori.id INNER JOIN users ON pengumuman.creator = users.id";
|
||||
|
||||
if ($conditions) {
|
||||
$sql .= " WHERE";
|
||||
|
@ -8,6 +8,8 @@ let post = require('../models/post')
|
||||
var createPost = {
|
||||
oninit: function() {
|
||||
category.loadList()
|
||||
clearInterval(window.intv)
|
||||
post.current = {}
|
||||
},
|
||||
oncreate: function() {
|
||||
var valid_at = rome(left, {
|
||||
|
@ -3,6 +3,7 @@ let post = require('../models/post')
|
||||
let marked = require('../vendor/marked')
|
||||
let fecha = require('fecha')
|
||||
let Loading = require('./Loading')
|
||||
let cookie = require('../others/cookie')
|
||||
|
||||
var listAdmin = {
|
||||
view: function() {
|
||||
@ -13,12 +14,14 @@ var listAdmin = {
|
||||
return m('.fourth-900.half-600.card.box', {style:'background-color:' + pengumuman.background}, [
|
||||
m('span.stack', {
|
||||
style:'font-size: smaller; color:rgba(17,17,17,.4);',
|
||||
'data-tooltip': 'Active: '
|
||||
+ fecha.format(new Date(pengumuman.valid_at), 'DD/MM/YYYY')
|
||||
'data-tooltip':
|
||||
pengumuman.categoryName
|
||||
+ "\nAktif: "
|
||||
+ fecha.format(fecha.parse(pengumuman.valid_at, 'YYYY-MM-DD H:i:s'), 'DD/MM/YYYY')
|
||||
+ ' - '
|
||||
+ fecha.format(new Date(pengumuman.expired_at), 'DD/MM/YYYY')
|
||||
+ fecha.format(fecha.parse(pengumuman.expired_at, 'YYYY-MM-DD H:i:s'), 'DD/MM/YYYY')
|
||||
+ "\n"
|
||||
+ 'Edited: '
|
||||
+ 'Diubah: '
|
||||
+ fecha.format(fecha.parse(pengumuman.edited_at, 'YYYY-MM-DD H:i:s'), 'DD/MM/YYYY')
|
||||
}, [
|
||||
m('em', [
|
||||
@ -28,7 +31,7 @@ var listAdmin = {
|
||||
])
|
||||
]),
|
||||
m('span.stack', {style:'color:' + pengumuman.foreground + '; overflow-y: auto;'}, m.trust(marked(pengumuman.content))),
|
||||
m('span', m('footer.flex.full.grow', (pengumuman.status != 0 && pengumuman.creator == window.location.search.split('&')[1].slice('2')) ? [
|
||||
m('span', m('footer.flex.full.grow', (pengumuman.status != 0) ? pengumuman.creator == window.location.search.split('&')[1].slice('2') || cookie.get('signal') == 1 ? [
|
||||
m('.half-900', m('a.button.full', {href: '/posts/edit/' + pengumuman.id, oncreate: m.route.link}, [
|
||||
m('i.fa.fa-edit.fa-fw', ''),
|
||||
m('span', {style: 'font-size:smaller'}, 'Ubah')
|
||||
@ -42,7 +45,7 @@ var listAdmin = {
|
||||
}),
|
||||
m('span', {style: 'font-size:smaller'}, pengumuman.status == 1 ? 'Matikan' : 'Aktifkan')
|
||||
]))
|
||||
] : m('.half-900', m('span.button.pseudo.full', {style: 'color:rgba(17,17,17,.3);'}, 'Nonaktif'))))
|
||||
] : null : m('.half-900', m('span.button.pseudo.full', {style: 'color:rgba(17,17,17,.3);'}, 'Nonaktif'))))
|
||||
])
|
||||
})
|
||||
])
|
||||
|
@ -1,5 +1,6 @@
|
||||
let m = require('mithril')
|
||||
let user = require('../models/user')
|
||||
let cookie = require('../others/cookie')
|
||||
|
||||
var nav = {
|
||||
view: function() {
|
||||
@ -26,7 +27,7 @@ var nav = {
|
||||
}),
|
||||
' Kategori'
|
||||
]),
|
||||
m('a.navy.button', {
|
||||
cookie.get('signal') == 1 ? m('a.navy.button', {
|
||||
href: '/register',
|
||||
'data-tooltip': 'User Baru',
|
||||
oncreate: m.route.link
|
||||
@ -35,7 +36,7 @@ var nav = {
|
||||
'aria-hidden': 'true'
|
||||
}),
|
||||
' User'
|
||||
]),
|
||||
]) : null,
|
||||
m('a.navy.button', {
|
||||
'data-tooltip': 'Keluar',
|
||||
onclick: function() {user.logout()}
|
||||
|
@ -8,7 +8,7 @@ var showPost = {
|
||||
oninit: function(vnode) {
|
||||
post.curStatus = vnode.attrs.status
|
||||
post.loadList()
|
||||
setInterval(function() {
|
||||
window.intv = setInterval(function() {
|
||||
post.loadList()
|
||||
}, showPost.interval)
|
||||
},
|
||||
|
@ -15,7 +15,6 @@ require('../css/index.css')
|
||||
|
||||
var root = document.body
|
||||
var page = cookie.get('signal')
|
||||
console.log(page);
|
||||
|
||||
if (page == '') {
|
||||
m.mount(root, header)
|
||||
@ -47,7 +46,7 @@ if (page == '') {
|
||||
},
|
||||
'/register': { view: function() { return m('span'), [
|
||||
m(nav),
|
||||
m(registerUser)
|
||||
cookie.get('signal') == 1 ? m(registerUser) : null
|
||||
] }},
|
||||
'/posts': { view: function() { return m('span', [
|
||||
m(nav),
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user