Skip to content

Commit

Permalink
partially done with homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
makon57 committed Jun 30, 2021
1 parent 14e0ace commit 79b20e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ router.get('/', csrfProtection, asyncHandler(async(req, res) => {
res.render('index', ({ trails }));
}));

router.get('/trails/:id(\\d+)', csrfProtection, asyncHandler(async(req, res, next) => {
router.get('/trail/:id(\\d+)', csrfProtection, asyncHandler(async(req, res, next) => {
const trailId = parseInt(req.params.id, 10);
const trail = await db.Trails.findByPk(trailId);
const trail = await db.Trail.findByPk(trailId);
res.render('trail-detail', {
title: "Park Detail",
trail
Expand Down
1 change: 0 additions & 1 deletion views/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ block content
h1 MixTrail
div(class="search")
input(type="text" id="search-bar" class="search-bar" placeholder="Find your next trail!")

div(class="test")
each trail in trails
div(class="trail-div")
Expand Down
7 changes: 7 additions & 0 deletions views/trail-detail.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends layout.pug

block content
div
p= trail.name
img(src=`../trails/trail-${trail.id}.jpg` alt=`${trail.name}` class=`trail-image-${trail.id}`)
p= trail.description

0 comments on commit 79b20e4

Please sign in to comment.