Browse Source

Merge branch 'jethro'

remotes/origin/prednasky
parent
commit
65fa01f196
  1. 3
      korektury/static/korektury/opraf.js
  2. 22
      korektury/templates/korektury/opraf.html
  3. 2
      korektury/views.py

3
korektury/static/korektury/opraf.js

@ -126,11 +126,14 @@ function img_click(element, ev) {
function toggle_visibility(button){ function toggle_visibility(button){
var divbox = button.parentNode.parentNode.parentNode; var divbox = button.parentNode.parentNode.parentNode;
var id = divbox.id; var id = divbox.id;
var buttondiv = document.getElementById(id+'-buttons')
var text = document.getElementById(id+'-body'); 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';
}else { }else {
text.style.display = 'none'; text.style.display = 'none';
buttondiv.style.display = 'none';
} }
for (var i=0;i<comments.length-1;i++){ for (var i=0;i<comments.length-1;i++){
place_comments_one_div(comments[i][0], comments[i][1]) place_comments_one_div(comments[i][0], comments[i][1])

22
korektury/templates/korektury/opraf.html

@ -83,8 +83,8 @@
<hr/> <hr/>
<p> <p>
Děkujeme opravovatelům: Děkujeme opravovatelům:
{% for autor,pocet in zasluhy.items %} {% for z in zasluhy %}
{{autor}} ({{pocet}}){% if not forloop.last %},{% endif %} {{z.autor}} ({{z.pocet}}){% if not forloop.last %},{% endif %}
{% endfor %}</p> {% endfor %}</p>
<hr> <hr>
@ -99,8 +99,9 @@
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"{%else%}""{% endif %})'>
<div class='corr-header'> <div class='corr-header'>
<div class='author' id='op{{o.id}}-autor'>{{o.autor}}</div> <span class='author' id='op{{o.id}}-autor'>{{o.autor}}</span>
<div class='float-right'> <span class='float-right'>
<span id='op{{o.id}}-buttons'>
<!-- Existujici korektura !--> <!-- Existujici korektura !-->
<form action='' onsubmit='save_scroll(this)' method='POST'> <form action='' onsubmit='save_scroll(this)' method='POST'>
{% csrf_token %} {% csrf_token %}
@ -147,11 +148,12 @@
<button type='button' onclick='box_edit(this, "comment");' title='Komentovat'> <button type='button' onclick='box_edit(this, "comment");' title='Komentovat'>
<img src="{% static "korektury/imgs/comment.png" %}"/> <img src="{% static "korektury/imgs/comment.png" %}"/>
</button> </button>
</span>
<button type='button' onclick='toggle_visibility(this);' title='Skrýt/Zobrazit'> <button type='button' onclick='toggle_visibility(this);' title='Skrýt/Zobrazit'>
<img src="{% static "korektury/imgs/hide.png" %}"/> <img src="{% static "korektury/imgs/hide.png" %}"/>
</button> </button>
</div> </span>
</div> </div>
<div class='corr-body' id='op{{o.id}}-body'> <div class='corr-body' id='op{{o.id}}-body'>
<div id='op{{o.id}}-text'>{{o.text}}</div> <div id='op{{o.id}}-text'>{{o.text}}</div>
@ -159,17 +161,17 @@
{% for k in o.komentare %} {% for k in o.komentare %}
<hr> <hr>
<div class='comment' id='k{{k.id}}'> <div class='comment' id='k{{k.id}}'>
<div class='corr-header'> <span class='corr-header'>
<div class='author'>{{k.autor}}</div> <div class='author'>{{k.autor}}</div>
<div class="float-right"> <span class="float-right">
<!-- Komentar !--> <!-- Komentar !-->
<form action='' onsubmit='save_scroll(this)' method='POST'> <form action='' onsubmit='save_scroll(this)' method='POST'>
{% csrf_token %} {% csrf_token %}
<input type='hidden' name='pdf' value='{{pdf.id}}'> <input type='hidden' name='pdf' value='{{pdf.id}}'>
<input type='hidden' name='id' value='{{k.id}}'> <input type='hidden' name='id' value='{{k.id}}'>
<input type='hidden' name='scroll'> <input type='hidden' name='scroll'>
<button type='submit' name='action' value='del-comment' title='Smaž komentář' <button type='submit' name='action' value='del-comment' title='Smaž komentář'
onclick='return confirm("Opravdu smazat komentář?")'> onclick='return confirm("Opravdu smazat komentář?")'>
<img src="{% static "korektury/imgs/delete.png" %}"/> <img src="{% static "korektury/imgs/delete.png" %}"/>
</button> </button>
</form> </form>
@ -178,7 +180,7 @@
<img src="{% static "korektury/imgs/edit.png"%}"/> <img src="{% static "korektury/imgs/edit.png"%}"/>
</button> </button>
</div> </div>
</div> </span>
<div id='kt{{k.id}}'>{{k.text}}</div> <div id='kt{{k.id}}'>{{k.text}}</div>
</div> </div>
{% endfor %} {% endfor %}

2
korektury/views.py

@ -184,6 +184,8 @@ class KorekturyView(generic.TemplateView):
zasluhy[k.autor]+=1 zasluhy[k.autor]+=1
else: else:
zasluhy[k.autor]=1 zasluhy[k.autor]=1
zasluhy = [{'autor':jmeno, 'pocet':pocet} for (jmeno,pocet) in zasluhy.items()]
zasluhy.sort(key=lambda z:z['pocet'],reverse=True)
strany = set(o.strana for o in opravy) strany = set(o.strana for o in opravy)
opravy_na_stranu = [{'strana': s, 'op_id': opravy.filter(strana=s)} for s in strany] opravy_na_stranu = [{'strana': s, 'op_id': opravy.filter(strana=s)} for s in strany]

Loading…
Cancel
Save