Skip to content

Commit

Permalink
Post tutorial info to lobby controller for verification
Browse files Browse the repository at this point in the history
  • Loading branch information
yeojoey committed Mar 18, 2017
1 parent 403f2c9 commit c7b9d1d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion source/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ router.get ('/dashboard', auth.ensureAuth, dashboard.get);
router.post('/api/dashboard/forceSyncIVLE', auth.ensureAuth, dashboard.forceSyncIVLE);
router.post('/api/dashboard/getTutorials', auth.ensureAuth, dashboard.getTutorials);

router.get('/api/lobby/enterLobby', auth.ensureAuth, lobby.enterLobby);
router.post('/api/lobby/enterLobby', auth.ensureAuth, lobby.enterLobby);

module.exports = router;
18 changes: 8 additions & 10 deletions source/view/dashboard.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,27 @@ User is: <%= user.name %>
});
}
function showTutorials(tutorials) {
for (i = 0; i < tutorials.count; i++) {
var tut = tutorials.rows[i];
function showTutorials(tuts) {
for (i = 0; i < tuts.count; i++) {
var tut = tuts.rows[i];
tutorials.push(tut);
$('#tutorials').append("<li>" + tut.coursecode + " " + tut.coursename +" <button id='lobby-button' data-id='" + i + "'> Join Class </button></li>");
}
}
//syncIVLE();
getTutorials();
function joinLobby(index) {
var tut = tutorials[index];
}
$(document).on('click', '#lobby-button', function () {
var tut = tutorials[$(this).attr('data-id')];
$.ajax({
method: 'GET',
method: 'POST',
url: '/api/lobby/enterLobby',
dataType: 'json',
data: {
courseId: tut.courseid,
tutorialId: tut.id
},
dataType: 'json',
success: function(data) {
console.log(data);
}
Expand Down

0 comments on commit c7b9d1d

Please sign in to comment.