Browse Source

Pridan pozitivni/negativni vysledek korektury.

Take pridan status PDF, zatim nepouzit.
remotes/origin/opraf
parent
commit
07961061e8
  1. 15
      korektury/models.py
  2. BIN
      korektury/static/korektury/imgs/cross.png
  3. BIN
      korektury/static/korektury/imgs/delete-gr.png
  4. BIN
      korektury/static/korektury/imgs/delete.png
  5. 28
      korektury/static/korektury/opraf.css
  6. 26
      korektury/static/korektury/opraf.js
  7. 15
      korektury/templates/korektury/opraf.html
  8. 5
      korektury/views.py

15
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,

BIN
korektury/static/korektury/imgs/cross.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

BIN
korektury/static/korektury/imgs/delete-gr.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 348 B

BIN
korektury/static/korektury/imgs/delete.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 500 B

28
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;
}

26
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)

15
korektury/templates/korektury/opraf.html

@ -61,12 +61,12 @@
{% for o in opravy %}
<div onclick='img_click(this,event)'
id='op{{o.id}}-pointer'
class='pointer{%if o.status = 'opraveno' %}-done{% endif %}'>
class='pointer{%if o.status = 'opraveno' %}-done{% elif o.status = 'neni_chyba' %}-wontfix{% endif %}'>
</div>
<div name='op{{o.id}}' id='op{{o.id}}'
class='box{%if o.status = 'opraveno' %}-done{% endif %}'
onmouseover='box_onmouseover(this,{% if o.status = 'opraveno' %}1{% else %}0{% endif %})'
onmouseout='box_onmouseout(this,{% if o.status = 'opraveno' %}1{% else %}0{% 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 %})'>
<div class='corr-header'>
<div class='author' id='op{{o.id}}-autor'>{{o.autor}}</div>
@ -81,7 +81,7 @@
{% if o.komentare %}
<button name='action' value='del' type='button'
title="Korekturu nelze smazat &ndash; už ji někdo okomentoval">
title="Opravu nelze smazat &ndash; už ji někdo okomentoval">
<img src="/static/korektury/imgs/delete-gr.png"/>
</button>
{% else %}
@ -90,7 +90,7 @@
</button>
{% endif %}
{% if o.status = 'opraveno' %}
{% if o.status = 'opraveno' or o.status = 'neni_chyba' %}
<button type='submit' name='action' value='undone' title='Označ jako neopravené'>
<img src="/static/korektury/imgs/undo.png"/>
</button>
@ -98,6 +98,9 @@
<button type='submit' name='action' value='done' title='Označ jako opravené'>
<img src="/static/korektury/imgs/check.png"/>
</button>
<button type='submit' name='action' value='wontfix' title='Označ jako irelevantní '>
<img src="/static/korektury/imgs/cross.png"/>
</button>
{% endif %}
</form>
<!-- /Existujici korektura !-->

5
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()

Loading…
Cancel
Save