Skip to content
This repository has been archived by the owner on Apr 30, 2019. It is now read-only.

Commit

Permalink
Dashboard Refactor #1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalezL committed Dec 6, 2018
1 parent e40949e commit 8755905
Showing 1 changed file with 43 additions and 59 deletions.
102 changes: 43 additions & 59 deletions web/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -333,83 +333,67 @@ <h5 class="card-title mb-0">Total Score = ${item.score}%</h5>`;
console.log(currentExam);
$.ajax(
{
type: "POST",
url: BASE_URL + "test",
data: JSON.stringify(
{
"token": token
}),
dataType: "json",
success: function (data, textStatus, jqXHR)
{
console.log("reloadJSON success")

userJSON = data;

if(pageToLoad === 0) // Home, deleteExam, addExam (G)
type: "POST",
url: BASE_URL + "test",
data: JSON.stringify(
{
clearPage();
}
else if(pageToLoad === 1) //dropdown, testGrid
"token": token
}),
dataType: "json",
success: function (data, textStatus, jqXHR)
{
console.log()
currentExam = userJSON.find(item => item.id === currentExam.id);
loadSidebar();
}
else // addExam (S)
{
currentExam = userJSON.find(item => item.id === currentExam.id);
loadTerminal();
}
console.log("reloadJSON success")

/*
if(isTeacher)
{
if(pageToLoad === 0)
userJSON = data;

if(pageToLoad === 0) // Home, deleteExam, addExam (G)
{
outer = userJSON;
fillGrid(userJSON);
$('#sidebar').hide();
$('#pageContent').hide();
clearPage();
}
else if(pageToLoad === 1) // leave currently selected exam
else if(pageToLoad === 1) //dropdown, testGrid
{
outer = outer.inner.find(item => item.id === userJSON.id);
loadTerminal(userJSON, outer);
console.log()
currentExam = userJSON.find(item => item.id === currentExam.id);
loadSidebar();
}
}
else
{
if(pageToLoad === 0)
else // addExam (S)
{
outer = userJSON;
fillNavBar(userJSON.inner);
$('#pageContent').hide();
currentExam = userJSON.find(item => item.id === currentExam.id);
loadTerminal();
}
}
console.log(userJSON);*/

},
error: function (jqXHR, textStatus, errorThrown)
{
console.log("connection error");
}
},
error: function (jqXHR, textStatus, errorThrown)
{
console.log("connection error");
}
});
}


// DOCUMENT READY
$(document).ready(function ()
{
//RUN FOR MOCK DATA
$.ajax(
{
isTeacher = 1;
console.log(`load ${isTeacher}`);
userJSON = isTeacher? teacherJSON : studentJSON;
}
console.log($('#sidebar').is(":visible"));
clearPage();

type: "POST",
url: BASE_URL + "test",
data: JSON.stringify(
{
"token": token
}),
dataType: "json",
success: function (data, textStatus, jqXHR)
{
userMode = ($.isArray(data))? 1:0;
userJSON = data;
clearPage();
},
error: function (jqXHR, textStatus, errorThrown)
{
console.log("connection error");
}
});


// Sidebar clicked => load this table
Expand Down

0 comments on commit 8755905

Please sign in to comment.