Add a page for each student
This commit is contained in:
parent
b2d2cd860c
commit
364124db35
53
main.go
53
main.go
@ -68,6 +68,35 @@ function disp(rendus) {
|
|||||||
document.getElementById("head").appendChild(col);
|
document.getElementById("head").appendChild(col);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function disp_std(rendus, login) {
|
||||||
|
Object.keys(rendus).map(function(label) {
|
||||||
|
var work = rendus[label];
|
||||||
|
|
||||||
|
var row = document.createElement("tr");
|
||||||
|
|
||||||
|
var col = document.createElement("th");
|
||||||
|
col.innerHTML = label;
|
||||||
|
row.appendChild(col);
|
||||||
|
|
||||||
|
if (work) {
|
||||||
|
var col = document.createElement("td");
|
||||||
|
col.className = "success";
|
||||||
|
col.innerHTML = work["date"] + "<br>" + work["hash"];
|
||||||
|
row.appendChild(col);
|
||||||
|
} else {
|
||||||
|
var col = document.createElement("td");
|
||||||
|
col.className = "danger";
|
||||||
|
col.innerHTML = "<span class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></span>";
|
||||||
|
row.appendChild(col);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById("students").appendChild(row);
|
||||||
|
});
|
||||||
|
var col = document.createElement("th");
|
||||||
|
col.innerHTML = login;
|
||||||
|
document.getElementById("head").appendChild(col);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body class="container">
|
<body class="container">
|
||||||
@ -80,13 +109,23 @@ function disp(rendus) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
fetch('rendus.json') // You can also fetch login_x.json
|
if (window.location.pathname[window.location.pathname.length - 1] != "/")
|
||||||
.then(function(response) {
|
fetch(window.location.pathname.replace(".html", "") + ".json")
|
||||||
return response.json();
|
.then(function(response) {
|
||||||
})
|
return response.json();
|
||||||
.then(function(submissions) {
|
})
|
||||||
disp(submissions);
|
.then(function(submissions) {
|
||||||
});
|
var spl = window.location.pathname.split("/")
|
||||||
|
disp_std(submissions, spl[spl.length - 1]);
|
||||||
|
});
|
||||||
|
else
|
||||||
|
fetch('rendus.json') // You can also fetch login_x.json
|
||||||
|
.then(function(response) {
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then(function(submissions) {
|
||||||
|
disp(submissions);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user