From 07961061e88809c4511357a7867760a24e7d6cf4 Mon Sep 17 00:00:00 2001 From: "Tomas \"Jethro\" Pokorny" Date: Wed, 23 Dec 2015 14:58:42 +0100 Subject: [PATCH] Pridan pozitivni/negativni vysledek korektury. Take pridan status PDF, zatim nepouzit. --- korektury/models.py | 15 ++++++++++ korektury/static/korektury/imgs/cross.png | Bin 0 -> 717 bytes korektury/static/korektury/imgs/delete-gr.png | Bin 593 -> 348 bytes korektury/static/korektury/imgs/delete.png | Bin 717 -> 500 bytes korektury/static/korektury/opraf.css | 28 +++++++++++++++--- korektury/static/korektury/opraf.js | 26 +++++++++++++--- korektury/templates/korektury/opraf.html | 15 ++++++---- korektury/views.py | 5 ++++ 8 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 korektury/static/korektury/imgs/cross.png diff --git a/korektury/models.py b/korektury/models.py index ceac374a..6aa41c2c 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -53,6 +53,17 @@ class KorekturovanePDF(models.Model): pdf = models.FileField(u'pdf', upload_to = generate_filename) 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) + #TODO Nepovinný foreign key k číslu @@ -101,10 +112,14 @@ class Oprava(models.Model): STATUS_K_OPRAVE = 'k_oprave' STATUS_OPRAVENO = 'opraveno' + STATUS_NENI_CHYBA = 'neni_chyba' + STATUS_K_REAKCI = 'k_reakci' STATUS_SMAZANO = 'smazano' 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_SMAZANO, u'Smazáno'), ) status = models.CharField(u'stav opravy',max_length=16, choices=STATUS_CHOICES, blank=False, diff --git a/korektury/static/korektury/imgs/cross.png b/korektury/static/korektury/imgs/cross.png new file mode 100644 index 0000000000000000000000000000000000000000..f3add6aa94a37d9faf7ae2ced1d96cfeb47cca40 GIT binary patch literal 717 zcmV;;0y6!HP)b(pk;V@dCfD;u}Z0w&sM7@=wMr^ zl$y$93clx^y)G6%&^1Uu-&a-&$(fm@%E1AsmCM*M3_W{&ZFYc>Ix(T$mP+8kvNqn7 z%Xvt5?w_4qt?cguuT}$r?}Nt84R$O`e|vSsL^g+p)YRM@>Pe?HgLv@t1Z=~=cD=3x2myn~$2H^dko^y>-e_#Y&jSOh+}DTV$)py-EQpK^ z%fj80lc4uG90cs%_l|=bj-#_2Y!42qvZ|tZPmdPDkO~p+ou3Eh@iBvGFeCydgmIWeY zJraokj^jX`=P?n`7cVZ_75ZO*WP4z03dKZGt04rq7Ra2;Eh1n+sK4tZKzHw-o<@qQ zYPWlPfFoDn*X#TO)*u(YtS6;su0b!Ugc;gKIC3EP68 z2jnzKjzhyFFM=Qdp(O-KgZ-%2w;{@8)*OsiLzucN%lLu7VW~cijHrWxfYOShNutO^ zXk~s{);i0Q!3%AWHdUrayGqV{MH00000NkvXXu0mjfba+y( literal 0 HcmV?d00001 diff --git a/korektury/static/korektury/imgs/delete-gr.png b/korektury/static/korektury/imgs/delete-gr.png index c9816e47054926daa2b7ed514aa7c3b9ed32c5d1..de817f32a18b98fe28cd97c732932c96ecc21b6c 100644 GIT binary patch literal 348 zcmV-i0i*tjP){b-}48^p|~R5;OeZ(#D2wOxJ?ErtIcRI$fU$#yV*z)tAD^En=G7j zbvn83`!%@yn!Sf-d3t^XsO9Zi^zM@ZCpPO{LTy07xP1riM5Lyy+i>qO)b`9`$fIsQ znOE?H>%@{ZH-g}sOs4EG5mn8Jev=v$bCox%9=v{K12V&^b`qzS9VyAVG>lDyqr z82-2SpV<%Ov6p!Iy0YKrmgH5@3z!|0!oa}T>gnPbqH*4~e{Y_!qe$!in=`k{Hoak7 zsKM%Y$05e$)Y8wVcrPz?dc?cHc>RPf^ApN5_;gm4EJ+mMl-6{)cp*6Akn5?l{ldpj zy$iVUY})gA#b0E33kr5z_wG|S{uiHizvkZSIr7bI{eSP?TT;9Gf6j(YDc`2vud{t; z5?$Z-<>14-_w1Hi&lc4u8_aY}JDPu5l7Gpj)U%=49)6yUQ!l0S9mzkbsmkE$UHV4& ze+ZWn>%`L^nwI@pq_Sv6+sfbz8+r4WDg+4$)&(<7%-m7DI7WAY-0xjeT$GBRxrnq_ zo1b!AyW{#_<(-eDT$|ijpSD>xMC#@TB|9~_Og}9X zUK8urak|R6D>3$3&Gn{JZ~F32a4s->v0$ZF*TDrlInB@Qd2{_Jvs5eBDN&JqYMPpw z*^7RkEcr86sMV?c2=C`WyYlaj!3&+HmaK93#sA*qYQi0j_zC5?ck?}ZPy5H;%idv8 zm3Owa^0#rk??3C?GDp7s-M(J_fqW%@_c6}v^LT)9q*~${QIe8al4_M)lnSI6j0_A- zbqx)5jf_GJ4XunVtc;Dd4GgUe3}ojWT7jY=H$NpatrE9}oWoTjKn)C@u6{1-oD!M< DiO=*k diff --git a/korektury/static/korektury/imgs/delete.png b/korektury/static/korektury/imgs/delete.png index f3add6aa94a37d9faf7ae2ced1d96cfeb47cca40..9b77ca3bfb23e737c100008b51f561ac29ba1ec1 100644 GIT binary patch literal 500 zcmeAS@N?(olHy`uVBq!ia0vp^d_XL~!2%?E=C*AFQY`6?zK#qG8~eHcB(ehe3dtTp zz6=aiY77hwEes65fIK5?#Ad`YllCxu=U`h{WZ!=l1G3Co&xS zc>njeE!>kegl2^txzuv-(ve4OvvzPa?_iki>B5s#&N$7ltco%3z%dn}mn*Y^R%TT7 zEey)~CO_}#$v42uzI=yp6Vzh~GnxD>(4bN}>R*{|%eW4(1!mYxrC5toNqA#xzH-Duk^yJjE zr)D~dmlr+o_4^cib!z7>j<};AkK9)d{?jj6_woo2n^st9NNDMrRT3O3zl>hziGJB~ z;j&TCS_b(pk;V@dCfD;u}Z0w&sM7@=wMr^ zl$y$93clx^y)G6%&^1Uu-&a-&$(fm@%E1AsmCM*M3_W{&ZFYc>Ix(T$mP+8kvNqn7 z%Xvt5?w_4qt?cguuT}$r?}Nt84R$O`e|vSsL^g+p)YRM@>Pe?HgLv@t1Z=~=cD=3x2myn~$2H^dko^y>-e_#Y&jSOh+}DTV$)py-EQpK^ z%fj80lc4uG90cs%_l|=bj-#_2Y!42qvZ|tZPmdPDkO~p+ou3Eh@iBvGFeCydgmIWeY zJraokj^jX`=P?n`7cVZ_75ZO*WP4z03dKZGt04rq7Ra2;Eh1n+sK4tZKzHw-o<@qQ zYPWlPfFoDn*X#TO)*u(YtS6;su0b!Ugc;gKIC3EP68 z2jnzKjzhyFFM=Qdp(O-KgZ-%2w;{@8)*OsiLzucN%lLu7VW~cijHrWxfYOShNutO^ zXk~s{);i0Q!3%AWHdUrayGqV{MH00000NkvXXu0mjfba+y( diff --git a/korektury/static/korektury/opraf.css b/korektury/static/korektury/opraf.css index dce8716d..e326a5e9 100644 --- a/korektury/static/korektury/opraf.css +++ b/korektury/static/korektury/opraf.css @@ -7,6 +7,8 @@ img{background:white;} .pointer-hi, .pointer, +.pointer-wontfix, +.pointer-wontfix-hi, .pointer-done, .pointer-done-hi { position:absolute; @@ -16,6 +18,7 @@ img{background:white;} } .pointer-done-hi, +.pointer-wontfix-hi, .pointer-hi { border-width: 3px; } @@ -36,13 +39,23 @@ img{background:white;} border-color: #00F; /*IE*/ border-color: rgba(0, 0, 255, 1); } +.pointer-wontfix { + border-color: #00F; /*IE*/ + border-color: rgba(128, 128, 128, 0.2); +} +.pointer-wontfix-hi { + border-color: #00F; /*IE*/ + border-color: rgba(128, 128, 128, 1); +} -.box:hover, .box-done:hover { +.box:hover, +.box-done:hover, +.box-wontfix:hover{ border-width:3px; margin: 0px; } -.box, .box-done { +.box, .box-done, .box-wontfix { margin: 1px; background-color: white; width:300px; @@ -57,6 +70,9 @@ img{background:white;} .box-done { border-color: blue; } +.box-wontfix { + border-color: grey; +} form { display:inline; } @@ -93,7 +109,9 @@ form { .box button, .box img, .box-done button, -.box-done img { +.box-done img, +.box-wontfix button, +.box-wontfix img{ border: 1px solid white; background-color:transparent; margin:0; @@ -102,7 +120,9 @@ form { .box button:hover, .box img:hover, .box-done img:hover, -.box-done button:hover { +.box-done 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 6c955a72..4916fa3c 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -193,18 +193,36 @@ function show_form(img_id, dx, dy, id, text, action) { } -function box_onmouseover(box, done) +function box_onmouseover(box, stat) { var id = box.id; var pointer = document.getElementById(box.id + '-pointer'); - pointer.className = done ? 'pointer-done-hi' : 'pointer-hi'; + switch (stat){ + case 'done': + pointer.className = 'pointer-done-hi'; + break; + case 'wontfix': + pointer.className = 'pointer-wontfix-hi'; + break; + default: + pointer.className = 'pointer-hi'; + } } -function box_onmouseout(box, done) +function box_onmouseout(box, stat) { var id = box.id; var pointer = document.getElementById(box.id + '-pointer'); - pointer.className = done ? 'pointer-done' : 'pointer'; + switch (stat){ + case 'done': + pointer.className = 'pointer-done'; + break; + case 'wontfix': + pointer.className = 'pointer-wontfix'; + break; + default: + pointer.className = 'pointer'; + } } function save_scroll(form) diff --git a/korektury/templates/korektury/opraf.html b/korektury/templates/korektury/opraf.html index f59ecf62..d8c91199 100644 --- a/korektury/templates/korektury/opraf.html +++ b/korektury/templates/korektury/opraf.html @@ -61,12 +61,12 @@ {% for o in opravy %}
+ class='pointer{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% endif %}'>
+ class='box{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% endif %}' + onmouseover='box_onmouseover(this,{% if o.status = 'opraveno' %}"done"{% elif o.status = 'neni_chyba' %}"wontfix"{%else%}""{% endif %})' + onmouseout='box_onmouseout(this,{% if o.status = 'opraveno' %}"done"{% elif o.status = 'neni_chyba' %}"wontfix"{%else%}""{% endif %})'>
{{o.autor}}
@@ -81,7 +81,7 @@ {% if o.komentare %} {% else %} @@ -90,7 +90,7 @@ {% endif %} - {% if o.status = 'opraveno' %} + {% if o.status = 'opraveno' or o.status = 'neni_chyba' %} @@ -98,6 +98,9 @@ + {% endif %} diff --git a/korektury/views.py b/korektury/views.py index af9d78be..668e293b 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -75,6 +75,11 @@ class KorekturyView(generic.TemplateView): op = Oprava.objects.filter(id=id).first() op.status = op.STATUS_OPRAVENO op.save() + elif (action == u'wontfix'): + id = int(q.get('id')) + op = Oprava.objects.filter(id=id).first() + op.status = op.STATUS_NENI_CHYBA + op.save() elif (action == u'comment'): id = int(q.get('id')) op = Oprava.objects.filter(id=id).first()