From c7f4cc156234866dcb3506f3cc2dc3131c935743 Mon Sep 17 00:00:00 2001 From: b1ek Date: Thu, 17 Aug 2023 21:03:26 +1000 Subject: [PATCH] hardcode articles --- routes/articles.js | 52 +++++--------------------------------- view/articles/articles.pug | 20 +++------------ 2 files changed, 10 insertions(+), 62 deletions(-) diff --git a/routes/articles.js b/routes/articles.js index 70d03dd..2cf0250 100644 --- a/routes/articles.js +++ b/routes/articles.js @@ -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)); } \ No newline at end of file diff --git a/view/articles/articles.pug b/view/articles/articles.pug index b95291b..6e2f571 100644 --- a/view/articles/articles.pug +++ b/view/articles/articles.pug @@ -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') [##{article.id}] - = 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 \ No newline at end of file + ul + li + a(href='/articles/manga') Manga advice \ No newline at end of file