Commit 4c4ed8e41220718392a0c16fac8664ca24706ba3

Authored by Miguel Barão
1 parent 008f8967
Exists in master and in 1 other branch dev

- first column in /admin is now always ordered.

Showing 2 changed files with 17 additions and 3 deletions   Show diff stats
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 - melhorar o botao de autorizar (desliga-se), usar antes um botao? 5 - melhorar o botao de autorizar (desliga-se), usar antes um botao?
6 e.g. retornar None quando nao ha alteracoes relativamente à última vez. 6 e.g. retornar None quando nao ha alteracoes relativamente à última vez.
7 ou usar push (websockets?) 7 ou usar push (websockets?)
8 -- a primeira coluna da tabela admin deveria estar sempre ordenada.  
9 - pymips: nao pode executar syscalls do spim. 8 - pymips: nao pode executar syscalls do spim.
10 - perguntas checkbox [right,wrong] com pelo menos uma opção correcta. 9 - perguntas checkbox [right,wrong] com pelo menos uma opção correcta.
11 - questions.py textarea has a abspath which does not make sense! why is it there? not working for perguntations, but seems to work for aprendizations 10 - questions.py textarea has a abspath which does not make sense! why is it there? not working for perguntations, but seems to work for aprendizations
@@ -62,6 +61,7 @@ ou usar push (websockets?) @@ -62,6 +61,7 @@ ou usar push (websockets?)
62 61
63 # FIXED 62 # FIXED
64 63
  64 +- a primeira coluna da tabela admin deveria estar sempre ordenada.
65 - abortar depois de testar todas as perguntas, caso haja algum erro. 65 - abortar depois de testar todas as perguntas, caso haja algum erro.
66 - imagens jpg/png nas perguntas. 66 - imagens jpg/png nas perguntas.
67 - initdb está a inicializar com passwords iguais aos numeros. deveria ser vazio para alunos definirem. 67 - initdb está a inicializar com passwords iguais aos numeros. deveria ser vazio para alunos definirem.
static/js/admin.js
@@ -97,7 +97,14 @@ $(document).ready(function() { @@ -97,7 +97,14 @@ $(document).ready(function() {
97 // ---------------------------------------------------------------------- 97 // ----------------------------------------------------------------------
98 function populateStudentsTable() { 98 function populateStudentsTable() {
99 var table = $('#students_table').DataTable({ 99 var table = $('#students_table').DataTable({
100 - stateSave: true, 100 + columnDefs: [{
  101 + "searcheable": false,
  102 + "orderable": false,
  103 + "targets": 0
  104 + }],
  105 + ordering: true,
  106 + order: [[ 3, "asc"]],
  107 + stateSave: false,
101 paging: false, 108 paging: false,
102 responsive: true, 109 responsive: true,
103 language: { 110 language: {
@@ -123,7 +130,7 @@ $(document).ready(function() { @@ -123,7 +130,7 @@ $(document).ready(function() {
123 var g = d['grades']; 130 var g = d['grades'];
124 131
125 t[i] = []; 132 t[i] = [];
126 - t[i][0] = i+1; 133 + t[i][0] = ''; //i+1;
127 t[i][1] = '<input type="checkbox" name="' + uid + '" value="true"' + checked + '> '; 134 t[i][1] = '<input type="checkbox" name="' + uid + '" value="true"' + checked + '> ';
128 t[i][2] = uid; 135 t[i][2] = uid;
129 t[i][3] = d['name']; 136 t[i][3] = d['name'];
@@ -138,6 +145,13 @@ $(document).ready(function() { @@ -138,6 +145,13 @@ $(document).ready(function() {
138 } 145 }
139 }, 146 },
140 }); 147 });
  148 +
  149 + table.on('order.dt search.dt', function () {
  150 + table.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
  151 + cell.innerHTML = i+1;
  152 + });
  153 + }).draw();
  154 +
141 setInterval( function () { 155 setInterval( function () {
142 table.ajax.reload(); 156 table.ajax.reload();
143 }, 3000 ); 157 }, 3000 );