You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
946 B
45 lines
946 B
// admin/post.js
|
|
// Copyright (C) 2021 Digital Telepresence, LLC
|
|
// License: Apache-2.0
|
|
|
|
'use strict';
|
|
|
|
const DTP_COMPONENT_NAME = 'admin:post';
|
|
const express = require('express');
|
|
|
|
const { SiteController } = require('../../../lib/site-lib');
|
|
|
|
class PostController extends SiteController {
|
|
|
|
constructor (dtp) {
|
|
super(dtp, DTP_COMPONENT_NAME);
|
|
}
|
|
|
|
async start ( ) {
|
|
const router = express.Router();
|
|
router.use(async (req, res, next) => {
|
|
res.locals.currentView = 'admin';
|
|
res.locals.adminView = 'post';
|
|
return next();
|
|
});
|
|
|
|
router.param('postId', this.populatePostId.bind(this));
|
|
|
|
router.get('/', this.getIndex.bind(this));
|
|
|
|
return router;
|
|
}
|
|
|
|
async populatePostId (req, res, next/*, postId*/) {
|
|
return next();
|
|
}
|
|
|
|
async getIndex (req, res) {
|
|
res.render('admin/post/index');
|
|
}
|
|
}
|
|
|
|
module.exports = async (dtp) => {
|
|
let controller = new PostController(dtp);
|
|
return controller;
|
|
};
|