hardcode articles
This commit is contained in:
parent
45bce661dc
commit
c7f4cc1562
|
@ -3,57 +3,19 @@ const Helpers = require('../helpers');
|
|||
const db = require('../models');
|
||||
const Sequelize = require('../models');
|
||||
|
||||
async function articles(req, res) {
|
||||
|
||||
const articles = await Sequelize.Article.findAll();
|
||||
|
||||
function articles(req, res) {
|
||||
res.template('articles/articles.pug', {
|
||||
current_route: res.originalUrl,
|
||||
articles
|
||||
current_route: res.originalUrl
|
||||
});
|
||||
}
|
||||
|
||||
async function new_article(req, res) {
|
||||
res.template('admin/data_edit.pug', {
|
||||
current_route: req.originalUrl,
|
||||
data: {
|
||||
'title': {
|
||||
name: 'Title',
|
||||
type: 'text'
|
||||
},
|
||||
'body': {
|
||||
name: 'Contents',
|
||||
type: 'textarea'
|
||||
},
|
||||
'shortText': {
|
||||
name: 'Short description',
|
||||
type: 'textarea'
|
||||
},
|
||||
'gpgsign': {
|
||||
name: 'Body sign',
|
||||
type: 'codearea'
|
||||
},
|
||||
|
||||
},
|
||||
description: 'Write a new article',
|
||||
title: 'New article',
|
||||
endpoint: '/articles/new',
|
||||
pref_method: 'POST'
|
||||
});
|
||||
}
|
||||
|
||||
async function new_article_post(req, res) {
|
||||
|
||||
// let data = await db.Article.
|
||||
|
||||
res.send(req.body);
|
||||
return;
|
||||
function manga(req, res) {
|
||||
res.template('articles/manga.pug', {
|
||||
current_route: res.originalUrl
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = (router) => {
|
||||
router.get('/articles', handler(articles));
|
||||
|
||||
// editor
|
||||
router.get('/articles/new', handler(new_article));
|
||||
router.post('/articles/new', handler(new_article_post));
|
||||
router.get('/articles/manga', handler(manga));
|
||||
}
|
|
@ -6,20 +6,6 @@ block content
|
|||
h2 Articles
|
||||
p.
|
||||
This is a bunch of articles written by me (like a tech blog of some sort)
|
||||
if articles
|
||||
table(style='max-width:600px;min-width:600px;border-collapse:collapse;border:0')
|
||||
each article of articles
|
||||
tr
|
||||
td(style='border:1px solid #c2c4c2;box-shadow:0 2px 2px #c2c4c280;border-radius:8px;padding:4px 24px')
|
||||
h4(style='margin:8px 0;padding:0')
|
||||
span(style='font-family:monospace') [<a style='font-family:monospace' href='/article/#{article.id}'>##{article.id}</a>]
|
||||
= article.title
|
||||
hr
|
||||
p= article.shortText
|
||||
p
|
||||
a(href='/article/' + article.id class='web_link') Open full article
|
||||
tr
|
||||
td
|
||||
div(style='min-height:12px;max-height:12px')
|
||||
else
|
||||
p Error while loading articles: data is not present
|
||||
ul
|
||||
li
|
||||
a(href='/articles/manga') Manga advice
|
Loading…
Reference in New Issue