merge-requests/208/head
fatchan 5 years ago
parent 0a6a8b150c
commit b696653e73
  1. 4
      models/boards.js
  2. 2
      server.js
  3. 51
      static/css/style.css
  4. 6
      views/includes/navbar.pug
  5. 3
      views/layout.pug
  6. 4
      views/mixins/post.pug
  7. 8
      views/pages/board.pug
  8. 17
      views/pages/home.pug
  9. 12
      views/pages/thread.pug

@ -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);
},

@ -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'));

@ -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;
}

@ -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

@ -5,8 +5,7 @@ html
block head
body
nav
.container
include includes/navbar.pug
include includes/navbar.pug
main
.container
block content

@ -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}

@ -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)

@ -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

@ -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)

Loading…
Cancel
Save