diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-10 17:15:22 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-10 17:15:22 +0200 |
commit | 5435a0a45fdfa1bcceeb36f8531826ddc2bb3508 (patch) | |
tree | 6254e6f19ca78e394693ef22ea5393dcefc5468d /js/liststudy.js | |
parent | 2a748125c27c7f7c41a32a1dba14484c66dc351f (diff) | |
download | Bits-5435a0a45fdfa1bcceeb36f8531826ddc2bb3508.tar.gz Bits-5435a0a45fdfa1bcceeb36f8531826ddc2bb3508.zip |
Added possibility to add notes to studied batch items.
Diffstat (limited to 'js/liststudy.js')
-rw-r--r-- | js/liststudy.js | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/js/liststudy.js b/js/liststudy.js index 820e35d..5ff6aef 100644 --- a/js/liststudy.js +++ b/js/liststudy.js @@ -66,15 +66,16 @@ function process_items() { } function show_contents_table() { - var html = '<table><tr><th style="border: none; background: transparent"></th>'; + var html = '<table><tr><th class="invisible_td"></th>'; for (var i = 0; i < batch_data.columns.length; i++) { var c = batch_data.columns[i]; html += '<th>' + c + ' - <a class="tool_link" href="#" onclick="ch(' + i + ')" id="chsl' + i + '">hide</a></th>'; } html += '<th>win</th><th>fail</th><th>score</th></tr>'; for (var i = 0; i < items.length; i++) { - html += '<tr>'; - html += '<td style="border: none; background: transparent; padding: 0px; padding-top: 8px; font-weight: bold;">' + items[i].marker + '</td>'; + html += '<tr onclick="edit_note(' + i + ');">'; + html += '<td class="invisible_td"><span style="font-weight: bold">' + items[i].marker + '</span>' + + '</td>'; for (var j = 0; j < items[i].info.length; j++) { html += '<td><span class="cd' + j + '">' + items[i].info[j] + '</span></td>'; } @@ -84,6 +85,11 @@ function show_contents_table() { (items[i].score == max_score ? '#00aa00' : (items[i].score >= med_score ? '#55FF55' : (items[i].score < 0 ? '#FF7777' : '#FFFF00'))) + '">' + items[i].score + '</td></tr>'; + if (notes[items[i].info[0]]) { + var note = notes[items[i].info[0]]; + html += '<tr><td class="invisible_td"></td><td class="study_note_td" colspan="' + + (items[i].info.length) + '">' + note + '</td></tr>'; + } } html += '</table>'; html += '<p>Average score : ' + avg_score + '</p>'; @@ -125,3 +131,24 @@ function show_reviews_table() { $("reviews").innerHTML = html; } } + + +function edit_note(id) { + var idd = items[id].info[0]; + var note = prompt("Add note for item: ", notes[idd] || ''); + if (note != null) notes[idd] = note; + if (notes[idd] == '') delete notes[idd]; + show_contents_table(); + + new Ajax.Request('index.php?p=brresults-study-' + batchid, { + method: 'post', + parameters: { + notes: Object.toJSON(notes), + }, + onSuccess: function(transport) { + // nothing... + }, + }); +} + + |