From d818ce251bd8f9d19e22558c68ab5791ae522d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 08:10:13 +0100 Subject: [PATCH] =?UTF-8?q?Box=5Fedit=20za=20pomoci=20objektu=20opravy=20m?= =?UTF-8?q?=C3=ADsto=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 10 ++++------ .../templates/korektury/korekturovatko/__oprava.html | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index d4982f29..78cee8d2 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -99,13 +99,13 @@ function toggle_visibility(oprava){ } // show comment form, when 'edit' or 'comment' button pressed -function box_edit(oid, action) +function box_edit(op, action) { - var divpointer = document.getElementById(oid + '-pointer'); + var divpointer = document.getElementById(op.id + '-pointer'); var text; if (action == 'update') { - var text_el = document.getElementById(oid + '-text'); + var text_el = document.getElementById(op.id + '-text'); text = text_el.textContent; } else { @@ -114,9 +114,7 @@ function box_edit(oid, action) var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); - var divbox = document.getElementById(oid); - id = oid.substring(2); - return show_form(divbox.img_id, dx, dy, id, text, action); + return show_form(op.img_id, dx, dy, op.dataset.opid, text, action); } // show comment form when 'update-comment' button pressed diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 361c5a77..a2a9bbce 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -10,6 +10,7 @@ class='box' data-opravastatus="{{o.status}}" data-opravazobrazit="true" + data-opid="{{o.id}}" onmouseover='box_onmouseover(this)' onmouseout='box_onmouseout(this)' > @@ -48,7 +49,7 @@ -