diff --git a/static/js/admin.js b/static/js/admin.js
index 3c7f8ea..25d1d1a 100644
--- a/static/js/admin.js
+++ b/static/js/admin.js
@@ -1,6 +1,6 @@
$(document).ready(function() {
// button handlers (runs once)
- function define_buttons_handlers() {
+ function button_handlers() {
$("#allow_all").click(
function() {
$(":checkbox").prop("checked", true).trigger('change');
@@ -13,11 +13,13 @@ $(document).ready(function() {
);
$("#reset_password").click(
function () {
- var number = $("#reset_number").val();
$.ajax({
type: "POST",
url: "/admin",
- data: {"cmd": "reset_password", "value": number}
+ data: {
+ "cmd": "reset_password",
+ "value": $("#reset_number").val()
+ }
});
}
);
@@ -78,16 +80,15 @@ $(document).ready(function() {
active.sort(function(a,b){return a[2] < b[2] ? -1 : (a[2] == b[2] ? 0 : 1);});
n = active.length;
for(var i = 0; i < n; i++) {
- rows += '
\
+ rows += '
\
' + active[i][0] + ' | \
' + active[i][1] + ' | \
' + active[i][2].slice(11,19) + ' | \
- ' + active[i][3] + ' | \
- ' + (active[i][5]? '' : 'unfocus') + ' | \
+ ' + (active[i][5]? '' : 'unfocus') + ' | \
';
}
$("#online_students").html(rows);
- $("#online-header").html(n + " Activo(s)");
+ $("#online-header").html(n);
}
@@ -111,7 +112,7 @@ $(document).ready(function() {
// ----------------------------------------------------------------------
function populateStudentsTable(students) {
var n = students.length;
- $("#students-header").html(n + " Inscritos")
+ $("#students-header").html(n)
var rows = "";
$.each(students, function(i, d) {
var uid = d['uid'];
@@ -130,8 +131,8 @@ $(document).ready(function() {
(d['start_time']=='' ? '' : ' teste') +
// (d['online'] ? 'online' : '') +
'\
- ' + uid + ' | \
- ' + d['name'] + (d['password_defined'] ? ' pw' : '') +' | \
+ ' + uid + (d['password_defined'] ? ' ' : '') + ' | \
+ ' + d['name'] + ' | \
';
var g = d['grades'];
var glength = g.length;
@@ -171,6 +172,6 @@ $(document).ready(function() {
}
populate(); // run once when the page is loaded
- define_buttons_handlers();
+ button_handlers(); // assign handlers to buttons
setInterval(populate, 5000); // poll server on 5s interval
});
diff --git a/templates/admin.html b/templates/admin.html
index b3496ff..b51a4dc 100644
--- a/templates/admin.html
+++ b/templates/admin.html
@@ -11,12 +11,11 @@
-
+
@@ -24,22 +23,42 @@
|