Skip to content

Commit

Permalink
exams list template
Browse files Browse the repository at this point in the history
  • Loading branch information
wing-puah committed Feb 15, 2019
1 parent 1557fa1 commit 219db7f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions dist/js/pageHandlebars.js
Expand Up @@ -55,6 +55,7 @@ Handlebars.registerHelper('trimString', (info, title, idx) => {
};
})();

// runHandlebars(id, dataSrc, src)
runHandlebars('nav-sub-1', '/data/courses.json', 'nav-submenu-template');

runHandlebars('contributors', '/data/contributors.json', 'contributors-template');
Expand Down
9 changes: 8 additions & 1 deletion server/routes/routes.js
Expand Up @@ -49,6 +49,13 @@ module.exports = function (app, passport) {
res.sendFile(path.join( process.cwd(), '/server/protected/courses/' + req.params.courseName + '/' + req.params.content + '.html'));
});

app.get('/exams', function(req, res) {
readJSONFile(path.join( process.cwd(), '/dist/data/courses.json'), (err, json) => {
if(err){ throw err; }
res.render('examList', json)
});
})

app.get('/exam', function(req, res){
let examQns;

Expand All @@ -61,7 +68,7 @@ module.exports = function (app, passport) {
// console.log(examArr)
// examQns.push({scrips: '<script src="/js/exam.js"></script>'})
console.log('test quetions:', json);
res.render('exam', json)
res.render('examList', json)
})
})

Expand Down
26 changes: 26 additions & 0 deletions src/partials/layouts/examList.hbs
@@ -0,0 +1,26 @@
{{> includes/hero hero-title="Exams"}}
<div class="container__cstm">
This is exam list
<div class="row" id="exams__list">

{{#each courses}}
<div class="col-12 col-sm-4">
<div class="card height--full">
<div class="card-body row align-items-end mx-0">
<div>
<h3 class="card-title d-inline-block" style="width: 85%;">{{this.title}}</h3>
<span class="small float-right">$</span> <!--- Replace with price data --->
</div>
<p class="card-text">
Here is some example text <!--- Replace with text data --->
</p>
<a href="#" class="btn btn-gradient width--full" > <!--- Replace with a href data --->
Enroll
</a>
</div>
</div>
</div>
{{/each}}

</div>
</div>

0 comments on commit 219db7f

Please sign in to comment.