Browse Source

Opravy a vylepseni v korekturovatku.

- komentar lze editovat
- pridan stav 'k zaneseni do TeXu'
- odstraneny prochazky po DOMu
remotes/origin/jethro
parent
commit
ae31ce7c21
  1. 5
      korektury/models.py
  2. BIN
      korektury/static/korektury/imgs/tex.png
  3. 100
      korektury/static/korektury/imgs/tex.svg
  4. 28
      korektury/static/korektury/opraf.css
  5. 40
      korektury/static/korektury/opraf.js
  6. 41
      korektury/templates/korektury/opraf.html
  7. 13
      korektury/views.py

5
korektury/models.py

@ -112,7 +112,6 @@ class KorekturovanePDF(models.Model):
# uložíme png a změněný počet stran # uložíme png a změněný počet stran
self.convert() self.convert()
@reversion.register(ignore_duplicate_revision=True) @reversion.register(ignore_duplicate_revision=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Oprava(models.Model): class Oprava(models.Model):
@ -135,12 +134,12 @@ class Oprava(models.Model):
STATUS_K_OPRAVE = 'k_oprave' STATUS_K_OPRAVE = 'k_oprave'
STATUS_OPRAVENO = 'opraveno' STATUS_OPRAVENO = 'opraveno'
STATUS_NENI_CHYBA = 'neni_chyba' STATUS_NENI_CHYBA = 'neni_chyba'
STATUS_K_REAKCI = 'k_reakci' STATUS_K_ZANESENI = 'k_zaneseni'
STATUS_CHOICES = ( STATUS_CHOICES = (
(STATUS_K_OPRAVE, u'K opravě'), (STATUS_K_OPRAVE, u'K opravě'),
(STATUS_OPRAVENO, u'Opraveno'), (STATUS_OPRAVENO, u'Opraveno'),
(STATUS_NENI_CHYBA, u'Není chyba'), (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, status = models.CharField(u'stav opravy',max_length=16, choices=STATUS_CHOICES, blank=False,
default = STATUS_K_OPRAVE) default = STATUS_K_OPRAVE)

BIN
korektury/static/korektury/imgs/tex.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

100
korektury/static/korektury/imgs/tex.svg

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg1"
viewBox="0 0 237.89999 236.99999"
sodipodi:version="0.34"
version="1.0"
y="0"
x="0"
sodipodi:docname="tex.svg"
width="237.89999"
height="237"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<defs
id="defs1181" />
<sodipodi:namedview
id="base"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.94628571"
inkscape:cx="393.79221"
inkscape:cy="-195.91104"
inkscape:window-width="1837"
inkscape:window-height="1025"
inkscape:window-x="83"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<g
id="g1186"
transform="translate(265.69321,-34.905067)">
<path
inkscape:connector-curvature="0"
d="m -265.69321,82.287565 v 29.117005 h 9.29 l 2.154,-17.601005 2.155,-2.139 h 16.161 v 89.500005 l -2.29,2.63 -8.755,0.82 v 8.07 h 40.255 v -8.07 l -8.75,-0.82 -2.29,-2.63 V 91.664565 h 16.16 l 2.02,2.139 2.29,17.601005 h 9.29 V 82.287565 Z"
id="path644" />
<path
inkscape:connector-curvature="0"
d="m -73.833213,149.96457 -16.03,33.53 h 9.48 v 8.94 h -27.319997 v -8.94 h 9.479997 l 20.27,-42.17 -24.079997,-50.222005 h -7.07 v -8.937 h 38.259997 v 8.937 h -8.45 l 14.9,31.022005 14.74,-31.022005 h -8.97 v -8.937 h 26.81 v 8.937 h -9.49 l -19.02,39.592005 25.26,52.8 h 7.27 v 8.94 h -38.41 v -8.94 h 8.56 z"
id="path650" />
<path
inkscape:connector-curvature="0"
d="m -183.75321,224.64457 h 64.52 v -25.4 h -8.17 l -2.04,15.04 -1.56,2.27 h -27.88 v -36.89 h 15.62 l 1.68,1.99 1.2,10.22 h 7.09 v -32.92 h -7.09 l -1.2,10.22 -1.68,1.98 h -15.62 v -33.76 h 23.91 l 1.56,1.84 1.8,12.48 h 8.42 v -22.27 h -60.56 v 6.95 l 7.33,0.71 1.92,1.99 v 75.62 l -1.92,2.27 -7.33,0.71 z"
id="path647" />
</g>
<metadata
id="metadata1178">
<rdf:RDF>
<cc:Work>
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" />
<dc:publisher>
<cc:Agent
rdf:about="http://openclipart.org/">
<dc:title>Openclipart</dc:title>
</cc:Agent>
</dc:publisher>
<dc:title>tex</dc:title>
<dc:date>2011-01-21T16:59:19</dc:date>
<dc:description>Originally uploaded by Jose Hevia for OCAL 0.18</dc:description>
<dc:source>https://openclipart.org/detail/109117/tex-by-anonymous</dc:source>
<dc:creator>
<cc:Agent>
<dc:title>Anonymous</dc:title>
</cc:Agent>
</dc:creator>
<dc:subject>
<rdf:Bag>
<rdf:li>fix</rdf:li>
<rdf:li>keyword</rdf:li>
<rdf:li>librarians</rdf:li>
<rdf:li>tag</rdf:li>
</rdf:Bag>
</dc:subject>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/publicdomain/zero/1.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

28
korektury/static/korektury/opraf.css

@ -17,6 +17,8 @@ img{background:white;}
.pointer, .pointer,
.pointer-wontfix, .pointer-wontfix,
.pointer-wontfix-hi, .pointer-wontfix-hi,
.pointer-ready,
.pointer-ready-hi,
.pointer-done, .pointer-done,
.pointer-done-hi { .pointer-done-hi {
position:absolute; position:absolute;
@ -27,6 +29,7 @@ img{background:white;}
.pointer-done-hi, .pointer-done-hi,
.pointer-wontfix-hi, .pointer-wontfix-hi,
.pointer-ready-hi,
.pointer-hi { .pointer-hi {
border-width: 3px; border-width: 3px;
} }
@ -48,22 +51,34 @@ img{background:white;}
border-color: rgba(0, 0, 255, 1); border-color: rgba(0, 0, 255, 1);
} }
.pointer-wontfix { .pointer-wontfix {
border-color: #00F; /*IE*/ border-color: #000; /*IE*/
border-color: rgba(128, 128, 128, 0.2); border-color: rgba(128, 128, 128, 0.2);
} }
.pointer-wontfix-hi { .pointer-wontfix-hi {
border-color: #00F; /*IE*/ border-color: #000; /*IE*/
border-color: rgba(128, 128, 128, 1); 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:hover,
.box-done:hover, .box-done:hover,
.box-ready:hover,
.box-wontfix:hover{ .box-wontfix:hover{
border-width:3px; border-width:3px;
margin: 0px; margin: 0px;
} }
.box, .box-done, .box-wontfix { .box,
.box-done,
.box-ready,
.box-wontfix {
margin: 1px; margin: 1px;
background-color: white; background-color: white;
width:300px; width:300px;
@ -78,6 +93,9 @@ img{background:white;}
.box-done { .box-done {
border-color: blue; border-color: blue;
} }
.box-ready {
border-color: rgba(0,255,0,1);
}
.box-wontfix { .box-wontfix {
border-color: grey; border-color: grey;
} }
@ -118,6 +136,8 @@ form {
.box img, .box img,
.box-done button, .box-done button,
.box-done img, .box-done img,
.box-ready button,
.box-ready img,
.box-wontfix button, .box-wontfix button,
.box-wontfix img{ .box-wontfix img{
border: 1px solid white; border: 1px solid white;
@ -129,6 +149,8 @@ form {
.box img:hover, .box img:hover,
.box-done img:hover, .box-done img:hover,
.box-done button:hover, .box-done button:hover,
.box-ready img:hover,
.box-ready button:hover,
.box-wontfix img:hover, .box-wontfix img:hover,
.box-wontfix button:hover{ .box-wontfix button:hover{
border: 1px solid black; border: 1px solid black;

40
korektury/static/korektury/opraf.js

@ -123,11 +123,9 @@ function img_click(element, ev) {
return show_form(img_id, dx, dy, '', '', '', ''); return show_form(img_id, dx, dy, '', '', '', '');
} }
// hide or show text of correction // hide or show text of correction
function toggle_visibility(button){ function toggle_visibility(oid){
var divbox = button.parentNode.parentNode.parentNode; var buttondiv = document.getElementById(oid+'-buttons')
var id = divbox.id; var text = document.getElementById(oid+'-body');
var buttondiv = document.getElementById(id+'-buttons')
var text = document.getElementById(id+'-body');
if (text.style.display == 'none'){ if (text.style.display == 'none'){
text.style.display = 'block'; text.style.display = 'block';
buttondiv.style.display = 'inline-block'; buttondiv.style.display = 'inline-block';
@ -141,15 +139,13 @@ function toggle_visibility(button){
} }
// show comment form, when 'edit' or 'comment' button pressed // 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 divpointer = document.getElementById(oid + '-pointer');
var id = divbox.id;
var divpointer = document.getElementById(divbox.id + '-pointer');
var text; var text;
if (action == 'update') { if (action == 'update') {
var text_el = document.getElementById(divbox.id + '-text'); var text_el = document.getElementById(oid + '-text');
text = text_el.innerHTML.unescapeHTML(); text = text_el.innerHTML.unescapeHTML();
} else { } else {
@ -158,25 +154,23 @@ function box_edit(button, action)
var dx = parseInt(divpointer.style.left); var dx = parseInt(divpointer.style.left);
var dy = parseInt(divpointer.style.top); var dy = parseInt(divpointer.style.top);
var divbox = document.getElementById(oid);
//alert('not yet 2:' + text + text_el); // + divpointer.style.top "x" + divpo ); //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); return show_form(divbox.img_id, dx, dy, id, text, action);
} }
// show comment form when 'update-comment' button pressed // 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 divpointer = document.getElementById(oid + '-pointer');
var id = divbox.id;
var divpointer = document.getElementById(divbox.id + '-pointer');
var dx = parseInt(divpointer.style.left); var dx = parseInt(divpointer.style.left);
var dy = parseInt(divpointer.style.top); var dy = parseInt(divpointer.style.top);
var divbox = document.getElementById(oid);
var text = document.getElementById(ktid).innerHTML.unescapeHTML();
var commentdiv = button.parentNode.parentNode.parentNode; return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment');
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');
} }
//fill up comment form and show him //fill up comment form and show him
@ -232,6 +226,9 @@ function box_onmouseover(box, stat)
case 'wontfix': case 'wontfix':
pointer.className = 'pointer-wontfix-hi'; pointer.className = 'pointer-wontfix-hi';
break; break;
case 'ready':
pointer.className = 'pointer-ready-hi';
break;
default: default:
pointer.className = 'pointer-hi'; pointer.className = 'pointer-hi';
} }
@ -248,6 +245,9 @@ function box_onmouseout(box, stat)
case 'wontfix': case 'wontfix':
pointer.className = 'pointer-wontfix'; pointer.className = 'pointer-wontfix';
break; break;
case 'ready':
pointer.className = 'pointer-ready';
break;
default: default:
pointer.className = 'pointer'; pointer.className = 'pointer';
} }

41
korektury/templates/korektury/opraf.html

@ -52,16 +52,6 @@
<hr/> <hr/>
{% endfor %} {% endfor %}
<!-- Smazat vsechny komentare !-->
<form method="post">
{% csrf_token %}
<input type='hidden' name='action' value='delall'/>
<input type='submit' value='Smazat všechny komentáře'/>
<input type='hidden' name='pdf' value='{{pdf.id}}'/>
<input type='checkbox' name='yes'/> Souhlasím se smazáním všech kometářů
</form>
<!-- /Smazat vsechny komentare !-->
<hr/>
<h4>Změnit stav PDF:</h4> <h4>Změnit stav PDF:</h4>
<i>Aktuální: {{pdf.status}}</i> <i>Aktuální: {{pdf.status}}</i>
<br> <br>
@ -91,12 +81,12 @@
{% for o in opravy %} {% for o in opravy %}
<div onclick='img_click(this,event)' <div onclick='img_click(this,event)'
id='op{{o.id}}-pointer' id='op{{o.id}}-pointer'
class='pointer{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% endif %}'> class='pointer{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% elif o.status = 'k_zaneseni' %}-ready{% endif %}'>
</div> </div>
<div name='op{{o.id}}' id='op{{o.id}}' <div name='op{{o.id}}' id='op{{o.id}}'
class='box{%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{% elif o.status = 'k_zaneseni' %}-ready{% endif %}'
onmouseover='box_onmouseover(this,{% if o.status = 'opraveno' %}"done"{% elif o.status = 'neni_chyba' %}"wontfix"{%else%}""{% 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"{%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 %})'>
<div class='corr-header'> <div class='corr-header'>
<span class='author' id='op{{o.id}}-autor'>{{o.autor}}</span> <span class='author' id='op{{o.id}}-autor'>{{o.autor}}</span>
@ -119,20 +109,27 @@
<button type='submit' name='action' value='del' title='Smaž opravu'> <button type='submit' name='action' value='del' title='Smaž opravu'>
<img src="{% static "korektury/imgs/delete.png"%}"/> <img src="{% static "korektury/imgs/delete.png"%}"/>
</button> </button>
{% endif %} {% endif %}
{% if o.status != 'k_oprave' %}
{% if o.status = 'opraveno' or o.status = 'neni_chyba' %}
<button type='submit' name='action' value='undone' title='Označ jako neopravené'> <button type='submit' name='action' value='undone' title='Označ jako neopravené'>
<img src="{% static "korektury/imgs/undo.png"%}"/> <img src="{% static "korektury/imgs/undo.png"%}"/>
</button> </button>
{% else %} {% endif %}
{% if o.status != 'opraveno' %}
<button type='submit' name='action' value='done' title='Označ jako opravené'> <button type='submit' name='action' value='done' title='Označ jako opravené'>
<img src="{% static "korektury/imgs/check.png"%}"/> <img src="{% static "korektury/imgs/check.png"%}"/>
</button> </button>
{% endif %}
{% if o.status != 'neni_chyba' %}
<button type='submit' name='action' value='wontfix' title='Označ jako irelevantní '> <button type='submit' name='action' value='wontfix' title='Označ jako irelevantní '>
<img src="{% static "korektury/imgs/cross.png" %}"/> <img src="{% static "korektury/imgs/cross.png" %}"/>
</button> </button>
{% endif %} {% endif %}
{% if o.status != 'k_zaneseni' %}
<button type='submit' name='action' value='ready' title='Označ jako připraveno k zanesení'>
<img src="{% static "korektury/imgs/tex.png" %}"/>
</button>
{% endif %}
</form> </form>
<!-- /Existujici korektura !--> <!-- /Existujici korektura !-->
@ -141,7 +138,7 @@
<img src="{% static "korektury/imgs/edit-gr.png" %}"/> <img src="{% static "korektury/imgs/edit-gr.png" %}"/>
</button> </button>
{% else %} {% else %}
<button type='button' onclick='box_edit(this,"update");' title='Oprav opravu'> <button type='button' onclick='box_edit("op{{o.id}}","update");' title='Oprav opravu'>
<img src="{% static "korektury/imgs/edit.png" %}"/> <img src="{% static "korektury/imgs/edit.png" %}"/>
</button> </button>
{% endif %} {% endif %}
@ -150,13 +147,13 @@
<img src="{% static "korektury/imgs/comment-gr.png" %}"/> <img src="{% static "korektury/imgs/comment-gr.png" %}"/>
</button> </button>
{% else %} {% else %}
<button type='button' onclick='box_edit(this, "comment");' title='Komentovat'> <button type='button' onclick='box_edit("op{{o.id}}", "comment");' title='Komentovat'>
<img src="{% static "korektury/imgs/comment.png" %}"/> <img src="{% static "korektury/imgs/comment.png" %}"/>
</button> </button>
{% endif %} {% endif %}
</span> </span>
<button type='button' onclick='toggle_visibility(this);' title='Skrýt/Zobrazit'> <button type='button' onclick='toggle_visibility("op{{o.id}}");' title='Skrýt/Zobrazit'>
<img src="{% static "korektury/imgs/hide.png" %}"/> <img src="{% static "korektury/imgs/hide.png" %}"/>
</button> </button>
@ -191,7 +188,7 @@
</form> </form>
<!-- /Komentar !--> <!-- /Komentar !-->
{% if forloop.last %} {% if forloop.last %}
<button type='button' onclick='update_comment(this);' title='Uprav komentář'> <button type='button' onclick="update_comment('op{{o.id}}','kt{{k.id}}');" title='Uprav komentář'>
<img src="{% static "korektury/imgs/edit.png"%}"/> <img src="{% static "korektury/imgs/edit.png"%}"/>
</button> </button>
{% else %} {% else %}

13
korektury/views.py

@ -74,6 +74,11 @@ class KorekturyView(generic.TemplateView):
op = Oprava.objects.get(id=id) op = Oprava.objects.get(id=id)
op.status = op.STATUS_OPRAVENO op.status = op.STATUS_OPRAVENO
op.save() 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'): elif (action == u'wontfix'):
id = int(q.get('id')) id = int(q.get('id'))
op = Oprava.objects.get(id=id) op = Oprava.objects.get(id=id)
@ -97,14 +102,6 @@ class KorekturyView(generic.TemplateView):
id = int(q.get('id')) id = int(q.get('id'))
kom = Komentar.objects.get(id=id) kom = Komentar.objects.get(id=id)
kom.delete() 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'): elif (action == u'set-state'):
pdf = KorekturovanePDF.objects.get(id=q.get('pdf')) pdf = KorekturovanePDF.objects.get(id=q.get('pdf'))
if (q.get('state') == u'adding'): if (q.get('state') == u'adding'):

Loading…
Cancel
Save