summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2013-08-10 17:15:22 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2013-08-10 17:15:22 +0200
commit5435a0a45fdfa1bcceeb36f8531826ddc2bb3508 (patch)
tree6254e6f19ca78e394693ef22ea5393dcefc5468d /js
parent2a748125c27c7f7c41a32a1dba14484c66dc351f (diff)
downloadBits-5435a0a45fdfa1bcceeb36f8531826ddc2bb3508.tar.gz
Bits-5435a0a45fdfa1bcceeb36f8531826ddc2bb3508.zip
Added possibility to add notes to studied batch items.
Diffstat (limited to 'js')
-rw-r--r--js/liststudy.js33
-rw-r--r--js/reviewdesu.js24
2 files changed, 52 insertions, 5 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...
+ },
+ });
+}
+
+
diff --git a/js/reviewdesu.js b/js/reviewdesu.js
index 829f07a..6750b4b 100644
--- a/js/reviewdesu.js
+++ b/js/reviewdesu.js
@@ -84,7 +84,7 @@ function next_question() {
html = '<h3>Question ' + question_nb + ' of ' + total + '</h3>';
html += '<div class="review_item">';
- html += '<div>' + question.question + '</div>';
+ html += '<div class="box">' + question.question + '</div>';
html += '<p><button id="flipbtn" onclick="show_answer();">answer</button></p>';
html += '</div>';
$("core").innerHTML = html;
@@ -95,7 +95,8 @@ function next_question() {
function show_answer() {
html = '<h3>Question ' + question_nb + ' of ' + total + '</h3>';
html += '<div class="review_item">';
- html += '<div>' + question.answer + '</div>';
+ html += '<div class="box2">' + question.answer + '</div>';
+ html += '<div class="boxn" onclick="edit_note();" id="notebox">' + (notes[question.key] || '<em>click to add note...</em>') + '</div>';
html += '<p><button taborder="1" onclick="answer_question(-1);">fail</button>';
html += '<button taborder="2" id="dunnobtn" onclick="answer_question(0);">dunno</button>';
html += '<button taborder="3" id="winbtn" onclick="answer_question(1);">win</button></p>';
@@ -109,3 +110,22 @@ function answer_question(a) {
score += a;
next_question();
}
+
+function edit_note() {
+ var idd = question.key;
+ var note = prompt("Add note for item:", notes[idd] || '');
+ if (note != null) notes[idd] = note;
+ if (notes[idd] == '') delete notes[idd];
+ $("notebox").innerHTML = (notes[idd] || '<em>click to add note...</em>');
+
+ new Ajax.Request('index.php?p=brresults-study-' + batchid, {
+ method: 'post',
+ parameters: {
+ notes: Object.toJSON(notes),
+ },
+ onSuccess: function(transport) {
+ // nothing...
+ },
+ });
+}
+