From 2de2aa40a466bbafd9b06495861af83d555593db Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sat, 5 Dec 2015 14:13:07 +0100 Subject: [PATCH] Docisteni HTML a JS, opravy komentaru. Komentare uz se daji i upravovat. --- korektury/static/korektury/opraf.js | 22 ++++++-------------- korektury/templates/korektury/opraf.html | 26 ++++++++++++------------ korektury/views.py | 10 +++++++-- 3 files changed, 27 insertions(+), 31 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 1d56da31..6c955a72 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -83,7 +83,6 @@ function textarea_onkey(ev) //hide comment form function close_commform() { - var formdiv = document.getElementById('commform-div'); if( formdiv == null ) { alert("form null"); @@ -116,9 +115,8 @@ function img_click(element, ev) { // show comment form, when 'edit' or 'comment' button pressed function box_edit(button, action) { - var divbox = button.parentNode.parentNode.parentNode.parentNode; + var divbox = button.parentNode.parentNode.parentNode; var id = divbox.id; - //alert("id: " + id); var divpointer = document.getElementById(divbox.id + '-pointer'); var text; @@ -135,24 +133,22 @@ function box_edit(button, action) //alert('not yet 2:' + text + text_el); // + divpointer.style.top "x" + divpo ); id = id.substring(2); return show_form(divbox.img_id, dx, dy, id, text, action); - } // show comment form when 'update-comment' button pressed function update_comment(button) { - var divbox = button.parentNode.parentNode.parentNode; + var divbox = button.parentNode.parentNode.parentNode.parentNode; var id = divbox.id; var divpointer = document.getElementById(divbox.id + '-pointer'); var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); - var commentdiv = button.parentNode.parentNode; - var id = commentdiv.id.substring(1); - - var text = document.getElementById('kt' + id).innerHTML.unescapeHTML(); + var commentdiv = button.parentNode.parentNode.parentNode; + var id = commentdiv.id.substring(1); + var text = document.getElementById('kt' + id).innerHTML.unescapeHTML(); - return show_form(divbox.img_id, dx, dy, id, text, 'update-comment'); + return show_form(divbox.img_id, dx, dy, id, text, 'update-comment'); } //fill up comment form and show him @@ -202,8 +198,6 @@ function box_onmouseover(box, done) var id = box.id; var pointer = document.getElementById(box.id + '-pointer'); pointer.className = done ? 'pointer-done-hi' : 'pointer-hi'; - //console.log('mouseout'); - } function box_onmouseout(box, done) @@ -211,8 +205,6 @@ function box_onmouseout(box, done) var id = box.id; var pointer = document.getElementById(box.id + '-pointer'); pointer.className = done ? 'pointer-done' : 'pointer'; - - //console.log('mousein'); } function save_scroll(form) @@ -220,8 +212,6 @@ function save_scroll(form) //alert('save_scroll:' + document.body.scrollTop); form.scroll.value = document.body.scrollTop; //alert('save_scroll:' + form.scroll.value); - - return true; } diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 251f722f..1f3d6e9b 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -99,21 +99,21 @@ {% endif %} - - {% if o.komentare %} - - {% else %} - - {% endif %} - + + {% if o.komentare %} + + {% else %} + + {% endif %} +