Compare commits

..

4 commits

4 changed files with 17 additions and 21 deletions

View file

@ -102,7 +102,6 @@ form {
top:0px; top:0px;
} }
#commform-div { #commform-div {
display: none;
position: absolute; position: absolute;
background-color: white; background-color: white;
border: 1px solid; border: 1px solid;

View file

@ -46,6 +46,8 @@ function place_comments_one_div(img_id, comments)
el.pointer = elp; el.pointer = elp;
el.img_id = img_id; el.img_id = img_id;
el.x = x
el.y = y
el.style.position = 'absolute'; el.style.position = 'absolute';
el.style.left = w + w_skip; el.style.left = w + w_skip;
el.style.top = y + delta_y; el.style.top = y + delta_y;
@ -101,34 +103,28 @@ function toggle_visibility(oprava){
// show comment form, when 'comment' button pressed // show comment form, when 'comment' button pressed
function comment(op) function comment(op)
{ {
var divpointer = op.pointer; return show_form(op.img_id, op.x, op.y, op.dataset.opid, "", "comment");
var dx = parseInt(divpointer.style.left);
var dy = parseInt(divpointer.style.top);
return show_form(op.img_id, dx, dy, op.dataset.opid, "", "comment");
} }
// show comment form when 'update-comment' button pressed // show comment form when 'update-comment' button pressed
function update_comment(oid,ktid) function update_comment(oid,ktid)
{ {
var divbox = document.getElementById(oid); var divbox = document.getElementById(oid);
var divpointer = divbox.pointer;
var dx = parseInt(divpointer.style.left);
var dy = parseInt(divpointer.style.top);
var text = document.getElementById(ktid).textContent; var text = document.getElementById(ktid).textContent;
return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment'); return show_form(divbox.img_id, divbox.x, divbox.y, ktid.substring(2), text, 'update-comment');
} }
function box_onmouseover(box) function oprava_onmouseover(op)
{ {
var pointer = box.pointer; var pointer = op.pointer;
pointer.classList.remove('pointer'); pointer.classList.remove('pointer');
pointer.classList.add('pointer-hi'); pointer.classList.add('pointer-hi');
} }
function box_onmouseout(box) function oprava_onmouseout(op)
{ {
var pointer = box.pointer; var pointer = op.pointer;
pointer.classList.remove('pointer-hi'); pointer.classList.remove('pointer-hi');
pointer.classList.add('pointer'); pointer.classList.add('pointer');
} }

View file

@ -1,4 +1,4 @@
<div id="commform-div"> <div id="commform-div" style="display: none">
<form action='' id="commform" method="POST"> <form action='' id="commform" method="POST">
{% csrf_token %} {% csrf_token %}
<input size="24" name="au" value="{{user.first_name}} {{user.last_name}}" readonly/> <input size="24" name="au" value="{{user.first_name}} {{user.last_name}}" readonly/>
@ -57,6 +57,8 @@
return 1; return 1;
} }
if (formdiv.style.display !== 'none' && !confirm("Zavřít předchozí okénko přidávání korektury / editace komentáře?")) return 1;
//form.action = "#" + img_id; //form.action = "#" + img_id;
// set hidden values // set hidden values

View file

@ -11,12 +11,11 @@
data-opravastatus="{{o.status}}" data-opravastatus="{{o.status}}"
data-opravazobrazit="true" data-opravazobrazit="true"
data-opid="{{o.id}}" data-opid="{{o.id}}"
onmouseover='box_onmouseover(this)' onmouseover='oprava_onmouseover(this)'
onmouseout='box_onmouseout(this)' onmouseout='oprava_onmouseout(this)'
> >
<div class='corr-body' id='op{{o.id}}-body'> <div class='corr-body'>
{% for k in o.komentare %} {% for k in o.komentare %}
{% include "korektury/korekturovatko/__komentar.html" %} {% include "korektury/korekturovatko/__komentar.html" %}
<hr> <hr>
@ -24,11 +23,11 @@
</div> </div>
<div class='corr-header'> <div class='corr-header'>
<span class='float-right'> <span class='float-right'>
<span id='op{{o.id}}-buttons' class='corr-buttons'> <span class='corr-buttons'>
<form action='' method='POST'> <form action='' method='POST'>
{% csrf_token %} {% csrf_token %}
<input type='hidden' name='id' value='{{o.id}}'> <input type='hidden' name='id' value='{{o.id}}'>
<button style="display: none" type='submit' name='action' value='del' title='Smaž opravu'> <button style="display: none" type='submit' name='action' value='del' title='Smaž opravu'>
<img src="{% static "korektury/imgs/delete.png"%}"/> <img src="{% static "korektury/imgs/delete.png"%}"/>
</button> </button>
@ -55,7 +54,7 @@
</span> </span>
<button type='button' onclick='toggle_visibility(this.parentElement.parentElement.parentElement);' title='Skrýt/Zobrazit'> <button type='button' onclick='toggle_visibility(this.parentElement.parentElement.parentElement);' title='Skrýt/Zobrazit'>
<img id='op{{o.id}}-toggleimg' class='toggle-button' src="{% static "korektury/imgs/hide.png" %}"/> <img class='toggle-button' src="{% static "korektury/imgs/hide.png" %}"/>
</button> </button>
</span> </span>