diff --git a/models/boards.js b/models/boards.js index 83bec24c..240068e8 100644 --- a/models/boards.js +++ b/models/boards.js @@ -11,6 +11,10 @@ module.exports = { return db.collection('boards').findOne({ '_id': name }); }, + find: async (name) => { + return db.collection('boards').find({}).toArray(); + }, + insertOne: async (data) => { return db.collection('boards').insertOne(data); }, diff --git a/server.js b/server.js index 1c1cee0d..be8810e1 100644 --- a/server.js +++ b/server.js @@ -48,7 +48,7 @@ const express = require('express') // use pug view engine app.set('view engine', 'pug'); app.set('views', path.join(__dirname, 'views/pages')); - app.enable('view cache'); +// app.enable('view cache'); // static files app.use('/css', express.static(__dirname + '/static/css')); diff --git a/static/css/style.css b/static/css/style.css index 758f21ac..376b9453 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1,4 +1,7 @@ body { + font-family: arial, helvetica, sans-serif; + font-size: 10pt; + background: #EEF2FF; flex: 1; display: flex; flex-direction: column; @@ -7,26 +10,52 @@ body { } .container { - clear: both; - margin: 0 auto; + margin: 5px; } -.navbar { +.board-title { + color: #AF0A0F; + font-size: 20pt; + font-weight: bold; + font-family: tahoma; + letter-spacing: -2px; +} +.post-container { + margin-left: 15px; + padding: 5px; + background: #D6DAF0; } -.nav-item { - float: left; - margin: 10px; + +.post-container.op { + background: none; + margin-left: 0; +} + +.navbar { + border-bottom: 1px solid black; + margin: 0; + padding: 5px; } -.section {} -.card {} -.card-title {} -.card-content {} +.nav-item { + list-style: none; + display: inline; + padding-left: 20px; + line-height: 50px; +} .footer { - padding: 10px; text-align: center; flex-shrink: 0; margin-top: auto; } + +table, th, td { + border: 1px solid black; + border-collapse: collapse; +} + +th, td { + padding: 5px; +} diff --git a/views/includes/navbar.pug b/views/includes/navbar.pug index 6daed4a6..5e70db14 100644 --- a/views/includes/navbar.pug +++ b/views/includes/navbar.pug @@ -1,3 +1,3 @@ -div - ul.navbar - li.nav-item: a(href='/') Home +ul.navbar + li.nav-item: a(href='/') Home + li.nav-item: a(href='/login') Mod Login diff --git a/views/layout.pug b/views/layout.pug index 80acfa0c..f20d2f28 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -5,8 +5,7 @@ html block head body nav - .container - include includes/navbar.pug + include includes/navbar.pug main .container block content diff --git a/views/mixins/post.pug b/views/mixins/post.pug index a16904bb..2933823f 100644 --- a/views/mixins/post.pug +++ b/views/mixins/post.pug @@ -1,10 +1,10 @@ mixin post(board, post) - .post-container + div(class='post-container '+(post.thread ? '' : 'op')) if post.thread == null a(href=`/${board._id}/thread/${post._id}`) #{post._id} else a(href=`/${board._id}/thread/${post.thread}#${post._id}`) #{post._id} span , #{post.author} - span , #{post.date} + span , #{post.date.toLocaleString()} p #{post.title} p #{post.content} diff --git a/views/pages/board.pug b/views/pages/board.pug index 80f419bd..7e89b433 100644 --- a/views/pages/board.pug +++ b/views/pages/board.pug @@ -5,12 +5,10 @@ block head title /#{board._id}/ - Recent Posts block content - span #{board.description} - hr + span #{board.name} - #{board.description} + hr(size=1) for thread in threads - h1 OP: +post(board, thread) - h1 Replies: for post in thread.replies +post(board, post) - hr + hr(size=1) diff --git a/views/pages/home.pug b/views/pages/home.pug new file mode 100644 index 00000000..74a276ca --- /dev/null +++ b/views/pages/home.pug @@ -0,0 +1,17 @@ +extends ../layout.pug + +block head + title Board list + +block content + table + tr + th Board + th Name + th Description + each board in boards + tr + td: a(href='/'+board._id) /#{board._id}/ + td= board.name + td= board.description + diff --git a/views/pages/thread.pug b/views/pages/thread.pug index 8f02f13a..07a780e7 100644 --- a/views/pages/thread.pug +++ b/views/pages/thread.pug @@ -5,9 +5,9 @@ block head title /#{board._id}/ - #{thread.title} block content - h1 OP: - +post(board, thread) - h1 Replies: - for post in thread.replies - +post(board, post) - hr + a(href='/'+board._id) Back to /#{board._id}/ + hr(size=1) + +post(board, thread) + for post in thread.replies + +post(board, post) + hr(size=1)