Stránky PDF zvlášť
This commit is contained in:
parent
c54e11f25a
commit
f369110cd3
2 changed files with 51 additions and 50 deletions
50
korektury/templates/korektury/korekturovatko/__stranky.html
Normal file
50
korektury/templates/korektury/korekturovatko/__stranky.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{% for i in img_indexes %}
|
||||
<div class='imgdiv'>
|
||||
<img
|
||||
id='img-{{i}}'
|
||||
width='1021' height='1448'
|
||||
src='/media/korektury/img/{{img_prefix}}-{{i}}.png'
|
||||
alt='Strana {{ i|add:1 }}'
|
||||
class="strana"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
{% endfor %}
|
||||
|
||||
<script>
|
||||
// Mapování stránka -> korektury
|
||||
const comments = {
|
||||
{% for s in opravy_strany %}
|
||||
{{s.strana}}: []{% if not forloop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
// show comment form, when clicked to image
|
||||
for (const image of document.getElementsByClassName('strana')) {
|
||||
image.addEventListener('click', ev => {
|
||||
switch (document.body.dataset.status) {
|
||||
case 'zanaseni':
|
||||
if (!confirm('Právě jsou zanášeny korektury, opravdu chcete přidat novou?'))
|
||||
return;
|
||||
break;
|
||||
case 'zastarale':
|
||||
if (!confirm('Toto PDF je již zastaralé, opravdu chcete vytvořit korekturu?'))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
let dx, dy;
|
||||
const par = image.parentNode;
|
||||
if (ev.pageX != null) {
|
||||
dx = ev.pageX - par.offsetLeft;
|
||||
dy = ev.pageY - par.offsetTop;
|
||||
} else { //IE a další
|
||||
dx = ev.offsetX;
|
||||
dy = ev.offsetY;
|
||||
}
|
||||
const img_id = image.id;
|
||||
return show_form(img_id, dx, dy, '', '', '');
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -1,31 +1,12 @@
|
|||
{% include "korektury/korekturovatko/__edit_komentar.html" %}
|
||||
|
||||
{% for i in img_indexes %}
|
||||
<div class='imgdiv'>
|
||||
<img
|
||||
id='img-{{i}}'
|
||||
width='1021' height='1448'
|
||||
src='/media/korektury/img/{{img_prefix}}-{{i}}.png'
|
||||
alt='Strana {{ i|add:1 }}'
|
||||
class="strana"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
{% endfor %}
|
||||
|
||||
{% include "korektury/korekturovatko/__stranky.html" %}
|
||||
|
||||
{# {% for o in opravy %} {% include "korektury/korekturovatko/__oprava.html" %} {% endfor %} #}
|
||||
{% include "korektury/korekturovatko/__oprava.html" %}
|
||||
{% include "korektury/korekturovatko/__komentar.html" %}
|
||||
|
||||
<script>
|
||||
const comments = {
|
||||
{% for s in opravy_strany %}
|
||||
{{s.strana}}: []{% if not forloop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
fetch('{% url "korektury_api_opravy_a_komentare" pdf.id %}')
|
||||
.then(response => {
|
||||
if (!response.ok) {alert('Něco se nepovedlo:' + response.statusText);}
|
||||
|
@ -48,33 +29,3 @@
|
|||
<script>
|
||||
const CSRF_FORM = document.getElementById('CSRF_form');
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// show comment form, when clicked to image
|
||||
for (const image of document.getElementsByClassName('strana')) {
|
||||
image.addEventListener('click', ev => {
|
||||
switch (document.body.dataset.status) {
|
||||
case 'zanaseni':
|
||||
if (!confirm('Právě jsou zanášeny korektury, opravdu chcete přidat novou?'))
|
||||
return;
|
||||
break;
|
||||
case 'zastarale':
|
||||
if (!confirm('Toto PDF je již zastaralé, opravdu chcete vytvořit korekturu?'))
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
let dx, dy;
|
||||
const par = image.parentNode;
|
||||
if (ev.pageX != null) {
|
||||
dx = ev.pageX - par.offsetLeft;
|
||||
dy = ev.pageY - par.offsetTop;
|
||||
} else { //IE a další
|
||||
dx = ev.offsetX;
|
||||
dy = ev.offsetY;
|
||||
}
|
||||
const img_id = image.id;
|
||||
return show_form(img_id, dx, dy, '', '', '');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue