From 69e870f9587b72ddd07402b9e2d1813874e4e847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 17:50:48 +0100 Subject: [PATCH 01/68] =?UTF-8?q?Podle=20m=C4=9B=20funguje=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/views.py | 1 - 1 file changed, 1 deletion(-) diff --git a/korektury/views.py b/korektury/views.py index 08854d95..81f7c962 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -14,7 +14,6 @@ import os class KorekturyListView(generic.ListView): model = KorekturovanePDF - # Nefunguje, filtry se vubec nepouziji queryset = KorekturovanePDF.objects.annotate( k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_oprave')), opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='opraveno')), From c1440687aa18c79eea31a062f12fe7171954cbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 17:51:33 +0100 Subject: [PATCH 02/68] =?UTF-8?q?Nepot=C5=99ebn=C3=A9=20importy=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/views.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/korektury/views.py b/korektury/views.py index 81f7c962..5de96a85 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -8,10 +8,6 @@ from django.db.models import Count,Q from .models import Oprava,Komentar,KorekturovanePDF, Organizator from .forms import OpravaForm -import subprocess -import shutil -import os - class KorekturyListView(generic.ListView): model = KorekturovanePDF queryset = KorekturovanePDF.objects.annotate( From 1e6e6118a7ce159c914c60cb30fff3388325b0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 18:20:25 +0100 Subject: [PATCH 03/68] =?UTF-8?q?Nepou=C5=BE=C3=ADvat=20n=C3=A1hodn=C3=A9?= =?UTF-8?q?=20stringy,=20kdy=C5=BE=20u=C5=BE=20m=C3=A1me=20n=C4=9Bjak?= =?UTF-8?q?=C3=A9=20definovan=C3=A9=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/templates/korektury/opraf.html | 6 +++--- korektury/views.py | 15 +++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index d2ae11aa..24d58d1d 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -85,11 +85,11 @@ {% csrf_token %} - Přidávání korektur + Přidávání korektur
- Zanášení korektur + Zanášení korektur
- Zastaralé, nekorigovat + Zastaralé, nekorigovat
diff --git a/korektury/views.py b/korektury/views.py index 5de96a85..664e9a82 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -11,10 +11,10 @@ from .forms import OpravaForm class KorekturyListView(generic.ListView): model = KorekturovanePDF queryset = KorekturovanePDF.objects.annotate( - k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_oprave')), - opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='opraveno')), - neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='neni_chyba')), - k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status='k_zaneseni')), + k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_K_OPRAVE)), + opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_OPRAVENO)), + neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_NENI_CHYBA)), + k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_K_ZANESENI)), ) template_name = 'korektury/seznam.html' @@ -133,12 +133,7 @@ class KorekturyView(generic.TemplateView): kom.delete() elif (action == 'set-state'): pdf = KorekturovanePDF.objects.get(id=q.get('pdf')) - if (q.get('state') == 'adding'): - pdf.status = pdf.STATUS_PRIDAVANI - elif (q.get('state') == 'comitting'): - pdf.status = pdf.STATUS_ZANASENI - elif (q.get('state') == 'deprecated'): - pdf.status = pdf.STATUS_ZASTARALE + pdf.status = q.get('state') # FIXME odchytávat blbosti? pdf.save() context = self.get_context_data() context['scroll'] = scroll From 62160e8440c92fac99ceaf48f12f64e2154d8a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 18:33:26 +0100 Subject: [PATCH 04/68] =?UTF-8?q?PDF=20u=C5=BE=20dost=C3=A1v=C3=A1me=20v?= =?UTF-8?q?=20URL,=20nen=C3=AD=20to=20pot=C5=99eba=20sh=C3=A1n=C4=9Bt=20zn?= =?UTF-8?q?ovu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/templates/korektury/opraf.html | 4 ---- korektury/views.py | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 24d58d1d..13082bc2 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -57,7 +57,6 @@

- @@ -84,7 +83,6 @@
{% csrf_token %} - Přidávání korektur
Zanášení korektur @@ -121,7 +119,6 @@ {% csrf_token %} - @@ -196,7 +193,6 @@ {% csrf_token %} - {% if forloop.last %} diff --git a/korektury/views.py b/korektury/views.py index 664e9a82..f64951c9 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -56,6 +56,11 @@ class KorekturyView(generic.TemplateView): template_name = 'korektury/opraf.html' form_class = OpravaForm + def setup(self, request, *args, **kwargs): + super().setup(request, *args, **kwargs) + self.pdf_id = self.kwargs["pdf"] + self.pdf = get_object_or_404(KorekturovanePDF, id=self.pdf_id) + def post(self, request, *args, **kwargs): form = self.form_class(request.POST) q = request.POST @@ -77,9 +82,8 @@ class KorekturyView(generic.TemplateView): y = int(q.get('y')) text = q.get('txt') strana = int(q.get('img-id')[4:]) - pdf = KorekturovanePDF.objects.get(id=q.get('pdf')) - op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana,pdf = pdf) + op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana, pdf=self.pdf) op.save() self.send_email_notification_komentar(op,autor) elif (action == 'del'): @@ -132,9 +136,8 @@ class KorekturyView(generic.TemplateView): kom = Komentar.objects.get(id=id) kom.delete() elif (action == 'set-state'): - pdf = KorekturovanePDF.objects.get(id=q.get('pdf')) - pdf.status = q.get('state') # FIXME odchytávat blbosti? - pdf.save() + self.pdf.status = q.get('state') # FIXME odchytávat blbosti? + self.pdf.save() context = self.get_context_data() context['scroll'] = scroll context['autor'] = autor @@ -193,13 +196,12 @@ class KorekturyView(generic.TemplateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - pdf = get_object_or_404(KorekturovanePDF, id=self.kwargs['pdf']) - context['pdf'] = pdf - context['img_prefix'] = pdf.get_prefix() + context['pdf'] = self.pdf + context['img_prefix'] = self.pdf.get_prefix() context['img_path'] = settings.KOREKTURY_IMG_DIR - context['img_indexes'] = range(pdf.stran) + context['img_indexes'] = range(self.pdf.stran) context['form_oprava'] = OpravaForm() - opravy = Oprava.objects.filter(pdf=self.kwargs['pdf']) + opravy = Oprava.objects.filter(pdf=self.pdf_id) zasluhy = {} for o in opravy: if o.autor in zasluhy: From d3d5484d0edb5b3c6a97ff03262d2fd2fae462c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 18:37:23 +0100 Subject: [PATCH 05/68] =?UTF-8?q?Form=20se=20nikde=20nepou=C5=BE=C3=ADv?= =?UTF-8?q?=C3=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/forms.py | 14 -------------- korektury/views.py | 7 ------- 2 files changed, 21 deletions(-) delete mode 100644 korektury/forms.py diff --git a/korektury/forms.py b/korektury/forms.py deleted file mode 100644 index 22c82818..00000000 --- a/korektury/forms.py +++ /dev/null @@ -1,14 +0,0 @@ -from django import forms - -class OpravaForm(forms.Form): - """ formulář k přidání opravy (:class:`korektury.models.Oprava`) """ - text = forms.CharField(max_length=256) - autor = forms.CharField(max_length=20) - x = forms.IntegerField() - y = forms.IntegerField() - scroll = forms.CharField(max_length=256) - pdf = forms.CharField(max_length=256) - img_id = forms.CharField(max_length=256) - id = forms.CharField(max_length=256) - action = forms.CharField(max_length=256) - diff --git a/korektury/views.py b/korektury/views.py index f64951c9..9ce97ee2 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -6,7 +6,6 @@ from django.core.mail import EmailMessage from django.db.models import Count,Q from .models import Oprava,Komentar,KorekturovanePDF, Organizator -from .forms import OpravaForm class KorekturyListView(generic.ListView): model = KorekturovanePDF @@ -54,7 +53,6 @@ class KorekturySeskupeneListView(KorekturyAktualniListView): class KorekturyView(generic.TemplateView): model = Oprava template_name = 'korektury/opraf.html' - form_class = OpravaForm def setup(self, request, *args, **kwargs): super().setup(request, *args, **kwargs) @@ -62,7 +60,6 @@ class KorekturyView(generic.TemplateView): self.pdf = get_object_or_404(KorekturovanePDF, id=self.pdf_id) def post(self, request, *args, **kwargs): - form = self.form_class(request.POST) q = request.POST scroll = q.get('scroll') @@ -200,7 +197,6 @@ class KorekturyView(generic.TemplateView): context['img_prefix'] = self.pdf.get_prefix() context['img_path'] = settings.KOREKTURY_IMG_DIR context['img_indexes'] = range(self.pdf.stran) - context['form_oprava'] = OpravaForm() opravy = Oprava.objects.filter(pdf=self.pdf_id) zasluhy = {} for o in opravy: @@ -233,6 +229,3 @@ class KorekturyView(generic.TemplateView): context['zasluhy'] = zasluhy return context - def form_valid(self,form): - return super().form_valid(form) - From 9df34c22e0b8db6f2650bd3844fac467014efdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 19:01:33 +0100 Subject: [PATCH 06/68] =?UTF-8?q?Modern=C3=AD=20p=C5=99=C3=ADstup=20k=20ch?= =?UTF-8?q?oices=20(umo=C5=BE=C5=88uje=20nap=C5=99.=20vyt=C3=A1hnout=20sez?= =?UTF-8?q?nam=20v=C5=A1ech=20hodnot)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/models.py | 36 +++++++++--------------- korektury/templates/korektury/opraf.html | 6 ++-- korektury/views.py | 20 +++++++------ 3 files changed, 28 insertions(+), 34 deletions(-) diff --git a/korektury/models.py b/korektury/models.py index 9ca40ba1..5df14d6f 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -52,16 +52,13 @@ class KorekturovanePDF(models.Model): stran = models.IntegerField(u'počet stran', help_text='Počet stran PDF', default=0) - STATUS_PRIDAVANI = 'pridavani' - STATUS_ZANASENI = 'zanaseni' - STATUS_ZASTARALE = 'zastarale' - STATUS_CHOICES = ( - (STATUS_PRIDAVANI, u'Přidávání korektur'), - (STATUS_ZANASENI, u'Korektury jsou zanášeny'), - (STATUS_ZASTARALE, u'Stará verze, nekorigovat'), - ) - status = models.CharField(u'stav PDF',max_length=16, choices=STATUS_CHOICES, blank=False, - default = STATUS_PRIDAVANI) + + class STATUS(models.TextChoices): + PRIDAVANI = 'pridavani', 'Přidávání korektur' + ZANASENI = 'zanaseni', 'Korektury jsou zanášeny' + ZASTARALE = 'zastarale', 'Stará verze, nekorigovat' + + status = models.CharField(u'stav PDF',max_length=16, choices=STATUS.choices, blank=False, default = STATUS.PRIDAVANI) poslat_mail = models.BooleanField('Poslat mail o novém PDF', default=True, help_text='Určuje, zda se má o nově nahraném PDF poslat e-mail do mam-org. Při upravování existujícího souboru už nemá žádný vliv.', @@ -152,18 +149,13 @@ class Oprava(models.Model): x = models.IntegerField(u'x-ová souřadnice bugu') y = models.IntegerField(u'y-ová souřadnice bugu') - STATUS_K_OPRAVE = 'k_oprave' - STATUS_OPRAVENO = 'opraveno' - STATUS_NENI_CHYBA = 'neni_chyba' - STATUS_K_ZANESENI = 'k_zaneseni' - STATUS_CHOICES = ( - (STATUS_K_OPRAVE, u'K opravě'), - (STATUS_OPRAVENO, u'Opraveno'), - (STATUS_NENI_CHYBA, u'Není chyba'), - (STATUS_K_ZANESENI, u'K zanesení do TeXu'), - ) - status = models.CharField(u'stav opravy',max_length=16, choices=STATUS_CHOICES, blank=False, - default = STATUS_K_OPRAVE) + class STATUS(models.TextChoices): + K_OPRAVE = 'k_oprave', 'K opravě' + OPRAVENO = 'opraveno', 'Opraveno' + NENI_CHYBA = 'neni_chyba', 'Není chyba' + K_ZANESENI = 'k_zaneseni', 'K zanesení do TeXu' + + status = models.CharField(u'stav opravy',max_length=16, choices=STATUS.choices, blank=False, default = STATUS.K_OPRAVE) autor = models.ForeignKey(Organizator, blank = True, help_text='Autor opravy', diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 13082bc2..ec550b36 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -83,11 +83,11 @@ {% csrf_token %} - Přidávání korektur + Přidávání korektur
- Zanášení korektur + Zanášení korektur
- Zastaralé, nekorigovat + Zastaralé, nekorigovat
diff --git a/korektury/views.py b/korektury/views.py index 9ce97ee2..861afac8 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -10,10 +10,10 @@ from .models import Oprava,Komentar,KorekturovanePDF, Organizator class KorekturyListView(generic.ListView): model = KorekturovanePDF queryset = KorekturovanePDF.objects.annotate( - k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_K_OPRAVE)), - opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_OPRAVENO)), - neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_NENI_CHYBA)), - k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS_K_ZANESENI)), + k_oprave_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS.K_OPRAVE)), + opraveno_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS.OPRAVENO)), + neni_chyba_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS.NENI_CHYBA)), + k_zaneseni_cnt=Count('oprava',distinct=True,filter=Q(oprava__status=Oprava.STATUS.K_ZANESENI)), ) template_name = 'korektury/seznam.html' @@ -97,22 +97,22 @@ class KorekturyView(generic.TemplateView): elif (action == 'undone'): id = int(q.get('id')) op = Oprava.objects.get(id=id) - op.status = op.STATUS_K_OPRAVE + op.status = op.STATUS.K_OPRAVE op.save() elif (action == 'done'): id = int(q.get('id')) op = Oprava.objects.get(id=id) - op.status = op.STATUS_OPRAVENO + op.status = op.STATUS.OPRAVENO op.save() elif (action == 'ready'): id = int(q.get('id')) op = Oprava.objects.get(id=id) - op.status = op.STATUS_K_ZANESENI + op.status = op.STATUS.K_ZANESENI op.save() elif (action == 'wontfix'): id = int(q.get('id')) op = Oprava.objects.get(id=id) - op.status = op.STATUS_NENI_CHYBA + op.status = op.STATUS.NENI_CHYBA op.save() elif (action == 'comment'): id = int(q.get('id')) @@ -133,7 +133,9 @@ class KorekturyView(generic.TemplateView): kom = Komentar.objects.get(id=id) kom.delete() elif (action == 'set-state'): - self.pdf.status = q.get('state') # FIXME odchytávat blbosti? + status = q.get('state') + assert status in KorekturovanePDF.STATUS.values + self.pdf.status = status self.pdf.save() context = self.get_context_data() context['scroll'] = scroll From 8d09fd5389dc92f5d9a0a00c585ba598b1facf8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 19:10:36 +0100 Subject: [PATCH 07/68] =?UTF-8?q?Status=20opravy=20=C5=99e=C5=A1it=20p?= =?UTF-8?q?=C5=99es=20enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/templates/korektury/opraf.html | 16 ++++++++-------- korektury/views.py | 19 ++----------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index ec550b36..3b327d69 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -132,23 +132,23 @@ {% endif %} - {% if o.status != 'k_oprave' %} - {% endif %} - {% if o.status != 'opraveno' %} - {% endif %} - {% if o.status != 'neni_chyba' %} - {% endif %} - {% if o.status != 'k_zaneseni' %} - {% endif %} diff --git a/korektury/views.py b/korektury/views.py index 861afac8..a89f9a79 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -94,25 +94,10 @@ class KorekturyView(generic.TemplateView): op.autor = autor op.text = text op.save() - elif (action == 'undone'): + elif action in Oprava.STATUS.values: id = int(q.get('id')) op = Oprava.objects.get(id=id) - op.status = op.STATUS.K_OPRAVE - op.save() - elif (action == 'done'): - id = int(q.get('id')) - op = Oprava.objects.get(id=id) - op.status = op.STATUS.OPRAVENO - op.save() - elif (action == 'ready'): - id = int(q.get('id')) - op = Oprava.objects.get(id=id) - op.status = op.STATUS.K_ZANESENI - op.save() - elif (action == 'wontfix'): - id = int(q.get('id')) - op = Oprava.objects.get(id=id) - op.status = op.STATUS.NENI_CHYBA + op.status = action op.save() elif (action == 'comment'): id = int(q.get('id')) From 04508206bb87b343b6d2c257bdaa7cbe6eae1357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 19:27:30 +0100 Subject: [PATCH 08/68] =?UTF-8?q?Funkce=20na=20pos=C3=ADl=C3=A1n=C3=AD=20e?= =?UTF-8?q?-mailu=20rozhodn=C4=9B=20nem=C3=A1=20b=C3=BDt=20uvnit=C5=99=20V?= =?UTF-8?q?iew?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/utils.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++ korektury/views.py | 57 +++------------------------------------------- 2 files changed, 60 insertions(+), 54 deletions(-) create mode 100644 korektury/utils.py diff --git a/korektury/utils.py b/korektury/utils.py new file mode 100644 index 00000000..e7a3bc62 --- /dev/null +++ b/korektury/utils.py @@ -0,0 +1,57 @@ +from django.core.mail import EmailMessage +from django.http import HttpRequest +from django.urls import reverse + +from korektury.models import Komentar, Oprava +from personalni.models import Organizator + + +def send_email_notification_komentar(oprava: Oprava, autor: Organizator, request: HttpRequest): + ''' Rozesle e-mail pri pridani komentare / opravy, + ktery obsahuje text vlakna opravy. + ''' + + # parametry e-mailu + #odkaz = "https://mam.mff.cuni.cz/korektury/{}/".format(oprava.pdf.pk) + odkaz = request.build_absolute_uri(reverse('korektury', kwargs={'pdf': oprava.pdf.pk})) + odkaz = f"{odkaz}#op{oprava.id}-pointer" + from_email = 'korekturovatko@mam.mff.cuni.cz' + subject = 'Nová korektura od {} v {}'.format(autor, oprava.pdf.nazev) + texty = [(oprava.autor.osoba.plne_jmeno(),oprava.text)] + for kom in Komentar.objects.filter(oprava=oprava): + texty.append((kom.autor.osoba.plne_jmeno(),kom.text)) + optext = "\n\n\n".join([": ".join(t) for t in texty]) + text = u"Text komentáře:\n\n{}\n\n=== Konec textu komentáře ===\n\ + \nodkaz do korekturovátka: {}\n\ + \nVaše korekturovátko\n".format(optext, odkaz) + + # Prijemci e-mailu + emails = set() + # e-mail autora korektury + email = oprava.autor.osoba.email + if email: + emails.add(email) + + # nalezeni e-mailu na autory komentaru + for komentar in oprava.komentar_set.all(): + email_komentujiciho = komentar.autor.osoba.email + if email_komentujiciho: + emails.add(email_komentujiciho) + + # zodpovedni orgove + for org in oprava.pdf.orgove.all(): + email_zobpovedny = org.osoba.email + if email_zobpovedny: + emails.add(email_zobpovedny) + + # odstran e-mail autora opravy + email = autor.osoba.email + if email: + emails.discard(email) + + EmailMessage( + subject=subject, + body=text, + from_email=from_email, + to=list(emails), + ).send() diff --git a/korektury/views.py b/korektury/views.py index a89f9a79..9c52b20e 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -2,9 +2,9 @@ from django.shortcuts import get_object_or_404, render from django.views import generic from django.conf import settings from django.http import HttpResponseForbidden -from django.core.mail import EmailMessage from django.db.models import Count,Q +from .utils import send_email_notification_komentar from .models import Oprava,Komentar,KorekturovanePDF, Organizator class KorekturyListView(generic.ListView): @@ -82,7 +82,7 @@ class KorekturyView(generic.TemplateView): op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana, pdf=self.pdf) op.save() - self.send_email_notification_komentar(op,autor) + send_email_notification_komentar(op, autor, request) elif (action == 'del'): id = int(q.get('id')) op = Oprava.objects.get(id=id) @@ -105,7 +105,7 @@ class KorekturyView(generic.TemplateView): text = q.get('txt') kom = Komentar(oprava=op,autor=autor,text=text) kom.save() - self.send_email_notification_komentar(op,autor) + send_email_notification_komentar(op, autor, request) elif (action == 'update-comment'): id = int(q.get('id')) kom = Komentar.objects.get(id=id) @@ -127,57 +127,6 @@ class KorekturyView(generic.TemplateView): context['autor'] = autor return render(request, 'korektury/opraf.html',context) - def send_email_notification_komentar(self, oprava, autor): - ''' Rozesle e-mail pri pridani komentare / opravy, - ktery obsahuje text vlakna opravy. - ''' - - # parametry e-mailu - #odkaz = "https://mam.mff.cuni.cz/korektury/{}/".format(oprava.pdf.pk) - from django.urls import reverse - odkaz = self.request.build_absolute_uri(reverse('korektury', kwargs={'pdf': oprava.pdf.pk})) - odkaz = f"{odkaz}#op{oprava.id}-pointer" - from_email = 'korekturovatko@mam.mff.cuni.cz' - subject = 'Nová korektura od {} v {}'.format(autor, oprava.pdf.nazev) - texty = [(oprava.autor.osoba.plne_jmeno(),oprava.text)] - for kom in Komentar.objects.filter(oprava=oprava): - texty.append((kom.autor.osoba.plne_jmeno(),kom.text)) - optext = "\n\n\n".join([": ".join(t) for t in texty]) - text = u"Text komentáře:\n\n{}\n\n=== Konec textu komentáře ===\n\ - \nodkaz do korekturovátka: {}\n\ - \nVaše korekturovátko\n".format(optext, odkaz) - - # Prijemci e-mailu - emails = set() - # e-mail autora korektury - email = oprava.autor.osoba.email - if email: - emails.add(email) - - # nalezeni e-mailu na autory komentaru - for komentar in oprava.komentar_set.all(): - email_komentujiciho = komentar.autor.osoba.email - if email_komentujiciho: - emails.add(email_komentujiciho) - - # zodpovedni orgove - for org in oprava.pdf.orgove.all(): - email_zobpovedny = org.osoba.email - if email_zobpovedny: - emails.add(email_zobpovedny) - - # odstran e-mail autora opravy - email = autor.osoba.email - if email: - emails.discard(email) - - EmailMessage( - subject=subject, - body=text, - from_email=from_email, - to=list(emails), - ).send() - def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['pdf'] = self.pdf From 22e88daf0272cf2696511015dbd0b75a9f4f07df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 3 Dec 2024 20:10:41 +0100 Subject: [PATCH 09/68] Korektury api init --- korektury/api/__init__.py | 0 korektury/api/apps.py | 7 +++++++ korektury/api/migrations/__init__.py | 0 mamweb/settings_common.py | 1 + 4 files changed, 8 insertions(+) create mode 100644 korektury/api/__init__.py create mode 100644 korektury/api/apps.py create mode 100644 korektury/api/migrations/__init__.py diff --git a/korektury/api/__init__.py b/korektury/api/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/korektury/api/apps.py b/korektury/api/apps.py new file mode 100644 index 00000000..be74e478 --- /dev/null +++ b/korektury/api/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class ApiConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'korektury.api' + label = 'korektury_api' # Protože jedno api už máme. diff --git a/korektury/api/migrations/__init__.py b/korektury/api/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 3bfbcfc4..3242bd62 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -134,6 +134,7 @@ INSTALLED_APPS = ( 'tvorba', 'galerie', 'korektury', + 'korektury.api', 'prednasky', 'header_fotky', 'various', From 3528a44d3c4c9b6f310ee617ce19998ac1ccfe2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 12 Dec 2024 11:24:17 +0100 Subject: [PATCH 10/68] =?UTF-8?q?=C3=9Aprava=20chov=C3=A1n=C3=AD=20korektu?= =?UTF-8?q?ry=20(schov=C3=A1v=C3=A1=20text=20korektury!!!)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/imgs/hide.png | Bin 270 -> 307 bytes korektury/static/korektury/opraf.js | 3 + korektury/templates/korektury/opraf.html | 95 ++++++++--------------- 3 files changed, 35 insertions(+), 63 deletions(-) diff --git a/korektury/static/korektury/imgs/hide.png b/korektury/static/korektury/imgs/hide.png index bcaeec04c6440a7a42febd3825cfce7ae4e79ed8..e58ddb03f8d82e22230987b3623f63ebe18d41e0 100644 GIT binary patch delta 206 zcmV;<05SiL0gdWk&!CeR;0ink|?*+ff4gdfE07*qo IM6N<$g3-!XNdN!< delta 171 zcmV;c096080*(TZG?7s{e~U>(K~y-6<5`tjM`*O{*<{e$Q_+)6JI##JMYKg@bfgV#2C#;-ogX7NOs2xI@lD8DYHg9wDqt{ zkhkc*p46{dvd5t6CnFr+$OjCo+YUA=jcPOO?x)%)gcY Zg(oeeKJ4WPBPaj>002ovPDHLkV1nN?Pb2^U diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 61eb5ce9..08b6149e 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -132,12 +132,15 @@ function img_click(element, ev) { function toggle_visibility(oid){ var buttondiv = document.getElementById(oid+'-buttons') var text = document.getElementById(oid+'-body'); + var toggleimg = document.getElementById(oid+'-toggleimg'); if (text.style.display == 'none'){ text.style.display = 'block'; buttondiv.style.display = 'inline-block'; + toggleimg.style.transform = ""; }else { text.style.display = 'none'; buttondiv.style.display = 'none'; + toggleimg.style.transform = "rotate(180deg)"; } for (var i=0;i -
- {{o.autor}} +
+ + {% for k in o.komentare %} +
+
+
{{k.autor}}
+
+ +
+ {% csrf_token %} + + + +
+ + +
+
+
{{k.text|linebreaks}}
+
+
+ {% endfor %} +
+
@@ -122,16 +149,9 @@ - {% if o.komentare %} - - {% else %} - - {% endif %} + {% if o.status != o.STATUS.K_OPRAVE %} - {% else %} - - {% endif %} {% if o.status == 'opraveno' or o.status == 'neni_chyba' %}
-
-
{{o.text|linebreaks}}
- - {% for k in o.komentare %} -
-
-
-
{{k.autor}}
-
- -
- {% csrf_token %} - - - {% if forloop.last %} - - {% else %} - - {% endif %} -
- - {% if forloop.last %} - - {% else %} - - {% endif %} -
-
-
{{k.text|linebreaks}}
-
- {% endfor %} -
{% endfor %} From 0dde05f1027131337b61cfa0d6d07cb47f373841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 12 Dec 2024 11:50:17 +0100 Subject: [PATCH 11/68] =?UTF-8?q?Odstran=C4=9Bn=C3=AD=20textu=20a=20autora?= =?UTF-8?q?=20z=20opravy=20(p=C5=99esun=20do=20prvn=C3=ADho=20koment=C3=A1?= =?UTF-8?q?=C5=99e)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._remove_oprava_autor_remove_oprava_text.py | 45 +++++++++++++++++++ korektury/models.py | 14 ------ korektury/templates/korektury/opraf.html | 1 - korektury/utils.py | 6 +-- korektury/views.py | 18 +++----- 5 files changed, 51 insertions(+), 33 deletions(-) create mode 100644 korektury/migrations/0025_remove_oprava_autor_remove_oprava_text.py diff --git a/korektury/migrations/0025_remove_oprava_autor_remove_oprava_text.py b/korektury/migrations/0025_remove_oprava_autor_remove_oprava_text.py new file mode 100644 index 00000000..82f23ba2 --- /dev/null +++ b/korektury/migrations/0025_remove_oprava_autor_remove_oprava_text.py @@ -0,0 +1,45 @@ +# Generated by Django 4.2.16 on 2024-12-12 10:25 + +from django.db import migrations + +import datetime +from django.utils import timezone + + +def oprava2komentar(apps, schema_editor): + Oprava = apps.get_model('korektury', 'Oprava') + Komentar = apps.get_model('korektury', 'Komentar') + + for o in Oprava.objects.all(): + Komentar.objects.create(oprava=o, text=o.text, autor=o.autor, cas=timezone.make_aware(datetime.datetime.fromtimestamp(0))) + +def komentar2oprava(apps, schema_editor): + Oprava = apps.get_model('korektury', 'Oprava') + Komentar = apps.get_model('korektury', 'Komentar') + + for o in Oprava.objects.all(): + k = Komentar.objects.filter(oprava=o).first() + o.text = k.text + o.autor = k.autor + o.save() + k.delete() + + + +class Migration(migrations.Migration): + + dependencies = [ + ('korektury', '0024_vic_orgu_k_pdf'), + ] + + operations = [ + migrations.RunPython(oprava2komentar, komentar2oprava), + migrations.RemoveField( + model_name='oprava', + name='autor', + ), + migrations.RemoveField( + model_name='oprava', + name='text', + ), + ] diff --git a/korektury/models.py b/korektury/models.py index 5df14d6f..2f2480c1 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -157,20 +157,6 @@ class Oprava(models.Model): status = models.CharField(u'stav opravy',max_length=16, choices=STATUS.choices, blank=False, default = STATUS.K_OPRAVE) - autor = models.ForeignKey(Organizator, blank = True, - help_text='Autor opravy', - null = True, on_delete=models.SET_NULL) - - text = models.TextField(u'text opravy',blank = True, help_text='Text opravy') - -# def __init__(self,dictionary): -# for k,v in dictionary.items(): -# setattr(self,k,v) - - def __str__(self): - return '{} od {}: {}'.format(self.status,self.autor,self.text) - - @reversion.register(ignore_duplicates=True) class Komentar(models.Model): diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index 783c6910..176e6fe6 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -145,7 +145,6 @@
{% csrf_token %} - diff --git a/korektury/utils.py b/korektury/utils.py index e7a3bc62..e25947af 100644 --- a/korektury/utils.py +++ b/korektury/utils.py @@ -17,7 +17,7 @@ def send_email_notification_komentar(oprava: Oprava, autor: Organizator, request odkaz = f"{odkaz}#op{oprava.id}-pointer" from_email = 'korekturovatko@mam.mff.cuni.cz' subject = 'Nová korektura od {} v {}'.format(autor, oprava.pdf.nazev) - texty = [(oprava.autor.osoba.plne_jmeno(),oprava.text)] + texty = [] for kom in Komentar.objects.filter(oprava=oprava): texty.append((kom.autor.osoba.plne_jmeno(),kom.text)) optext = "\n\n\n".join([": ".join(t) for t in texty]) @@ -27,10 +27,6 @@ def send_email_notification_komentar(oprava: Oprava, autor: Organizator, request # Prijemci e-mailu emails = set() - # e-mail autora korektury - email = oprava.autor.osoba.email - if email: - emails.add(email) # nalezeni e-mailu na autory komentaru for komentar in oprava.komentar_set.all(): diff --git a/korektury/views.py b/korektury/views.py index 9c52b20e..93cffb7e 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -79,21 +79,17 @@ class KorekturyView(generic.TemplateView): y = int(q.get('y')) text = q.get('txt') strana = int(q.get('img-id')[4:]) - - op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana, pdf=self.pdf) + op = Oprava(x=x,y=y, strana=strana, pdf=self.pdf) op.save() + kom = Komentar(oprava=op,autor=autor,text=text) + kom.save() send_email_notification_komentar(op, autor, request) elif (action == 'del'): id = int(q.get('id')) op = Oprava.objects.get(id=id) + for k in Komentar.objects.filter(oprava=op): + k.delete() op.delete() - elif (action == 'update'): - id = int(q.get('id')) - op = Oprava.objects.get(id=id) - text = q.get('txt') - op.autor = autor - op.text = text - op.save() elif action in Oprava.STATUS.values: id = int(q.get('id')) op = Oprava.objects.get(id=id) @@ -136,10 +132,6 @@ class KorekturyView(generic.TemplateView): opravy = Oprava.objects.filter(pdf=self.pdf_id) zasluhy = {} for o in opravy: - if o.autor in zasluhy: - zasluhy[o.autor]+=1 - else: - zasluhy[o.autor]=1 o.komentare = o.komentar_set.all() for k in o.komentare: if k.autor in zasluhy: From daf24ff981fda512b080a2641fe5e8fa3fd931a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 12 Dec 2024 12:33:33 +0100 Subject: [PATCH 12/68] =?UTF-8?q?Rozst=C5=99=C3=ADlen=C3=AD=20korekturov?= =?UTF-8?q?=C3=A1tka=20(html)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../korekturovatko/__edit_komentar.html | 17 ++ .../korektury/korekturovatko/__komentar.html | 24 ++ .../korektury/korekturovatko/__oprava.html | 69 ++++++ .../korektury/korekturovatko/_main.html | 30 +++ .../korekturovatko/_schovani_korektur.html | 23 ++ .../korekturovatko/_zmena_stavu.html | 14 ++ .../korektury/korekturovatko/htmlstrana.html | 44 ++++ korektury/templates/korektury/opraf.html | 208 ------------------ korektury/views.py | 4 +- 9 files changed, 223 insertions(+), 210 deletions(-) create mode 100644 korektury/templates/korektury/korekturovatko/__edit_komentar.html create mode 100644 korektury/templates/korektury/korekturovatko/__komentar.html create mode 100644 korektury/templates/korektury/korekturovatko/__oprava.html create mode 100644 korektury/templates/korektury/korekturovatko/_main.html create mode 100644 korektury/templates/korektury/korekturovatko/_schovani_korektur.html create mode 100644 korektury/templates/korektury/korekturovatko/_zmena_stavu.html create mode 100644 korektury/templates/korektury/korekturovatko/htmlstrana.html delete mode 100644 korektury/templates/korektury/opraf.html diff --git a/korektury/templates/korektury/korekturovatko/__edit_komentar.html b/korektury/templates/korektury/korekturovatko/__edit_komentar.html new file mode 100644 index 00000000..7e6462ba --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/__edit_komentar.html @@ -0,0 +1,17 @@ +
+ + {% csrf_token %} + + + +
+ +
+ + + + + + + +
diff --git a/korektury/templates/korektury/korekturovatko/__komentar.html b/korektury/templates/korektury/korekturovatko/__komentar.html new file mode 100644 index 00000000..8e95374f --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/__komentar.html @@ -0,0 +1,24 @@ +{% load static %} + +
+
+
{{k.autor}}
+
+ +
+ {% csrf_token %} + + + +
+ + +
+
+
{{k.text|linebreaks}}
+
\ No newline at end of file diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html new file mode 100644 index 00000000..d3b2f3fd --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -0,0 +1,69 @@ +{% load static %} + +
+
+
+ +
+ + {% for k in o.komentare %} + {% include "korektury/korekturovatko/__komentar.html" %} +
+ {% endfor %} +
+
+ + +
+ {% csrf_token %} + + + + + {% if o.status != o.STATUS.K_OPRAVE %} + + {% endif %} + {% if o.status != o.STATUS.OPRAVENO %} + + {% endif %} + {% if o.status != o.STATUS.NENI_CHYBA %} + + {% endif %} + {% if o.status != o.STATUS.K_ZANESENI %} + + {% endif %} +
+ + {% if o.status == 'opraveno' or o.status == 'neni_chyba' %} + + {% else %} + + {% endif %} + +
+ + +
+
+
\ No newline at end of file diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html new file mode 100644 index 00000000..66653d26 --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -0,0 +1,30 @@ +{% include "korektury/korekturovatko/__edit_komentar.html" %} + +{% for i in img_indexes %} +
+ Strana {{ i|add:1 }} +
+ +
+{% endfor %} + + +{% for o in opravy %} + {% include "korektury/korekturovatko/__oprava.html" %} +{% endfor %} + + diff --git a/korektury/templates/korektury/korekturovatko/_schovani_korektur.html b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html new file mode 100644 index 00000000..4d1ffd31 --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html @@ -0,0 +1,23 @@ +Zobrazit: + + + + + + + + + +
\ No newline at end of file diff --git a/korektury/templates/korektury/korekturovatko/_zmena_stavu.html b/korektury/templates/korektury/korekturovatko/_zmena_stavu.html new file mode 100644 index 00000000..e0415019 --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/_zmena_stavu.html @@ -0,0 +1,14 @@ +

Změnit stav PDF:

+Aktuální: {{pdf.status}} +
+
+ {% csrf_token %} + + Přidávání korektur +
+ Zanášení korektur +
+ Zastaralé, nekorigovat +
+ +
diff --git a/korektury/templates/korektury/korekturovatko/htmlstrana.html b/korektury/templates/korektury/korekturovatko/htmlstrana.html new file mode 100644 index 00000000..1f95769c --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/htmlstrana.html @@ -0,0 +1,44 @@ +{% load static %} + + + + + + + + Korektury {{pdf.nazev}} + + + +

Korektury {{pdf.nazev}}

+ + {% if pdf.status == 'zanaseni' %}

Probíhá zanášení korektur, zvažte, zda chcete přidávat nové

{% endif %} + {% if pdf.status == 'zastarale' %}

Toto PDF je již zastaralé, nepřidávejte nové korektury

{% endif %} + + {{pdf.komentar}} +
+ Klikni na chybu, napiš komentář | + stáhnout PDF (bez korektur) | + seznam souborů | + Spravovat PDF | + nápověda | +           | + hlavní stránka | + wiki | +
+ + {% include "korektury/korekturovatko/_schovani_korektur.html" %} + + {% include "korektury/korekturovatko/_main.html" %} + + {% include "korektury/korekturovatko/_zmena_stavu.html" %} + +
+

+ Děkujeme opravovatelům: + {% for z in zasluhy %} + {{z.autor}} ({{z.pocet}}){% if not forloop.last %},{% endif %} + {% endfor %}

+
+ + diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html deleted file mode 100644 index 176e6fe6..00000000 --- a/korektury/templates/korektury/opraf.html +++ /dev/null @@ -1,208 +0,0 @@ -{% load static %} - - - - - - - - Korektury {{pdf.nazev}} - - -

Korektury {{pdf.nazev}}

- {% if pdf.status == 'zanaseni' %}

Probíhá zanášení korektur, zvažte, zda chcete přidávat nové

{% endif %} - {% if pdf.status == 'zastarale' %}

Toto PDF je již zastaralé, nepřidávejte nové korektury

{% endif %} - {{pdf.komentar}} -
- Klikni na chybu, napiš komentář | - stáhnout PDF (bez korektur) | - seznam souborů | - Spravovat PDF | - nápověda | -           | - hlavní stránka | - wiki | -
- Zobrazit: - - - - - - - - - -
- -
- -
- {% csrf_token %} - - - -
- -
- - - - - - -
- -
- - {% for i in img_indexes %} -
- -
-
- {% endfor %} - -

Změnit stav PDF:

- Aktuální: {{pdf.status}} -
- -
- {% csrf_token %} - - Přidávání korektur -
- Zanášení korektur -
- Zastaralé, nekorigovat -
- -
- - -
-

- Děkujeme opravovatelům: - {% for z in zasluhy %} - {{z.autor}} ({{z.pocet}}){% if not forloop.last %},{% endif %} - {% endfor %}

-
- - {% for o in opravy %} -
-
-
- -
- - {% for k in o.komentare %} -
-
-
{{k.autor}}
-
- -
- {% csrf_token %} - - - -
- - -
-
-
{{k.text|linebreaks}}
-
-
- {% endfor %} -
-
- - - -
- {% csrf_token %} - - - - - {% if o.status != o.STATUS.K_OPRAVE %} - - {% endif %} - {% if o.status != o.STATUS.OPRAVENO %} - - {% endif %} - {% if o.status != o.STATUS.NENI_CHYBA %} - - {% endif %} - {% if o.status != o.STATUS.K_ZANESENI %} - - {% endif %} -
- - - {% if o.status == 'opraveno' or o.status == 'neni_chyba' %} - - {% else %} - - {% endif %} - -
- - -
-
-
- {% endfor %} - - - - diff --git a/korektury/views.py b/korektury/views.py index 93cffb7e..f077f297 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -52,7 +52,7 @@ class KorekturySeskupeneListView(KorekturyAktualniListView): ### Korektury class KorekturyView(generic.TemplateView): model = Oprava - template_name = 'korektury/opraf.html' + template_name = 'korektury/korekturovatko/htmlstrana.html' def setup(self, request, *args, **kwargs): super().setup(request, *args, **kwargs) @@ -121,7 +121,7 @@ class KorekturyView(generic.TemplateView): context = self.get_context_data() context['scroll'] = scroll context['autor'] = autor - return render(request, 'korektury/opraf.html',context) + return render(request, 'korektury/korekturovatko/htmlstrana.html', context) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) From 7906c87733a7391ac4686c9c39ecdf0a318b7639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 12 Dec 2024 12:50:56 +0100 Subject: [PATCH 13/68] =?UTF-8?q?Zan=C3=A1=C5=A1en=C3=AD=20a=20zastaral?= =?UTF-8?q?=C3=A9=20pomoc=C3=AD=20atributu=20m=C3=ADsto=20t=C5=99=C3=ADdy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 18 ++++++++++++------ .../korektury/korekturovatko/htmlstrana.html | 6 +++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index d5b21da2..2be943fe 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -1,14 +1,20 @@ -body, -.adding{ +.textzanaseni { display:none; } +.textzastarale { display:none; } + +body[data-status="pridavani"] { background: #f3f3f3; - color: black; } -.comitting -{ + +body[data-status="zanaseni"] { background: yellow; + + .textzanaseni { display: unset; } } -.deprecated { + +body[data-status="zastarale"] { background: red; + + .textzastarale { display: unset; } } img{background:white;} diff --git a/korektury/templates/korektury/korekturovatko/htmlstrana.html b/korektury/templates/korektury/korekturovatko/htmlstrana.html index 1f95769c..acac7ee9 100644 --- a/korektury/templates/korektury/korekturovatko/htmlstrana.html +++ b/korektury/templates/korektury/korekturovatko/htmlstrana.html @@ -8,12 +8,12 @@ Korektury {{pdf.nazev}} - +

Korektury {{pdf.nazev}}

- {% if pdf.status == 'zanaseni' %}

Probíhá zanášení korektur, zvažte, zda chcete přidávat nové

{% endif %} - {% if pdf.status == 'zastarale' %}

Toto PDF je již zastaralé, nepřidávejte nové korektury

{% endif %} +

Probíhá zanášení korektur, zvažte, zda chcete přidávat nové

+

Toto PDF je již zastaralé, nepřidávejte nové korektury

{{pdf.komentar}}
From 341ae7ce45380bfba0f559c2869eae4e99998a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 12 Dec 2024 12:51:32 +0100 Subject: [PATCH 14/68] =?UTF-8?q?Rozli=C5=A1en=C3=AD=20lok=C3=A1ln=C3=ADho?= =?UTF-8?q?/testovac=C3=ADho/produk=C4=8Dn=C3=ADho=20webu=20v=20korekturov?= =?UTF-8?q?=C3=A1tku?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index 2be943fe..77b62d52 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -140,3 +140,22 @@ form { margin-top: 3px; } +/**** ROZLIŠENÍ MEZI LOKÁLNÍM, TESTOVACÍM A PRODUKČNÍM WEBEM ****/ +body.localweb, body.testweb, body.suprodweb { + &:before, &:after { + content: ""; + position: fixed; + width: 20px; + height: 100%; + top: 0; + z-index: -1000; + } + + &:before { left: 0; } + &:after { right: 0; } +} + +body.localweb { &:before, &:after { background: greenyellow; } } +body.testweb { &:before, &:after { background: darkorange; } } +body.suprodweb { &:before, &:after { background: red; } } +/****************************************************************/ From dd86fc1fcb8243b746bd6c202f61571d779b3be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 12 Dec 2024 13:52:55 +0100 Subject: [PATCH 15/68] =?UTF-8?q?Dynamick=C3=BD=20update=20stavu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/api/urls.py | 7 ++++ korektury/api/views.py | 20 +++++++++++ .../korekturovatko/_zmena_stavu.html | 35 +++++++++++++++++-- korektury/urls.py | 4 +++ 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 korektury/api/urls.py create mode 100644 korektury/api/views.py diff --git a/korektury/api/urls.py b/korektury/api/urls.py new file mode 100644 index 00000000..23ac8559 --- /dev/null +++ b/korektury/api/urls.py @@ -0,0 +1,7 @@ +from django.urls import path +from personalni.utils import org_required +from . import views + +urlpatterns = [ + path('korektury/api//stav', org_required(views.korektury_stav_view), name='korektury_api_pdf_stav'), +] diff --git a/korektury/api/views.py b/korektury/api/views.py new file mode 100644 index 00000000..358a3502 --- /dev/null +++ b/korektury/api/views.py @@ -0,0 +1,20 @@ +from django.http import HttpResponseForbidden, JsonResponse +from django.shortcuts import get_object_or_404 +from django.views.decorators.csrf import csrf_exempt + +from rest_framework import serializers + +from korektury.utils import send_email_notification_komentar +from korektury.models import Oprava, KorekturovanePDF, Komentar +from personalni.models import Organizator, Osoba + + +def korektury_stav_view(request, pdf_id: int, **kwargs): + q = request.POST + pdf = get_object_or_404(KorekturovanePDF, id=pdf_id) + status = q.get('state') + if status is not None: + assert status in KorekturovanePDF.STATUS.values + pdf.status = status + pdf.save() + return JsonResponse({'status': pdf.status}) diff --git a/korektury/templates/korektury/korekturovatko/_zmena_stavu.html b/korektury/templates/korektury/korekturovatko/_zmena_stavu.html index e0415019..d2cb9bec 100644 --- a/korektury/templates/korektury/korekturovatko/_zmena_stavu.html +++ b/korektury/templates/korektury/korekturovatko/_zmena_stavu.html @@ -1,9 +1,8 @@

Změnit stav PDF:

Aktuální: {{pdf.status}}
-
+ {% csrf_token %} - Přidávání korektur
Zanášení korektur @@ -12,3 +11,35 @@
+ + + diff --git a/korektury/urls.py b/korektury/urls.py index cf45ea8f..6dc00a4e 100644 --- a/korektury/urls.py +++ b/korektury/urls.py @@ -1,4 +1,6 @@ from django.urls import path +from django.urls import include + from personalni.utils import org_required from . import views @@ -7,4 +9,6 @@ urlpatterns = [ path('korektury/neseskupene/', org_required(views.KorekturyAktualniListView.as_view()), name='korektury_neseskupene_list'), path('korektury/zastarale/', org_required(views.KorekturyZastaraleListView.as_view()), name='korektury_stare_list'), path('korektury//', org_required(views.KorekturyView.as_view()), name='korektury'), + + path('api/', include('korektury.api.urls')), ] From ee69bf4c4f8ac92f8fe7fef5a5885d66225cd6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 20 Jan 2025 18:38:47 +0100 Subject: [PATCH 16/68] =?UTF-8?q?Drobn=C3=BD=20=C3=BAklid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 38 ++----------------- .../korekturovatko/__edit_komentar.html | 2 +- .../korektury/korekturovatko/__komentar.html | 4 +- .../korektury/korekturovatko/__oprava.html | 4 +- 4 files changed, 9 insertions(+), 39 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 08b6149e..eb319459 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -22,7 +22,6 @@ function place_comments_one_div(img_id, comments) } }); - //console.log("w:" + w); for (c in comments_sorted) { var id = comments_sorted[c][0]; var x = comments_sorted[c][1]; @@ -53,13 +52,8 @@ function place_comments_one_div(img_id, comments) var bott = el.offsetTop + el.offsetHeight; bott_max = ( bott_max > bott ) ? bott_max : bott; - - //console.log( "par.w:" + par.style.width); - } if( par.offsetHeight < bott_max ) { - //par.style.height = bott_max; - //alert("preteklo to:"+ par.offsetHeight +",mx:" + bott_max ); par.style.height = bott_max; } @@ -74,12 +68,9 @@ function place_comments() { // ctrl-enter submits form function textarea_onkey(ev) { - //console.log("ev:" + ev.keyCode + "," + ev.ctrlKey); if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) { var form = document.getElementById('commform'); - if( form ) { - save_scroll(form); - //form.action =''; + if( form ) { form.submit(); } return true; @@ -155,7 +146,7 @@ function box_edit(oid, action) var text; if (action == 'update') { var text_el = document.getElementById(oid + '-text'); - text = text_el.textContent; // FIXME původně tu bylo innerHTML.unescapeHTML() + text = text_el.textContent; } else { text = ''; @@ -164,7 +155,6 @@ function box_edit(oid, action) var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); var divbox = document.getElementById(oid); - //alert('not yet 2:' + text + text_el); // + divpointer.style.top "x" + divpo ); id = oid.substring(2); return show_form(divbox.img_id, dx, dy, id, text, action); } @@ -177,7 +167,7 @@ function update_comment(oid,ktid) var dy = parseInt(divpointer.style.top); var divbox = document.getElementById(oid); - var text = document.getElementById(ktid).textContent; // FIXME původně tu bylo innerHTML.unescapeHTML() + var text = document.getElementById(ktid).textContent; return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment'); } @@ -225,7 +215,6 @@ function show_form(img_id, dx, dy, id, text, action) { function box_onmouseover(box) { - var id = box.id; var pointer = document.getElementById(box.id + '-pointer'); pointer.classList.remove('pointer'); pointer.classList.add('pointer-hi'); @@ -233,20 +222,11 @@ function box_onmouseover(box) function box_onmouseout(box) { - var id = box.id; var pointer = document.getElementById(box.id + '-pointer'); pointer.classList.remove('pointer-hi'); pointer.classList.add('pointer'); } -function save_scroll(form) -{ - //alert('save_scroll:' + document.body.scrollTop); - form.scroll.value = document.body.scrollTop; - //alert('save_scroll:' + form.scroll.value); - return true; -} - function toggle_corrections(aclass) { var stylesheets = document.styleSheets; @@ -271,16 +251,6 @@ function toggle_corrections(aclass) } } place_comments(); - + } - -String.prototype.unescapeHTML = function () { - return( - this.replace(/&/g,'&'). - replace(/>/g,'>'). - replace(/</g,'<'). - replace(/"/g,'"') - ); -}; - diff --git a/korektury/templates/korektury/korekturovatko/__edit_komentar.html b/korektury/templates/korektury/korekturovatko/__edit_komentar.html index 7e6462ba..067bcd03 100644 --- a/korektury/templates/korektury/korekturovatko/__edit_komentar.html +++ b/korektury/templates/korektury/korekturovatko/__edit_komentar.html @@ -1,5 +1,5 @@
-
+ {% csrf_token %} diff --git a/korektury/templates/korektury/korekturovatko/__komentar.html b/korektury/templates/korektury/korekturovatko/__komentar.html index 8e95374f..50f2042c 100644 --- a/korektury/templates/korektury/korekturovatko/__komentar.html +++ b/korektury/templates/korektury/korekturovatko/__komentar.html @@ -5,7 +5,7 @@
{{k.autor}}
- + {% csrf_token %} @@ -21,4 +21,4 @@
{{k.text|linebreaks}}
- \ No newline at end of file + diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index d3b2f3fd..321bd81d 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -19,7 +19,7 @@
- + {% csrf_token %} @@ -66,4 +66,4 @@
- \ No newline at end of file + From 3b747729498853f7d4d8799d5b1f21ed1cdcc28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 20 Jan 2025 19:12:27 +0100 Subject: [PATCH 17/68] =?UTF-8?q?P=C5=99eh=C3=A1zen=C3=AD=20JavaScriptov?= =?UTF-8?q?=C3=BDch=20v=C4=9Bc=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 92 ------------------- .../korekturovatko/__edit_komentar.html | 67 ++++++++++++++ .../korekturovatko/_schovani_korektur.html | 30 +++++- 3 files changed, 96 insertions(+), 93 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index eb319459..d299b56e 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -65,30 +65,6 @@ function place_comments() { } } -// ctrl-enter submits form -function textarea_onkey(ev) -{ - if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) { - var form = document.getElementById('commform'); - if( form ) { - form.submit(); - } - return true; - } - return false; -} - -//hide comment form -function close_commform() { - var formdiv = document.getElementById('commform-div'); - if( formdiv == null ) { - alert("form null"); - return true; - } - formdiv.style.display = 'none'; - return false; -} - // show comment form, when clicked to image function img_click(element, ev) { var body_class = document.body.className; @@ -172,47 +148,6 @@ function update_comment(oid,ktid) return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment'); } -//fill up comment form and show him -function show_form(img_id, dx, dy, id, text, action) { - var form = document.getElementById('commform'); - var formdiv = document.getElementById('commform-div'); - var textarea = document.getElementById('commform-text'); - var inputX = document.getElementById('commform-x'); - var inputY = document.getElementById('commform-y'); - var inputImgId = document.getElementById('commform-img-id'); - var inputId = document.getElementById('commform-id'); - var inputAction = document.getElementById('commform-action'); - var img = document.getElementById(img_id); - - if( formdiv == null || textarea == null ) { - alert("form null"); - return 1; - } - - //form.action = "#" + img_id; - - // set hidden values - inputX.value = dx; - inputY.value = dy; - inputImgId.value = img_id; - inputId.value = id; - inputAction.value = action; - textarea.value = text; - - //textarea.value = "dxy:"+ dx + "x" + dy + "\n" + 'id:' + img_id; - - // show form - formdiv.style.display = 'block'; - formdiv.style.left = dx; - formdiv.style.top = dy; - - img.parentNode.appendChild(formdiv); - - textarea.focus(); - - return true; -} - function box_onmouseover(box) { var pointer = document.getElementById(box.id + '-pointer'); @@ -227,30 +162,3 @@ function box_onmouseout(box) pointer.classList.add('pointer'); } -function toggle_corrections(aclass) -{ - var stylesheets = document.styleSheets; - var ssheet = null; - for (var i=0;i + + diff --git a/korektury/templates/korektury/korekturovatko/_schovani_korektur.html b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html index 4d1ffd31..72a503d4 100644 --- a/korektury/templates/korektury/korekturovatko/_schovani_korektur.html +++ b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html @@ -20,4 +20,32 @@ Zobrazit: onchange="toggle_corrections('k_zaneseni')" checked> -
\ No newline at end of file +
+ + From 5563eb681ca1e2f89b8e1eaa8d1c9c7a6e812868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 20 Jan 2025 21:06:33 +0100 Subject: [PATCH 18/68] =?UTF-8?q?Status=20korektury=20jako=20atribut=20a?= =?UTF-8?q?=20ne=20t=C5=99=C3=ADda?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 8 ++++---- .../templates/korektury/korekturovatko/__oprava.html | 10 +++++++--- .../korektury/korekturovatko/_schovani_korektur.html | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index 77b62d52..b9238953 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -20,16 +20,16 @@ body[data-status="zastarale"] { img{background:white;} /* Barvy korektur */ -.k_oprave { +[data-opravastatus="k_oprave"] { --rgb: 255, 0, 0; } -.opraveno { +[data-opravastatus="opraveno"] { --rgb: 0, 0, 255; } -.neni_chyba { +[data-opravastatus="neni_chyba"] { --rgb: 128, 128, 128; } -.k_zaneseni { +[data-opravastatus="k_zaneseni"] { --rgb: 0, 255, 0; } diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 321bd81d..da287f59 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -2,12 +2,16 @@
+ class='pointer' + data-opravastatus="{{o.status}}" +>
+ onmouseout='box_onmouseout(this)' +>
diff --git a/korektury/templates/korektury/korekturovatko/_schovani_korektur.html b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html index 72a503d4..607e3cac 100644 --- a/korektury/templates/korektury/korekturovatko/_schovani_korektur.html +++ b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html @@ -38,7 +38,7 @@ Zobrazit: } for (var i=0;i Date: Mon, 20 Jan 2025 21:45:37 +0100 Subject: [PATCH 19/68] =?UTF-8?q?Skr=C3=BDv=C3=A1n=C3=AD=20korektur=20pomo?= =?UTF-8?q?c=C3=AD=20atributu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 6 ++++++ korektury/static/korektury/opraf.js | 15 ++------------- .../korektury/korekturovatko/__oprava.html | 7 ++++--- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index b9238953..48d7e9a3 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -33,6 +33,12 @@ img{background:white;} --rgb: 0, 255, 0; } +[data-opravazobrazit="false"] { + .corr-body { display: none; } + .corr-buttons { display: none; } + .toggle-button { transform: rotate(180deg); } +} + .pointer-hi, .pointer{ position:absolute; diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index d299b56e..7e22bfad 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -96,19 +96,8 @@ function img_click(element, ev) { return show_form(img_id, dx, dy, '', '', '', ''); } // hide or show text of correction -function toggle_visibility(oid){ - var buttondiv = document.getElementById(oid+'-buttons') - var text = document.getElementById(oid+'-body'); - var toggleimg = document.getElementById(oid+'-toggleimg'); - if (text.style.display == 'none'){ - text.style.display = 'block'; - buttondiv.style.display = 'inline-block'; - toggleimg.style.transform = ""; - }else { - text.style.display = 'none'; - buttondiv.style.display = 'none'; - toggleimg.style.transform = "rotate(180deg)"; - } +function toggle_visibility(oprava){ + oprava.dataset.opravazobrazit = oprava.dataset.opravazobrazit !== 'true'; for (var i=0;i @@ -22,7 +23,7 @@
- +
{% csrf_token %} @@ -64,8 +65,8 @@ {% endif %} - From ad2d1e676c406c7480def121c96bbe5cca09a2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 20 Jan 2025 22:11:02 +0100 Subject: [PATCH 20/68] =?UTF-8?q?Zobrazen=C3=AD=20tla=C4=8D=C3=ADtek=20pod?= =?UTF-8?q?le=20atributu=20(ne=20v=20podle=20stavu=20v=20templatech)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 12 ++++++++++++ .../korektury/korekturovatko/__oprava.html | 15 ++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index 48d7e9a3..69b32636 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -22,15 +22,27 @@ img{background:white;} /* Barvy korektur */ [data-opravastatus="k_oprave"] { --rgb: 255, 0, 0; + + [value="k_oprave"] { display: none } + [value="notcomment"] { display: none } } [data-opravastatus="opraveno"] { --rgb: 0, 0, 255; + + [value="opraveno"] { display: none } + [value="comment"] { display: none } } [data-opravastatus="neni_chyba"] { --rgb: 128, 128, 128; + + [value="neni_chyba"] { display: none } + [value="comment"] { display: none } } [data-opravastatus="k_zaneseni"] { --rgb: 0, 255, 0; + + [value="k_zaneseni"] { display: none } + [value="notcomment"] { display: none } } [data-opravazobrazit="false"] { diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 3ac76bd2..8f388183 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -32,37 +32,26 @@ - {% if o.status != o.STATUS.K_OPRAVE %} - {% endif %} - {% if o.status != o.STATUS.OPRAVENO %} - {% endif %} - {% if o.status != o.STATUS.NENI_CHYBA %} - {% endif %} - {% if o.status != o.STATUS.K_ZANESENI %} - {% endif %} - {% if o.status == 'opraveno' or o.status == 'neni_chyba' %} - - {% else %} - - {% endif %}
diff --git a/korektury/templates/korektury/korekturovatko/__komentar.html b/korektury/templates/korektury/korekturovatko/__komentar.html index 50f2042c..b814e446 100644 --- a/korektury/templates/korektury/korekturovatko/__komentar.html +++ b/korektury/templates/korektury/korekturovatko/__komentar.html @@ -8,7 +8,6 @@
{% csrf_token %} - - From 370dd7d841966514ea7751e75afcb57f63c3966a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 08:12:42 +0100 Subject: [PATCH 29/68] =?UTF-8?q?U=C5=BE=20nem=C3=A1me=20text=20v=20oprav?= =?UTF-8?q?=C4=9B,=20tak=C5=BEe=20nem=C3=A1=20smysl=20ho=20editovat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 15 +++------------ .../korektury/korekturovatko/__oprava.html | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 78cee8d2..c7403393 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -98,23 +98,14 @@ function toggle_visibility(oprava){ } } -// show comment form, when 'edit' or 'comment' button pressed -function box_edit(op, action) +// show comment form, when 'comment' button pressed +function comment(op) { var divpointer = document.getElementById(op.id + '-pointer'); - var text; - if (action == 'update') { - var text_el = document.getElementById(op.id + '-text'); - text = text_el.textContent; - - } else { - text = ''; - } - var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); - return show_form(op.img_id, dx, dy, op.dataset.opid, text, action); + return show_form(op.img_id, dx, dy, op.dataset.opid, "", "comment"); } // 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 a2a9bbce..32c6225f 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -49,7 +49,7 @@ - From d5c57da92170a4db180122b444c45c28b004ff7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 08:17:12 +0100 Subject: [PATCH 30/68] =?UTF-8?q?=C4=8C=C3=A1ra=20(pointer)=20jako=20atrib?= =?UTF-8?q?ut=20opravy=20m=C3=ADsto=20grepov=C3=A1n=C3=AD=20"opid-pointer"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index c7403393..38449bcd 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -44,6 +44,7 @@ function place_comments_one_div(img_id, comments) elp.style.width = w - x + w_skip; elp.style.height = pointer_min_h + delta_y; + el.pointer = elp; el.img_id = img_id; el.style.position = 'absolute'; el.style.left = w + w_skip; @@ -101,8 +102,7 @@ function toggle_visibility(oprava){ // show comment form, when 'comment' button pressed function comment(op) { - var divpointer = document.getElementById(op.id + '-pointer'); - + var divpointer = op.pointer; var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); return show_form(op.img_id, dx, dy, op.dataset.opid, "", "comment"); @@ -111,11 +111,10 @@ function comment(op) // show comment form when 'update-comment' button pressed function update_comment(oid,ktid) { - var divpointer = document.getElementById(oid + '-pointer'); + var divbox = document.getElementById(oid); + var divpointer = divbox.pointer; var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); - - var divbox = document.getElementById(oid); var text = document.getElementById(ktid).textContent; return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment'); @@ -123,14 +122,14 @@ function update_comment(oid,ktid) function box_onmouseover(box) { - var pointer = document.getElementById(box.id + '-pointer'); + var pointer = box.pointer; pointer.classList.remove('pointer'); pointer.classList.add('pointer-hi'); } function box_onmouseout(box) { - var pointer = document.getElementById(box.id + '-pointer'); + var pointer = box.pointer; pointer.classList.remove('pointer-hi'); pointer.classList.add('pointer'); } From 3e2469fc45841f144359dee8e1effffcb72ed78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 08:20:34 +0100 Subject: [PATCH 31/68] =?UTF-8?q?Tady=20je=20t=C4=9Bch=20pr=C3=A1zn=C3=BDc?= =?UTF-8?q?h=20string=C5=AF=20n=C4=9Bjak=20moc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 38449bcd..4266b6c7 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -89,7 +89,7 @@ function img_click(element, ev) { dy = ev.offsetY; } var img_id = element.id; - return show_form(img_id, dx, dy, '', '', '', ''); + return show_form(img_id, dx, dy, '', '', ''); } // hide or show text of correction function toggle_visibility(oprava){ From b637aed7ab35b8f2d68a451d1cfdf37dc627edde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 08:22:34 +0100 Subject: [PATCH 32/68] =?UTF-8?q?Zapomenut=C3=BD=20switch=20podle=20docume?= =?UTF-8?q?nt.body.class=20m=C3=ADsto=20podle=20atributu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 4266b6c7..2a88054b 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -67,13 +67,12 @@ function place_comments() { // show comment form, when clicked to image function img_click(element, ev) { - var body_class = document.body.className; - switch(body_class){ - case "comitting": + switch(document.body.dataset.status){ + case "zanaseni": if (!confirm("Právě jsou zanášeny korektury, opravdu chcete přidat novou?")) return; break; - case "deprecated": + case "zastarale": if (!confirm("Toto PDF je již zastaralé, opravdu chcete vytvořit korekturu?")) return; break; From 291f39990d6cb0f10884255f018a347aef93660d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 09:12:36 +0100 Subject: [PATCH 33/68] =?UTF-8?q?Vy=C4=8Di=C5=A1t=C4=9Bn=C3=AD=20ID=C4=8De?= =?UTF-8?q?k=20v=20html=20opravy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/korektury/korekturovatko/__oprava.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 32c6225f..c2a29503 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -15,8 +15,7 @@ onmouseout='box_onmouseout(this)' > -
- +
{% for k in o.komentare %} {% include "korektury/korekturovatko/__komentar.html" %}
@@ -24,11 +23,11 @@
- + {% csrf_token %} - + @@ -55,7 +54,7 @@ From 87466ce2b62b3ba6e3bb5b28c852db79169fb2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 09:23:20 +0100 Subject: [PATCH 34/68] box -> oprava --- korektury/static/korektury/opraf.js | 8 ++++---- .../templates/korektury/korekturovatko/__oprava.html | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 2a88054b..f566086e 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -119,16 +119,16 @@ function update_comment(oid,ktid) return show_form(divbox.img_id, dx, dy, 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.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.add('pointer'); } diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index c2a29503..b8a48452 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -11,8 +11,8 @@ data-opravastatus="{{o.status}}" data-opravazobrazit="true" data-opid="{{o.id}}" - onmouseover='box_onmouseover(this)' - onmouseout='box_onmouseout(this)' + onmouseover='oprava_onmouseover(this)' + onmouseout='oprava_onmouseout(this)' >
From e257f31ea59491ebd77aeb7f7c58a4e54432d1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 09:28:46 +0100 Subject: [PATCH 35/68] =?UTF-8?q?x,y=20ulo=C5=BEen=C3=A9=20v=20oprav=C4=9B?= =?UTF-8?q?=20(nemus=C3=ADme=20tahat=20z=20=C4=8D=C3=A1ry=20(pointru))?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index f566086e..dfe24684 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -46,6 +46,8 @@ function place_comments_one_div(img_id, comments) el.pointer = elp; el.img_id = img_id; + el.x = x + el.y = y el.style.position = 'absolute'; el.style.left = w + w_skip; el.style.top = y + delta_y; @@ -101,22 +103,16 @@ function toggle_visibility(oprava){ // show comment form, when 'comment' button pressed function comment(op) { - var divpointer = op.pointer; - var dx = parseInt(divpointer.style.left); - var dy = parseInt(divpointer.style.top); - return show_form(op.img_id, dx, dy, op.dataset.opid, "", "comment"); + return show_form(op.img_id, op.x, op.y, op.dataset.opid, "", "comment"); } // show comment form when 'update-comment' button pressed function update_comment(oid,ktid) { 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; - 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 oprava_onmouseover(op) From 7da9aa5fe34c7c2e74d5908235a1c2456b7acdb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 09:40:42 +0100 Subject: [PATCH 36/68] =?UTF-8?q?Upozor=C5=88ovat=20p=C5=99i=20zav=C3=ADr?= =?UTF-8?q?=C3=A1n=C3=AD=20ok=C3=A9nka=20editace=20koment=C3=A1=C5=99e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 1 - .../templates/korektury/korekturovatko/__edit_komentar.html | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index 4353b679..c0a44034 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -102,7 +102,6 @@ form { top:0px; } #commform-div { - display: none; position: absolute; background-color: white; border: 1px solid; diff --git a/korektury/templates/korektury/korekturovatko/__edit_komentar.html b/korektury/templates/korektury/korekturovatko/__edit_komentar.html index 579ac1db..c6ca8422 100644 --- a/korektury/templates/korektury/korekturovatko/__edit_komentar.html +++ b/korektury/templates/korektury/korekturovatko/__edit_komentar.html @@ -1,4 +1,4 @@ -
+
Date: Tue, 21 Jan 2025 10:06:11 +0100 Subject: [PATCH 38/68] =?UTF-8?q?Nepou=C5=BE=C3=ADvan=C3=A1=20css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index e1a22889..eb3afd41 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -122,26 +122,14 @@ form { .oprava button, -.oprava img, -.box-done button, -.box-done img, -.box-ready button, -.box-ready img, -.box-wontfix button, -.box-wontfix img{ +.oprava img { border: 1px solid white; background-color:transparent; margin:0; padding: 1px; } .oprava button:hover, -.oprava img:hover, -.box-done img:hover, -.box-done button:hover, -.box-ready img:hover, -.box-ready button:hover, -.box-wontfix img:hover, -.box-wontfix button:hover{ +.oprava img:hover { border: 1px solid black; } From 1ff69f943eea9ff6d6910045c4ce05f28d35c51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 10:15:42 +0100 Subject: [PATCH 39/68] =?UTF-8?q?Uhlazen=C3=AD=20CSS=20korekturov=C3=A1tka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 93 ++++++++++++++-------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index eb3afd41..c72893ce 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -1,20 +1,22 @@ .textzanaseni { display:none; } .textzastarale { display:none; } -body[data-status="pridavani"] { - background: #f3f3f3; -} +body { + &[data-status="pridavani"] { + background: #f3f3f3; + } -body[data-status="zanaseni"] { - background: yellow; + &[data-status="zanaseni"] { + background: yellow; - .textzanaseni { display: unset; } -} + .textzanaseni { display: unset; } + } -body[data-status="zastarale"] { - background: red; + &[data-status="zastarale"] { + background: red; - .textzastarale { display: unset; } + .textzastarale { display: unset; } + } } img{background:white;} @@ -45,12 +47,14 @@ img{background:white;} [value="notcomment"] { display: none } } +/* Skrývání korektur */ [data-opravazobrazit="false"] { .corr-body { display: none; } .corr-buttons { display: none; } .toggle-button { transform: rotate(180deg); } } +/* Čára od textu k místu korektury */ .pointer-hi, .pointer{ position:absolute; @@ -58,26 +62,21 @@ img{background:white;} border-left: 2px solid yellow; border-bottom: 2px solid yellow; border-color: rgb(var(--rgb),var(--alpha)); + pointer-events: none; } +/* Zvýraznění čáry při najetí na korekturu */ .pointer { border-width: 1px; --alpha: 0.35; - pointer-events: none; } .pointer-hi { border-width: 3px; --alpha: 1; - pointer-events: none; } - - -.oprava:hover{ - border-width:3px; - margin: 0px; -} +/* Korektura samotná */ .oprava { margin: 1px; background-color: white; @@ -87,7 +86,34 @@ img{background:white;} border: 2px solid black; border-radius: 10px; border-color: rgb(var(--rgb)); + + &:hover { + border-width:3px; + margin: 0px; + } + + button, img { + border: 1px solid white; + background-color:transparent; + margin:0; + padding: 1px; + + &:hover { + border: 1px solid black; + } + } } + +.corr-header { + overflow: auto; +} + +.author { + font-weight: bold; + float: left; + margin-top: 3px; +} + form { display:inline; } @@ -101,6 +127,8 @@ form { left:0px; top:0px; } + +/* Přidávání korektury / úprava komentáře */ #commform-div { position: absolute; background-color: white; @@ -116,37 +144,8 @@ form { background-color: white; opacity: 80%; } -.close-button{ - background-color: yellow; -} -.oprava button, -.oprava img { - border: 1px solid white; - background-color:transparent; - margin:0; - padding: 1px; -} -.oprava button:hover, -.oprava img:hover { - border: 1px solid black; -} - -.comment hr { - height: 0px; -} - -.corr-header { - overflow: auto; -} - -.author { - font-weight: bold; - float: left; - margin-top: 3px; -} - /**** ROZLIŠENÍ MEZI LOKÁLNÍM, TESTOVACÍM A PRODUKČNÍM WEBEM ****/ body.localweb, body.testweb, body.suprodweb { &:before, &:after { From ce2d183446ce273e139a75398bd562166ece8458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 10:23:48 +0100 Subject: [PATCH 40/68] =?UTF-8?q?Je=C5=A1t=C4=9B=20jedno=20uhlazen=C3=AD?= =?UTF-8?q?=20CSS=20korekturov=C3=A1tka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index c72893ce..bbe68ddb 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -58,10 +58,9 @@ img{background:white;} .pointer-hi, .pointer{ position:absolute; - /*border-bottom-left-radius: 10px; */ - border-left: 2px solid yellow; - border-bottom: 2px solid yellow; - border-color: rgb(var(--rgb),var(--alpha)); + border-bottom-left-radius: 10px; + border-left: 2px solid rgb(var(--rgb),var(--alpha)); + border-bottom: 2px solid rgb(var(--rgb),var(--alpha)); pointer-events: none; } @@ -80,16 +79,14 @@ img{background:white;} .oprava { margin: 1px; background-color: white; - width:300px; - /*position:absolute;*/ + width: 300px; padding: 3px; - border: 2px solid black; + border: 2px solid rgb(var(--rgb)); border-radius: 10px; - border-color: rgb(var(--rgb)); &:hover { border-width:3px; - margin: 0px; + margin: 0; } button, img { @@ -124,24 +121,18 @@ form { .imgdiv { position:relative; - left:0px; - top:0px; + left:0; + top:0; } /* Přidávání korektury / úprava komentáře */ #commform-div { position: absolute; background-color: white; - border: 1px solid; padding: 3px; - /* - width: 310; - height: 220; - */ z-index: 10; border: 4px solid red; border-radius: 10px; - background-color: white; opacity: 80%; } From 4006ecd6b82e6dd18e460452ae31d2e420dabc52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 10:24:43 +0100 Subject: [PATCH 41/68] =?UTF-8?q?A=20je=C5=A1t=C4=9B=20jedno=20uhlazen?= =?UTF-8?q?=C3=AD=20CSS=20korekturov=C3=A1tka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index bbe68ddb..46fdeffe 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -99,26 +99,27 @@ img{background:white;} border: 1px solid black; } } -} -.corr-header { - overflow: auto; -} + .corr-header { + overflow: auto; + } -.author { - font-weight: bold; - float: left; - margin-top: 3px; + .author { + font-weight: bold; + float: left; + margin-top: 3px; + } + + .float-right{ + float:right; + } } form { display:inline; } -.float-right{ - float:right; -} - +/* Zobrazované PDF */ .imgdiv { position:relative; left:0; From 4a35a63f31881479e9d55c2d4ebc68fba276348d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 10:49:14 +0100 Subject: [PATCH 42/68] =?UTF-8?q?Zbaven=C3=AD=20se=20deprecated=20v=C4=9Bc?= =?UTF-8?q?i?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../korektury/korekturovatko/__edit_komentar.html | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/korektury/templates/korektury/korekturovatko/__edit_komentar.html b/korektury/templates/korektury/korekturovatko/__edit_komentar.html index c6ca8422..eecb980a 100644 --- a/korektury/templates/korektury/korekturovatko/__edit_komentar.html +++ b/korektury/templates/korektury/korekturovatko/__edit_komentar.html @@ -5,7 +5,7 @@
- +
@@ -17,17 +17,15 @@ diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 33a47844..8849b7d9 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -1,63 +1,148 @@ {% load static %} -
-
-
+ +
-
- {% for k in o.komentare %} - {% include "korektury/korekturovatko/__komentar.html" %} -
- {% endfor %} + {# {% for k in o.komentare %} {% include "korektury/korekturovatko/__komentar.html" %}
{% endfor %} #}
+
- - - - {% csrf_token %} - + + + + + + + - - - - - - + + + - - - - - +
+ + diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html index ee22f38b..48259c19 100644 --- a/korektury/templates/korektury/korekturovatko/_main.html +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -3,10 +3,11 @@ {% for i in img_indexes %}
Strana {{ i|add:1 }}
@@ -14,34 +15,82 @@ {% endfor %} -{% for o in opravy %} - {% include "korektury/korekturovatko/__oprava.html" %} -{% endfor %} +{# {% for o in opravy %} {% include "korektury/korekturovatko/__oprava.html" %} {% endfor %} #} +{% include "korektury/korekturovatko/__oprava.html" %} +{% include "korektury/korekturovatko/__komentar.html" %} + + + + From e205ca52d32e148bf74e3ae6297a0e4f8147135e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 22 Jan 2025 18:38:28 +0100 Subject: [PATCH 49/68] =?UTF-8?q?Korektury=20na=C4=8Dten=C3=A9=20z=20API?= =?UTF-8?q?=20(m=C3=ADsto=20v=20templatu)=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/api/urls.py | 1 + korektury/api/views.py | 31 ++++++++++++ korektury/static/korektury/opraf.js | 31 ++++-------- .../korektury/korekturovatko/__oprava.html | 3 +- .../korektury/korekturovatko/_main.html | 50 +++++++------------ 5 files changed, 60 insertions(+), 56 deletions(-) diff --git a/korektury/api/urls.py b/korektury/api/urls.py index 6c1551ae..eb74d90f 100644 --- a/korektury/api/urls.py +++ b/korektury/api/urls.py @@ -5,4 +5,5 @@ from . import views urlpatterns = [ path('/stav', org_required(views.korektury_stav_view), name='korektury_api_pdf_stav'), path('oprava/stav', org_required(views.oprava_stav_view), name='korektury_api_oprava_stav'), + path('/opravy_a_komentare', org_required(views.opravy_a_komentare_view), name='korektury_api_opravy_a_komentare'), ] diff --git a/korektury/api/views.py b/korektury/api/views.py index 86149803..8bb610f0 100644 --- a/korektury/api/views.py +++ b/korektury/api/views.py @@ -1,5 +1,6 @@ from django.http import HttpResponseForbidden, JsonResponse from django.shortcuts import get_object_or_404 +from django.utils.html import linebreaks from django.views.decorators.csrf import csrf_exempt from rest_framework import serializers @@ -32,3 +33,33 @@ def oprava_stav_view(request, **kwargs): op.status = status op.save() return JsonResponse({'status': op.status}) + +class KomentarSerializer(serializers.ModelSerializer): + class Meta: + model = Komentar + fields = '__all__' + + def to_representation(self, instance): + ret = super().to_representation(instance) + ret["autor"] = str(instance.autor) + ret["text"] = linebreaks(ret["text"], autoescape=True) # Autora není třeba escapovat, ten se vkládá jako text. + return ret + +class OpravaSerializer(serializers.ModelSerializer): + class Meta: + model = Oprava + fields = '__all__' + + def to_representation(self, instance): + ret = super().to_representation(instance) + ret["komentare"] = [KomentarSerializer(komentar).data for komentar in instance.komentar_set.all()] + return ret + + # komentar_set = serializers.ListField(child=KomentarSerializer()) + +def opravy_a_komentare_view(request, pdf_id: int, **kwargs): + q = request.POST + + opravy = Oprava.objects.filter(pdf=pdf_id).all() + # Serializovat list je prý security vulnerability, tedy je přidán slovník pro bezpečnost + return JsonResponse({"context": [OpravaSerializer(oprava).data for oprava in opravy]}) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 4bbe689f..6b59b22e 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -1,6 +1,6 @@ function place_comments_one_div(img_id, comments) { - var img = document.getElementById(img_id); + var img = document.getElementById("img-"+img_id); if( img == null ) { return; } @@ -13,27 +13,14 @@ function place_comments_one_div(img_id, comments) var bott_max = 0; var comments_sorted = comments.sort(function (a,b) { - return a[2] - b[2]; - //pokus o hezci kladeni poiteru, ale nic moc - if( a[3] < b[3] ) { - return (a[2] + pointer_min_h)- b[2]; - } else { - return (a[2] - pointer_min_h)- b[2]; - } + return a.y - b.y; }); - for (c in comments_sorted) { - var id = comments_sorted[c][0]; - var x = comments_sorted[c][1]; - var y = comments_sorted[c][2]; - - if (!(id in opravy)) { - console.log(id) - continue; - } - var op = opravy[id]; - var el = op.htmlElement; - var elp = op.pointer; + for (const oprava of comments_sorted) { + const x = oprava.x; + const y = oprava.y; + const el = oprava.htmlElement; + const elp = oprava.pointer; if( el == null || elp == null ) { continue; @@ -67,8 +54,8 @@ function place_comments_one_div(img_id, comments) } function place_comments() { - for (var i=0; i < comments.length-1; i++) { - place_comments_one_div(comments[i][0], comments[i][1]) + for (let [img_id, opravy] of Object.entries(comments)) { + place_comments_one_div(img_id, opravy) } } diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 8849b7d9..3da50e03 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -77,7 +77,7 @@ this.x = oprava_data['x']; this.y = oprava_data['y']; - this.img_id = oprava_data['img_id']; + this.img_id = oprava_data['strana']; this.update(oprava_data); @@ -91,6 +91,7 @@ this.htmlElement.addEventListener('mouseout', _ => this.pointer.dataset.highlight = 'false'); opravy[this.id] = this; + comments[this.img_id].push(this); } update(oprava_data) { diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html index 48259c19..445a2a35 100644 --- a/korektury/templates/korektury/korekturovatko/_main.html +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -20,43 +20,27 @@ {% include "korektury/korekturovatko/__komentar.html" %} From c54e11f25a3b250f37d02ba1595e8676c0ff6280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 22 Jan 2025 19:31:42 +0100 Subject: [PATCH 50/68] =?UTF-8?q?Uhlazen=C3=AD=20JavaScriptu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 1 + korektury/static/korektury/opraf.js | 62 +++++++------------ .../korekturovatko/__edit_komentar.html | 2 +- .../korektury/korekturovatko/__oprava.html | 9 +-- 4 files changed, 27 insertions(+), 47 deletions(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index 523f7a96..515415ca 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -80,6 +80,7 @@ img{background:white;} padding: 3px; border: 2px solid rgb(var(--rgb)); border-radius: 10px; + position: absolute; &:hover { border-width:3px; diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 6b59b22e..5677deff 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -1,56 +1,40 @@ +const W_SKIP = 10; +const H_SKIP = 5; +const POINTER_MIN_H = 30; + function place_comments_one_div(img_id, comments) { - var img = document.getElementById("img-"+img_id); - if( img == null ) { - return; - } - var par = img.parentNode; - var w = img.clientWidth; - var h = img.clientHeight; - var w_skip = 10; - var h_skip = 5; - var pointer_min_h = 30; + const img = document.getElementById("img-"+img_id); + if( img == null ) return; + const comments_sorted = comments.sort((a, b) => a.y - b.y); - var bott_max = 0; - var comments_sorted = comments.sort(function (a,b) { - return a.y - b.y; + const par = img.parentNode; + const w = img.clientWidth; - }); + let bott_max = 0; for (const oprava of comments_sorted) { const x = oprava.x; const y = oprava.y; - const el = oprava.htmlElement; - const elp = oprava.pointer; + const htmlElement = oprava.htmlElement; + const pointer = oprava.pointer; - if( el == null || elp == null ) { - continue; - } + par.appendChild(pointer); + par.appendChild(htmlElement); - par.appendChild(elp); - par.appendChild(el); + const delta_y = (y > bott_max) ? 0: bott_max - y + H_SKIP; - var delta_y = (y > bott_max) ? 0: bott_max - y + h_skip; + pointer.style.left = x; + pointer.style.top = y; + pointer.style.width = w - x + W_SKIP; + pointer.style.height = POINTER_MIN_H + delta_y; - elp.style.left = x; - elp.style.top = y ; - elp.style.width = w - x + w_skip; - elp.style.height = pointer_min_h + delta_y; + htmlElement.style.left = w + W_SKIP; + htmlElement.style.top = y + delta_y; - el.pointer = elp; - el.img_id = img_id; - el.x = x - el.y = y - el.style.position = 'absolute'; - el.style.left = w + w_skip; - el.style.top = y + delta_y; - - var bott = el.offsetTop + el.offsetHeight; - bott_max = ( bott_max > bott ) ? bott_max : bott; + bott_max = Math.max(bott_max, htmlElement.offsetTop + htmlElement.offsetHeight); } - if( par.offsetHeight < bott_max ) { - par.style.height = bott_max; - } + if (par.offsetHeight < bott_max) par.style.height = bott_max; } function place_comments() { diff --git a/korektury/templates/korektury/korekturovatko/__edit_komentar.html b/korektury/templates/korektury/korekturovatko/__edit_komentar.html index 9de1d519..8d5b1771 100644 --- a/korektury/templates/korektury/korekturovatko/__edit_komentar.html +++ b/korektury/templates/korektury/korekturovatko/__edit_komentar.html @@ -38,7 +38,7 @@ //fill up comment form and show him function show_form(img_id, dx, dy, id, text, action) { - var img = document.getElementById("img-" + img_id); + const img = document.getElementById("img-" + img_id); if (commform._div.style.display !== 'none' && commform._text.value !== "" && !confirm("Zavřít předchozí okénko přidávání korektury / editace komentáře?")) return 1; diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 3da50e03..6f0eb8ed 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -91,7 +91,7 @@ this.htmlElement.addEventListener('mouseout', _ => this.pointer.dataset.highlight = 'false'); opravy[this.id] = this; - comments[this.img_id].push(this); + if (this.img_id in comments) comments[this.img_id].push(this); else alert("Někdo korekturoval stranu, která neexistuje. Dejte vědět webařům :)"); } update(oprava_data) { @@ -116,9 +116,7 @@ #toggle_visibility(){ this.zobrazit = !this.zobrazit; this.htmlElement.dataset.opravazobrazit = String(this.zobrazit); - for (let i=0;i { if (!response.ok) {alert('Něco se nepovedlo:' + response.statusText);} From f369110cd3b4161b7019176733374a4628bcf41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 22 Jan 2025 19:36:44 +0100 Subject: [PATCH 51/68] =?UTF-8?q?Str=C3=A1nky=20PDF=20zvl=C3=A1=C5=A1?= =?UTF-8?q?=C5=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../korektury/korekturovatko/__stranky.html | 50 ++++++++++++++++++ .../korektury/korekturovatko/_main.html | 51 +------------------ 2 files changed, 51 insertions(+), 50 deletions(-) create mode 100644 korektury/templates/korektury/korekturovatko/__stranky.html diff --git a/korektury/templates/korektury/korekturovatko/__stranky.html b/korektury/templates/korektury/korekturovatko/__stranky.html new file mode 100644 index 00000000..b6f9932b --- /dev/null +++ b/korektury/templates/korektury/korekturovatko/__stranky.html @@ -0,0 +1,50 @@ +{% for i in img_indexes %} +
+ Strana {{ i|add:1 }} +
+ +
+{% endfor %} + + diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html index 445a2a35..adb98c93 100644 --- a/korektury/templates/korektury/korekturovatko/_main.html +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -1,31 +1,12 @@ {% include "korektury/korekturovatko/__edit_komentar.html" %} -{% for i in img_indexes %} -
- Strana {{ i|add:1 }} -
- -
-{% 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" %} - - From 0af99d4f3ebed0ef71d60cfebbffe6c05d1ac7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 22 Jan 2025 20:23:12 +0100 Subject: [PATCH 52/68] =?UTF-8?q?Aktualizace=20v=C5=A1ech=20koment=C3=A1?= =?UTF-8?q?=C5=99=C5=AF=20jako=20funkce=20(a=20aktualizace,=20ne=20vytvo?= =?UTF-8?q?=C5=99en=C3=AD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../korektury/korekturovatko/__oprava.html | 5 +-- .../korektury/korekturovatko/_main.html | 35 ++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 6f0eb8ed..442aae06 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -58,8 +58,8 @@ class Oprava { static update_or_create(oprava_data) { const id = oprava_data['id']; - if (id in opravy) opravy[id].update(oprava_data); - else new Oprava(oprava_data); + if (id in opravy) return opravy[id].update(oprava_data); + else return new Oprava(oprava_data); } #komentare; @@ -97,6 +97,7 @@ update(oprava_data) { {# this.oprava_data = oprava_data; #} this.set_status(oprava_data['status']); + return this; }; set_status(status) { diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html index adb98c93..25ed71fb 100644 --- a/korektury/templates/korektury/korekturovatko/_main.html +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -7,21 +7,30 @@ {% include "korektury/korekturovatko/__komentar.html" %} From 95b46541c0372c8169d8c212aa3ffc09ff0ef6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 22 Jan 2025 20:28:24 +0100 Subject: [PATCH 53/68] =?UTF-8?q?Uhlazen=C3=AD=20JavaScriptu=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../korektury/korekturovatko/_schovani_korektur.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/korektury/templates/korektury/korekturovatko/_schovani_korektur.html b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html index 607e3cac..84399650 100644 --- a/korektury/templates/korektury/korekturovatko/_schovani_korektur.html +++ b/korektury/templates/korektury/korekturovatko/_schovani_korektur.html @@ -25,9 +25,9 @@ Zobrazit: diff --git a/korektury/templates/korektury/korekturovatko/__komentar.html b/korektury/templates/korektury/korekturovatko/__komentar.html index 4cf4b3a1..ed87ba40 100644 --- a/korektury/templates/korektury/korekturovatko/__komentar.html +++ b/korektury/templates/korektury/korekturovatko/__komentar.html @@ -74,7 +74,7 @@ // show comment form when 'update-comment' button pressed #update_comment() { - return show_form(this.oprava.img_id, this.oprava.x, this.oprava.y, this.id, this.#text.textContent, 'update-comment'); + return commform.show(this.oprava.img_id, this.oprava.x, this.oprava.y, this.#text.textContent, -1, this.id); } #delete_comment() { diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index 442aae06..bb330713 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -121,7 +121,7 @@ } // show comment form, when 'comment' button pressed - #comment() { return show_form(this.img_id, this.x, this.y, this.id, "", "comment"); } + #comment() { commform.show(this.img_id, this.x, this.y, "", this.id); } #zmenStavKorektury(event) { const data = new FormData(CSRF_FORM); diff --git a/korektury/templates/korektury/korekturovatko/__stranky.html b/korektury/templates/korektury/korekturovatko/__stranky.html index b6f9932b..89bcd60c 100644 --- a/korektury/templates/korektury/korekturovatko/__stranky.html +++ b/korektury/templates/korektury/korekturovatko/__stranky.html @@ -43,8 +43,8 @@ dx = ev.offsetX; dy = ev.offsetY; } - const img_id = image.id; - return show_form(img_id, dx, dy, '', '', ''); + const img_id = image.id.substring(4); + commform.show(img_id, dx, dy, ''); }); } diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html index 25ed71fb..96d91b17 100644 --- a/korektury/templates/korektury/korekturovatko/_main.html +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -11,12 +11,14 @@ * * @param {RequestInit} data * @param {Boolean} catchError + * @param pri_uspechu Akce, která se má provést při úspěchu (speciálně zavřít formulář) */ - function update_all(data={}, catchError=true) { // FIXME není mi jasné, zda v {} nemá být `cache: "no-store"`, aby prohlížeč necachoval GET. + function update_all(data={}, catchError=true, pri_uspechu=null) { // FIXME není mi jasné, zda v {} nemá být `cache: "no-store"`, aby prohlížeč necachoval GET. fetch('{% url "korektury_api_opravy_a_komentare" pdf.id %}', data) .then(response => { if (!response.ok && catchError) {alert('Něco se nepovedlo:' + response.statusText);} else response.json().then(data => { + if (pri_uspechu) pri_uspechu(); for (const oprava_data of data["context"]) { const oprava = Oprava.update_or_create(oprava_data); for (const komentar_data of oprava_data["komentare"]) { From 7237364ba57ebc12a3359ba5d3f8e5a5c4362e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 11 Feb 2025 12:03:47 +0100 Subject: [PATCH 55/68] =?UTF-8?q?Hotfix:=20chyb=C4=9Bj=C3=ADc=C3=AD=20meze?= =?UTF-8?q?ry=20za=20korekturami?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 5677deff..3963c49c 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -31,7 +31,7 @@ function place_comments_one_div(img_id, comments) htmlElement.style.left = w + W_SKIP; htmlElement.style.top = y + delta_y; - bott_max = Math.max(bott_max, htmlElement.offsetTop + htmlElement.offsetHeight); + bott_max = Math.max(bott_max, htmlElement.offsetTop + htmlElement.offsetHeight + H_SKIP); // FIXME nemám páru, proč +H_SKIP funguje, ale opravuje to bug, že nově vytvořené korektury za sebou neměly mezeru } if (par.offsetHeight < bott_max) par.style.height = bott_max; From aed8e0ea44f3d14ab7de3c3aa36dd1a397e7c80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 11 Feb 2025 12:21:22 +0100 Subject: [PATCH 56/68] =?UTF-8?q?button=20m=C3=A1=20m=C3=ADt=20asi=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/korektury/korekturovatko/__edit_komentar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/korektury/templates/korektury/korekturovatko/__edit_komentar.html b/korektury/templates/korektury/korekturovatko/__edit_komentar.html index 12041709..312d5402 100644 --- a/korektury/templates/korektury/korekturovatko/__edit_komentar.html +++ b/korektury/templates/korektury/korekturovatko/__edit_komentar.html @@ -1,7 +1,7 @@ diff --git a/korektury/templates/korektury/korekturovatko/__oprava.html b/korektury/templates/korektury/korekturovatko/__oprava.html index caaa9849..2879d2c3 100644 --- a/korektury/templates/korektury/korekturovatko/__oprava.html +++ b/korektury/templates/korektury/korekturovatko/__oprava.html @@ -71,7 +71,7 @@ #komentare; #tagy; htmlElement; pointer; - id; x; y; img_id; zobrazit = true; {# oprava_data; #} + id; x; y; img_id; status; zobrazit = true; {# oprava_data; #} constructor(oprava_data) { this.htmlElement = preoprava.cloneNode(true); @@ -120,6 +120,7 @@ }; set_status(status) { + this.status = status; this.htmlElement.dataset.opravastatus=status; this.pointer.dataset.opravastatus=status; }; diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html index 96d91b17..33211305 100644 --- a/korektury/templates/korektury/korekturovatko/_main.html +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -6,6 +6,8 @@ {% include "korektury/korekturovatko/__oprava.html" %} {% include "korektury/korekturovatko/__komentar.html" %} +{% include "korektury/korekturovatko/__dalsi_korektura.html" %} + diff --git a/korektury/templates/korektury/korekturovatko/_zmena_stavu.html b/korektury/templates/korektury/korekturovatko/_zmena_stavu.html index 169b6455..e769d159 100644 --- a/korektury/templates/korektury/korekturovatko/_zmena_stavu.html +++ b/korektury/templates/korektury/korekturovatko/_zmena_stavu.html @@ -39,6 +39,6 @@ // FIXME není mi jasné, zda v {} nemá být `cache: "no-store"`, aby prohlížeč necachoval get. - setInterval(() => fetchStav({}, false), 30000); // Každou půl minutu fetchni stav + setInterval(() => fetchStav({}, false), 120000); // Každý dvě minuty fetchni stav From c2ed4b9cc2e781ea8a71c25c92312510c9c5baca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 12 Feb 2025 13:01:06 +0100 Subject: [PATCH 66/68] =?UTF-8?q?Tla=C4=8D=C3=ADtko=20na=20refresh=20(FUJ!?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 26 +++++++++++++++++++ .../korektury/korekturovatko/_main.html | 5 ++++ 2 files changed, 31 insertions(+) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index 2f259d41..1c9b1b62 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -55,6 +55,32 @@ img{background:white;} .toggle-button { transform: rotate(180deg); } } +/* Tlačítko na aktualizaci */ + +#korektury-aktualizace { + position: absolute; + right: 10px; + top: 10px; + + border-radius: 10px; + + + /* copy-paste .button */ + margin: 10px 0 10px 0; + padding: 4px 0; /*vertikální centování textu*/ + text-align: center; + background-color: #e84e10; + color: #fffbf6; + font-size: 150%; + font-weight: bold; + font-variant: small-caps; + filter: drop-shadow(0px 5px 5px rgba(0, 0, 0, 0.4)); + + &:hover { + background-color: #df490e; + } +} + /* Čára od textu k místu korektury */ .pointer{ position:absolute; diff --git a/korektury/templates/korektury/korekturovatko/_main.html b/korektury/templates/korektury/korekturovatko/_main.html index bb49c77b..2bf74530 100644 --- a/korektury/templates/korektury/korekturovatko/_main.html +++ b/korektury/templates/korektury/korekturovatko/_main.html @@ -8,6 +8,8 @@ {% include "korektury/korekturovatko/__dalsi_korektura.html" %} + + From 83efe094b8bb98710aa8d76102d5ee02d81599b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 12 Feb 2025 13:45:12 +0100 Subject: [PATCH 67/68] =?UTF-8?q?M=C3=A9n=C4=9B=20zesv=C4=9Btlen=C3=A9=20t?= =?UTF-8?q?agy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index 1c9b1b62..7a2896e2 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -168,7 +168,7 @@ form { margin: 2px; padding: 2px; - &[data-selected="false"] { opacity: 0.5; } + &[data-selected="false"] { opacity: 0.7; } } /* Šipky na posouvání korektur */ From b81648cdc87f5e8aa514b31184d4174ef69be4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Wed, 12 Feb 2025 13:47:19 +0100 Subject: [PATCH 68/68] =?UTF-8?q?P=C5=99id=C3=A1ni=20=3Fversion=3D?= =?UTF-8?q?=E2=80=A6=20pro=20vyhozen=C3=AD=20cach=C3=AD=20prohl=C3=AD?= =?UTF-8?q?=C5=BEe=C4=8De?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/templates/korektury/korekturovatko/htmlstrana.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/korektury/templates/korektury/korekturovatko/htmlstrana.html b/korektury/templates/korektury/korekturovatko/htmlstrana.html index acac7ee9..f2e545f6 100644 --- a/korektury/templates/korektury/korekturovatko/htmlstrana.html +++ b/korektury/templates/korektury/korekturovatko/htmlstrana.html @@ -3,9 +3,9 @@ - + - + Korektury {{pdf.nazev}}