Added project view pagae
This commit is contained in:
parent
ecc48226a7
commit
e5602e660d
1
index.js
1
index.js
@ -40,6 +40,7 @@ const projectRoutes = require('./src/routes/project');
|
|||||||
app.get('/', indexRoutes.getIndex);
|
app.get('/', indexRoutes.getIndex);
|
||||||
app.get('/project', projectRoutes.getIndex);
|
app.get('/project', projectRoutes.getIndex);
|
||||||
app.get('/project/list', projectRoutes.getList);
|
app.get('/project/list', projectRoutes.getList);
|
||||||
|
app.get('/project/:project_id', projectRoutes.getView);
|
||||||
app.get('/project/add', projectRoutes.getAdd);
|
app.get('/project/add', projectRoutes.getAdd);
|
||||||
app.post('/project/add', projectRoutes.postAdd);
|
app.post('/project/add', projectRoutes.postAdd);
|
||||||
|
|
||||||
|
@ -13,6 +13,18 @@ exports.getList = async function(req, res) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// GET /project/:project_id - view information about a project
|
||||||
|
exports.getView = async function(req, res) {
|
||||||
|
var project = await Project.findAll({
|
||||||
|
where: {
|
||||||
|
id: req.params.project_id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
res.render('project/view', {
|
||||||
|
project: project[0]
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// GET /project/add - add a new project
|
// GET /project/add - add a new project
|
||||||
exports.getAdd = async function(req, res) {
|
exports.getAdd = async function(req, res) {
|
||||||
res.render('project/add');
|
res.render('project/add');
|
||||||
|
15
views/project/view.twig
Normal file
15
views/project/view.twig
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{% extends 'layouts/default.twig' %}
|
||||||
|
|
||||||
|
{% block title %}{{ project.title }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<h2>{{ project.title }}</h2>
|
||||||
|
|
||||||
|
<p>{{ project.description }}</p>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<p><a href="/project">Back</a></p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user