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
BUGS.md
... ... @@ -5,7 +5,6 @@
5 5 - melhorar o botao de autorizar (desliga-se), usar antes um botao?
6 6 e.g. retornar None quando nao ha alteracoes relativamente à última vez.
7 7 ou usar push (websockets?)
8   -- a primeira coluna da tabela admin deveria estar sempre ordenada.
9 8 - pymips: nao pode executar syscalls do spim.
10 9 - perguntas checkbox [right,wrong] com pelo menos uma opção correcta.
11 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 61  
63 62 # FIXED
64 63  
  64 +- a primeira coluna da tabela admin deveria estar sempre ordenada.
65 65 - abortar depois de testar todas as perguntas, caso haja algum erro.
66 66 - imagens jpg/png nas perguntas.
67 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 97 // ----------------------------------------------------------------------
98 98 function populateStudentsTable() {
99 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 108 paging: false,
102 109 responsive: true,
103 110 language: {
... ... @@ -123,7 +130,7 @@ $(document).ready(function() {
123 130 var g = d['grades'];
124 131  
125 132 t[i] = [];
126   - t[i][0] = i+1;
  133 + t[i][0] = ''; //i+1;
127 134 t[i][1] = '<input type="checkbox" name="' + uid + '" value="true"' + checked + '> ';
128 135 t[i][2] = uid;
129 136 t[i][3] = d['name'];
... ... @@ -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 155 setInterval( function () {
142 156 table.ajax.reload();
143 157 }, 3000 );
... ...