Skip to content
Permalink
Browse files
Category Filter Completed. User can now browse games through differen…
…t categories. Easier navegation
  • Loading branch information
ricardob committed Dec 2, 2019
1 parent 4d6831f commit 7f15c37543b491c48463f743f05cf326ee4f1e45
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 app.js
@@ -63,9 +63,6 @@ app.use(login.routes())
app.use(list.routes())
app.use(approval.routes())
app.use(logout.routes())
app.use(game.routes())
app.use(list.routes())
app.use(approval.routes())
app.use(adding.routes())
app.use(homepage.routes())
app.use(signup.routes())
@@ -38,9 +38,11 @@ list.get('/', async ctx => {

list.get('/:category/', async ctx => {
const categoryID = await ctx.db.getCategory(ctx.params.category)
const categories = await ctx.db.getCategories()

console.log(categoryID)
const games = await ctx.db.getGamesWithCategory(categoryID.id)
await ctx.render('listpage.hbs', {games: games})
await ctx.render('listpage.hbs', {games: games, category: categories})
})


@@ -118,4 +118,8 @@ a.list:hover {
a.list:active {
color: #A9A9A9;
text-decoration: underline;
}

.categories{
text-align: center;
}
@@ -40,7 +40,7 @@
</tbody>
</table>

<h2>Categories</h2>
<h2 class='categories'>Categories</h2>
{{#each category}}
<ul>
<li class='categories'><a href='/list/{{this.name}}'>{{this.name}}</a></li>

0 comments on commit 7f15c37

Please sign in to comment.