Odkaz na úpravu korektury

This commit is contained in:
Jonas Havelka 2025-02-11 14:52:40 +01:00
parent aed8e0ea44
commit 82a1efc965
3 changed files with 9 additions and 1 deletions
korektury
admin.py
templates/korektury/korekturovatko

View file

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from reversion.admin import VersionAdmin from reversion.admin import VersionAdmin
from korektury.models import KorekturovanePDF from korektury.models import KorekturovanePDF, Oprava
from django.core.mail import EmailMessage from django.core.mail import EmailMessage
from django.urls import reverse from django.urls import reverse
@ -62,3 +62,4 @@ Korekturovátko
).send() ).send()
admin.site.register(KorekturovanePDF, KorekturovanePDFAdmin) admin.site.register(KorekturovanePDF, KorekturovanePDFAdmin)
admin.site.register(Oprava)

View file

@ -34,6 +34,9 @@
<img src='{% static "korektury/imgs/tex.png" %}' alt='TeX'/> <img src='{% static "korektury/imgs/tex.png" %}' alt='TeX'/>
</button> </button>
<a href='{% url "admin:korektury_oprava_change" -1 %}' class='edit' title='Uprav korekturu jako takovou.' style="text-decoration: none;"> {# FIXME Udělat z toho tlačítko? #}
<img src='{% static "korektury/imgs/edit.png"%}' alt='✏️' style="opacity: 0.5;"/> {# FIXME Odlišit jinak než pomocí opacity? #}
</a>
<button type='button' class='notcomment' title='Korekturu nelze komentovat, protože už je uzavřená' disabled=''> <button type='button' class='notcomment' title='Korekturu nelze komentovat, protože už je uzavřená' disabled=''>
<img src='{% static "korektury/imgs/comment-gr.png" %}' alt='💭'/> <img src='{% static "korektury/imgs/comment-gr.png" %}' alt='💭'/>
</button> </button>
@ -86,6 +89,9 @@
button.addEventListener('click', async event => this.#zmenStavKorektury(event)); button.addEventListener('click', async event => this.#zmenStavKorektury(event));
this.htmlElement.getElementsByClassName('comment')[0].addEventListener('click', _ => this.#comment()) this.htmlElement.getElementsByClassName('comment')[0].addEventListener('click', _ => this.#comment())
this.htmlElement.getElementsByClassName('del')[0].addEventListener('click', _ => this.#delete()); this.htmlElement.getElementsByClassName('del')[0].addEventListener('click', _ => this.#delete());
const odkaz_editace = this.htmlElement.getElementsByClassName('edit')[0];
odkaz_editace.href = odkaz_editace.href.replace("-1", this.id);
odkaz_editace.onclick = ev => { if (!confirm("Editace korektury je velmi pokročilá featura umožňující přesouvat korekturu nebo přidávat informované orgy, opravdu chceš pokračovat do adminu?")) ev.preventDefault(); };
this.htmlElement.addEventListener('mouseover', _ => this.pointer.dataset.highlight = 'true'); this.htmlElement.addEventListener('mouseover', _ => this.pointer.dataset.highlight = 'true');
this.htmlElement.addEventListener('mouseout', _ => this.pointer.dataset.highlight = 'false'); this.htmlElement.addEventListener('mouseout', _ => this.pointer.dataset.highlight = 'false');

View file

@ -45,6 +45,7 @@
} }
const img_id = image.id.substring(4); const img_id = image.id.substring(4);
commform.show(img_id, dx, dy, ''); commform.show(img_id, dx, dy, '');
console.log("Pro přesun korektur: strana = " + img_id + ", x = " + dx + ", y = " + dy);
}); });
} }
</script> </script>