From ae31ce7c21ab0ad72a01b478b4c6fe43a252a29e Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Sun, 27 May 2018 20:22:29 +0200 Subject: [PATCH] Opravy a vylepseni v korekturovatku. - komentar lze editovat - pridan stav 'k zaneseni do TeXu' - odstraneny prochazky po DOMu --- korektury/models.py | 5 +- korektury/static/korektury/imgs/tex.png | Bin 0 -> 702 bytes korektury/static/korektury/imgs/tex.svg | 100 +++++++++++++++++++++++ korektury/static/korektury/opraf.css | 28 ++++++- korektury/static/korektury/opraf.js | 40 ++++----- korektury/templates/korektury/opraf.html | 41 +++++----- korektury/views.py | 13 ++- 7 files changed, 171 insertions(+), 56 deletions(-) create mode 100644 korektury/static/korektury/imgs/tex.png create mode 100644 korektury/static/korektury/imgs/tex.svg diff --git a/korektury/models.py b/korektury/models.py index 92c6bf41..a9a9cd07 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -112,7 +112,6 @@ class KorekturovanePDF(models.Model): # uložíme png a změněný počet stran self.convert() - @reversion.register(ignore_duplicate_revision=True) @python_2_unicode_compatible class Oprava(models.Model): @@ -135,12 +134,12 @@ class Oprava(models.Model): STATUS_K_OPRAVE = 'k_oprave' STATUS_OPRAVENO = 'opraveno' STATUS_NENI_CHYBA = 'neni_chyba' - STATUS_K_REAKCI = 'k_reakci' + 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_REAKCI, u'K reakci autora textu'), + (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) diff --git a/korektury/static/korektury/imgs/tex.png b/korektury/static/korektury/imgs/tex.png new file mode 100644 index 0000000000000000000000000000000000000000..26b3e58d66b1b49dd5c3190948215745ac451eb2 GIT binary patch literal 702 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?- ze;~~0e`pbiAz9)YQ4*Y=R#Ki=l*&+EUaps!mtCBkSdglhUz9%kosASoCrD99W=T#e zLrH3da*p7w<|XH379a03RsJNRccYbzM-Ch{;|hFMGaV$pl|qN4ZVKoQmt^NSM|G6ZS(buEp-p@H~ z*YgJ43 z<|_|m$~m_^|IM`a!g@cpi^r_R{=}q;TUQ+84%^Uae#U+B(!#6m)(w;AteAChcEwRM hJ40)|m;L9(vk&RLTlstIIiRN*JYD@<);T3K0RTqY{~7=Q literal 0 HcmV?d00001 diff --git a/korektury/static/korektury/imgs/tex.svg b/korektury/static/korektury/imgs/tex.svg new file mode 100644 index 00000000..22ad1a75 --- /dev/null +++ b/korektury/static/korektury/imgs/tex.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + tex + 2011-01-21T16:59:19 + Originally uploaded by Jose Hevia for OCAL 0.18 + https://openclipart.org/detail/109117/tex-by-anonymous + + + Anonymous + + + + + fix + keyword + librarians + tag + + + + + + + + + + + diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index ca71548a..33146e1b 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -17,6 +17,8 @@ img{background:white;} .pointer, .pointer-wontfix, .pointer-wontfix-hi, +.pointer-ready, +.pointer-ready-hi, .pointer-done, .pointer-done-hi { position:absolute; @@ -27,6 +29,7 @@ img{background:white;} .pointer-done-hi, .pointer-wontfix-hi, +.pointer-ready-hi, .pointer-hi { border-width: 3px; } @@ -48,22 +51,34 @@ img{background:white;} border-color: rgba(0, 0, 255, 1); } .pointer-wontfix { - border-color: #00F; /*IE*/ + border-color: #000; /*IE*/ border-color: rgba(128, 128, 128, 0.2); } .pointer-wontfix-hi { - border-color: #00F; /*IE*/ + border-color: #000; /*IE*/ border-color: rgba(128, 128, 128, 1); } +.pointer-ready { + border-color: #0F0; /*IE*/ + border-color: rgba(0, 255, 0, 0.2); +} +.pointer-ready-hi { + border-color: #0F0; /*IE*/ + border-color: rgba(0, 255, 0, 1); +} .box:hover, .box-done:hover, +.box-ready:hover, .box-wontfix:hover{ border-width:3px; margin: 0px; } -.box, .box-done, .box-wontfix { +.box, +.box-done, +.box-ready, +.box-wontfix { margin: 1px; background-color: white; width:300px; @@ -78,6 +93,9 @@ img{background:white;} .box-done { border-color: blue; } +.box-ready { + border-color: rgba(0,255,0,1); +} .box-wontfix { border-color: grey; } @@ -118,6 +136,8 @@ form { .box img, .box-done button, .box-done img, +.box-ready button, +.box-ready img, .box-wontfix button, .box-wontfix img{ border: 1px solid white; @@ -129,6 +149,8 @@ form { .box 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{ border: 1px solid black; diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index 1e60f52f..5cfe02e2 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -123,11 +123,9 @@ function img_click(element, ev) { return show_form(img_id, dx, dy, '', '', '', ''); } // hide or show text of correction -function toggle_visibility(button){ - var divbox = button.parentNode.parentNode.parentNode; - var id = divbox.id; - var buttondiv = document.getElementById(id+'-buttons') - var text = document.getElementById(id+'-body'); +function toggle_visibility(oid){ + var buttondiv = document.getElementById(oid+'-buttons') + var text = document.getElementById(oid+'-body'); if (text.style.display == 'none'){ text.style.display = 'block'; buttondiv.style.display = 'inline-block'; @@ -141,15 +139,13 @@ function toggle_visibility(button){ } // show comment form, when 'edit' or 'comment' button pressed -function box_edit(button, action) +function box_edit(oid, action) { - var divbox = button.parentNode.parentNode.parentNode.parentNode; - var id = divbox.id; - var divpointer = document.getElementById(divbox.id + '-pointer'); + var divpointer = document.getElementById(oid + '-pointer'); var text; if (action == 'update') { - var text_el = document.getElementById(divbox.id + '-text'); + var text_el = document.getElementById(oid + '-text'); text = text_el.innerHTML.unescapeHTML(); } else { @@ -158,25 +154,23 @@ function box_edit(button, 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 = id.substring(2); + id = oid.substring(2); return show_form(divbox.img_id, dx, dy, id, text, action); } // show comment form when 'update-comment' button pressed -function update_comment(button) +function update_comment(oid,ktid) { - var divbox = button.parentNode.parentNode.parentNode.parentNode; - var id = divbox.id; - var divpointer = document.getElementById(divbox.id + '-pointer'); + var divpointer = document.getElementById(oid + '-pointer'); var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); + + var divbox = document.getElementById(oid); + var text = document.getElementById(ktid).innerHTML.unescapeHTML(); - var commentdiv = button.parentNode.parentNode.parentNode; - var id = commentdiv.id.substring(1); - var text = document.getElementById('kt' + id).innerHTML.unescapeHTML(); - - return show_form(divbox.img_id, dx, dy, id, text, 'update-comment'); + return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment'); } //fill up comment form and show him @@ -232,6 +226,9 @@ function box_onmouseover(box, stat) case 'wontfix': pointer.className = 'pointer-wontfix-hi'; break; + case 'ready': + pointer.className = 'pointer-ready-hi'; + break; default: pointer.className = 'pointer-hi'; } @@ -248,6 +245,9 @@ function box_onmouseout(box, stat) case 'wontfix': pointer.className = 'pointer-wontfix'; break; + case 'ready': + pointer.className = 'pointer-ready'; + break; default: pointer.className = 'pointer'; } diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index a91d58b4..946edaab 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -52,16 +52,6 @@
{% endfor %} - -
- {% csrf_token %} - - - - Souhlasím se smazáním všech kometářů -
- -

Změnit stav PDF:

Aktuální: {{pdf.status}}
@@ -91,12 +81,12 @@ {% for o in opravy %}
+ class='pointer{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% elif o.status = 'k_zaneseni' %}-ready{% endif %}'>
+ class='box{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% elif o.status = 'k_zaneseni' %}-ready{% endif %}' + onmouseover='box_onmouseover(this,{% if o.status = 'opraveno' %}"done"{% elif o.status = 'neni_chyba' %}"wontfix"{% elif o.status = 'k_zaneseni' %}"ready"{% else %}""{% endif %})' + onmouseout='box_onmouseout(this, {% if o.status = 'opraveno' %}"done"{% elif o.status = 'neni_chyba' %}"wontfix"{% elif o.status = 'k_zaneseni' %}"ready"{% else %}""{% endif %})'>
{{o.autor}} @@ -119,20 +109,27 @@ - {% endif %} - - {% if o.status = 'opraveno' or o.status = 'neni_chyba' %} + {% endif %} + {% if o.status != 'k_oprave' %} - {% else %} + {% endif %} + {% if o.status != 'opraveno' %} + {% endif %} + {% if o.status != 'neni_chyba' %} {% endif %} + {% if o.status != 'k_zaneseni' %} + + {% endif %} @@ -141,7 +138,7 @@ {% else %} - {% endif %} @@ -150,13 +147,13 @@ {% else %} - {% endif %} - @@ -191,7 +188,7 @@ {% if forloop.last %} - {% else %} diff --git a/korektury/views.py b/korektury/views.py index bd89cbc2..1e5a9298 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -74,6 +74,11 @@ class KorekturyView(generic.TemplateView): op = Oprava.objects.get(id=id) op.status = op.STATUS_OPRAVENO op.save() + elif (action == u'ready'): + id = int(q.get('id')) + op = Oprava.objects.get(id=id) + op.status = op.STATUS_K_ZANESENI + op.save() elif (action == u'wontfix'): id = int(q.get('id')) op = Oprava.objects.get(id=id) @@ -97,14 +102,6 @@ class KorekturyView(generic.TemplateView): id = int(q.get('id')) kom = Komentar.objects.get(id=id) kom.delete() - elif (action == u'delall'): - pdf = KorekturovanePDF.objects.filter(id=q.get('pdf')) - checked = q.get('yes') - if checked: - opravy = Oprava.objects.filter(pdf=pdf) - komentare = Komentar.objects.filter(oprava=opravy) - opravy.delete() - komentare.delete() elif (action == u'set-state'): pdf = KorekturovanePDF.objects.get(id=q.get('pdf')) if (q.get('state') == u'adding'):