diff --git a/routes/classes.js b/routes/classes.js index 85a826d..56596b4 100644 --- a/routes/classes.js +++ b/routes/classes.js @@ -20,14 +20,30 @@ router.get('/:id/details', function (req, res, next) { }); }); +// // Get Lessons +// router.get('/:id/lessons', function (req, res, next) { +// Class.getClassById(req.params.id, function (err, className) { +// if (err) throw err; +// res.render('classes/lessons', { class: className }); +// }); +// }); + // Get Lessons router.get('/:id/lessons', function (req, res, next) { Class.getClassById(req.params.id, function (err, className) { if (err) throw err; - res.render('classes/lessons', { class: className }); + + // Determine if the user is an instructor + const isInstructor = req.user && req.user.type === 'instructor'; + + res.render('classes/lessons', { class: className, isInstructor }); + + // Save changes to the session after rendering the template + req.session.save(); }); }); + // Get Lesson router.get('/:id/lessons/:lesson_id', function (req, res, next) { Class.getClassById(req.params.id, function (err, className) { diff --git a/views/classes/lesson.handlebars b/views/classes/lesson.handlebars index 7ee8657..4ba7810 100644 --- a/views/classes/lesson.handlebars +++ b/views/classes/lesson.handlebars @@ -83,9 +83,9 @@ -
+ {{!--

Quiz Question:

-

What is the capital of France?

+

What is a String?

Paris
@@ -95,7 +95,7 @@ -
+ --}}