Browse Source

Úprava chování korektury (schovává text korektury!!!)

korekturovatko
Jonas Havelka 2 weeks ago
parent
commit
3528a44d3c
  1. BIN
      korektury/static/korektury/imgs/hide.png
  2. 3
      korektury/static/korektury/opraf.js
  3. 91
      korektury/templates/korektury/opraf.html

BIN
korektury/static/korektury/imgs/hide.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 307 B

3
korektury/static/korektury/opraf.js

@ -132,12 +132,15 @@ function img_click(element, ev) {
function toggle_visibility(oid){ function toggle_visibility(oid){
var buttondiv = document.getElementById(oid+'-buttons') var buttondiv = document.getElementById(oid+'-buttons')
var text = document.getElementById(oid+'-body'); var text = document.getElementById(oid+'-body');
var toggleimg = document.getElementById(oid+'-toggleimg');
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';
toggleimg.style.transform = "";
}else { }else {
text.style.display = 'none'; text.style.display = 'none';
buttondiv.style.display = 'none'; buttondiv.style.display = 'none';
toggleimg.style.transform = "rotate(180deg)";
} }
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])

91
korektury/templates/korektury/opraf.html

@ -111,8 +111,35 @@
onmouseover='box_onmouseover(this)' onmouseover='box_onmouseover(this)'
onmouseout='box_onmouseout(this)'> onmouseout='box_onmouseout(this)'>
<div class='corr-body' id='op{{o.id}}-body'>
{% for k in o.komentare %}
<div class='comment' id='k{{k.id}}'>
<div class='corr-header'>
<div class='author'>{{k.autor}}</div>
<div class="float-right">
<!-- Komentar !-->
<form action='' onsubmit='save_scroll(this)' method='POST'>
{% csrf_token %}
<input type='hidden' name='id' value='{{k.id}}'>
<input type='hidden' name='scroll'>
<button style="display: none" type='submit' name='action' value='del-comment' title='Smaž komentář'
onclick='return confirm("Opravdu smazat komentář?")'>
<img src="{% static "korektury/imgs/delete.png" %}"/>
</button>
</form>
<!-- /Komentar !-->
<button type='button' onclick="update_comment('op{{o.id}}','kt{{k.id}}');" title='Uprav komentář'>
<img src="{% static "korektury/imgs/edit.png"%}"/>
</button>
</div>
</div>
<div id='kt{{k.id}}'>{{k.text|linebreaks}}</div>
</div>
<hr>
{% endfor %}
</div>
<div class='corr-header'> <div class='corr-header'>
<span class='author' id='op{{o.id}}-autor'>{{o.autor}}</span>
<span class='float-right'> <span class='float-right'>
<span id='op{{o.id}}-buttons'> <span id='op{{o.id}}-buttons'>
<!-- Existujici korektura !--> <!-- Existujici korektura !-->
@ -122,16 +149,9 @@
<input type='hidden' name='id' value='{{o.id}}'> <input type='hidden' name='id' value='{{o.id}}'>
<input type='hidden' name='scroll'> <input type='hidden' name='scroll'>
{% if o.komentare %} <button style="display: none" type='submit' name='action' value='del' title='Smaž opravu'>
<button name='action' value='del' type='button'
title="Opravu nelze smazat &ndash; už ji někdo okomentoval">
<img src="{% static "korektury/imgs/delete-gr.png"%}"/>
</button>
{% else %}
<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 %}
{% if o.status != o.STATUS.K_OPRAVE %} {% if o.status != o.STATUS.K_OPRAVE %}
<button type='submit' name='action' value='{{ o.STATUS.K_OPRAVE }}' title='Označ jako neopravené'> <button type='submit' name='action' value='{{ o.STATUS.K_OPRAVE }}' title='Označ jako neopravené'>
<img src="{% static "korektury/imgs/undo.png"%}"/> <img src="{% static "korektury/imgs/undo.png"%}"/>
@ -155,15 +175,6 @@
</form> </form>
<!-- /Existujici korektura !--> <!-- /Existujici korektura !-->
{% if o.komentare %}
<button type='button' title="Korekturu nelze upravit &ndash; už ji někdo okomentoval">
<img src="{% static "korektury/imgs/edit-gr.png" %}"/>
</button>
{% else %}
<button type='button' onclick='box_edit("op{{o.id}}","update");' title='Oprav opravu'>
<img src="{% static "korektury/imgs/edit.png" %}"/>
</button>
{% endif %}
{% if o.status == 'opraveno' or o.status == 'neni_chyba' %} {% if o.status == 'opraveno' or o.status == 'neni_chyba' %}
<button type='button' title='Korekturu nelze komentovat, protože už je uzavřená'> <button type='button' title='Korekturu nelze komentovat, protože už je uzavřená'>
<img src="{% static "korektury/imgs/comment-gr.png" %}"/> <img src="{% static "korektury/imgs/comment-gr.png" %}"/>
@ -176,53 +187,11 @@
</span> </span>
<button type='button' onclick='toggle_visibility("op{{o.id}}");' 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 id='op{{o.id}}-toggleimg' src="{% static "korektury/imgs/hide.png" %}"/>
</button> </button>
</span> </span>
</div> </div>
<div class='corr-body' id='op{{o.id}}-body'>
<div id='op{{o.id}}-text'>{{o.text|linebreaks}}</div>
{% for k in o.komentare %}
<hr>
<div class='comment' id='k{{k.id}}'>
<div class='corr-header'>
<div class='author'>{{k.autor}}</div>
<div class="float-right">
<!-- Komentar !-->
<form action='' onsubmit='save_scroll(this)' method='POST'>
{% csrf_token %}
<input type='hidden' name='id' value='{{k.id}}'>
<input type='hidden' name='scroll'>
{% if forloop.last %}
<button type='submit' name='action' value='del-comment' title='Smaž komentář'
onclick='return confirm("Opravdu smazat komentář?")'>
<img src="{% static "korektury/imgs/delete.png" %}"/>
</button>
{% else %}
<button name='action' value='del-comment' type='button'
title="Komentář nelze smazat &ndash; existuje novější">
<img src="{% static "korektury/imgs/delete-gr.png"%}"/>
</button>
{% endif %}
</form>
<!-- /Komentar !-->
{% if forloop.last %}
<button type='button' onclick="update_comment('op{{o.id}}','kt{{k.id}}');" title='Uprav komentář'>
<img src="{% static "korektury/imgs/edit.png"%}"/>
</button>
{% else %}
<button type='button' title="Komentář nelze upravit &ndash; existuje novější">
<img src="{% static "korektury/imgs/edit-gr.png" %}"/>
</button>
{% endif %}
</div>
</div>
<div id='kt{{k.id}}'>{{k.text|linebreaks}}</div>
</div>
{% endfor %}
</div>
</div> </div>
{% endfor %} {% endfor %}

Loading…
Cancel
Save