mirror of https://gitgud.io/fatchan/jschan.git
parent
4ab5f786ba
commit
66c3b40fbd
7 changed files with 92 additions and 25 deletions
@ -0,0 +1,21 @@ |
||||
'use strict'; |
||||
|
||||
const Posts = require(__dirname+'/../../db-models/posts.js'); |
||||
|
||||
module.exports = async (req, res, next) => { |
||||
|
||||
// get all threads
|
||||
let threads; |
||||
try { |
||||
threads = await Posts.getCatalog(req.params.board); |
||||
} catch (err) { |
||||
console.error(err); |
||||
return next(); |
||||
} |
||||
|
||||
//render the page
|
||||
res.render('catalog', { |
||||
threads: threads || [], |
||||
}); |
||||
|
||||
} |
@ -0,0 +1,12 @@ |
||||
mixin catalogtile(board, post, truncate) |
||||
article(class='catalog-tile') |
||||
if post.files.length > 0 |
||||
.post-file-src |
||||
a(target='_blank' href='/img/'+post.files[0].filename) |
||||
object.catalog-thumb(data=`/img/thumb-${post.files[0].filename.split('.')[0]}.png` width='64' height='64') |
||||
header.post-info |
||||
if post.subject |
||||
span.post-subject #{post.subject} |
||||
span: a(href=`/${board._id}/thread/${post.thread ? post.thread : post.postId}#${post.postId}`) ##{post.postId} |
||||
if post.message |
||||
blockquote.post-message !{post.message} |
@ -0,0 +1,18 @@ |
||||
extends ../layout.pug |
||||
include ../mixins/catalogtile.pug |
||||
|
||||
block head |
||||
title /#{board._id}/ - Catalog |
||||
|
||||
block content |
||||
include ../includes/boardheader.pug |
||||
hr(size=1) |
||||
.mode Catalog View [#[a.no-decoration(href=`/${board._id}`) Go Back]] |
||||
hr(size=1) |
||||
if threads.length === 0 |
||||
p No posts. |
||||
hr(size=1) |
||||
section.catalog |
||||
for thread in threads |
||||
+catalogtile(board, thread) |
||||
|
Loading…
Reference in new issue