mamweb/galerie/templates/galerie/Galerie.html
2025-12-21 19:43:46 +00:00

129 lines
4.9 KiB
HTML

{% extends "galerie/base.html" %}
{% load bazmeky %}
{% block nadpis1a %}
{{galerie.nazev}}: {{ soubor.popisek | default:"Fotka" }}
{% endblock %}
{# přecházení mezi fotkami pomocí šipek #}
{% block script %}
{% with soubory_predchozi|last as predchozi_soubor %}
{% with soubory_dalsi|first as dalsi_soubor %}
<script type="text/javascript">
$(document).ready(function() {
$(document).keydown(function(e) {
// jestliže je aktivní formulář na přidávání komentářů, neodcházej
if ($(document.activeElement).parents("#komentarform").length > 0) {
return;
}
{% if predchozi_soubor %}
// doleva
if (e.which == 37) {
window.location.assign("{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=galerie.pk soubor=predchozi_soubor.pk %}#nahoru");
}
{% endif %}
{% if dalsi_soubor %}
// doprava
if (e.which == 39) {
window.location.assign("{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=galerie.pk soubor=dalsi_soubor.pk %}#nahoru");
}
{% endif %}
if (e.which == 27) {
window.location.assign("{% url 'galerie_galerie' soustredeni=soustredeni.id galerie=galerie.pk %}#obsah");
}
});
$("#prostredni").click(function() {
$("#prostredni").parent().append("<p style='text-align: center;'>Prohrál jsi</p>");
$("#prostredni").off("click");
});
})
</script>
{% endwith %}
{% endwith %}
{% endblock %}
{% block content %}
<div class="{% if soubor.galerie.zobrazit == 1 %}mam-org-only{% endif %}{% if soubor.galerie.zobrazit == 3 %}mam-resitel-only{% endif %}">
<h2>
{% for g in cesta %}
<a href="{% url 'galerie_galerie' soustredeni=soustredeni.id galerie=g.pk %}">{{ g.nazev }}</a>{% if not forloop.last %} >{% endif %}
{% endfor %}
</h2>
<div class="galerie">
{% if soubory_predchozi %}
{% with soubory_predchozi|last as predchozi_soubor %}
<div>
<a title="Předchozí" class="predchozi_obrazek" href="{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=galerie.pk soubor=predchozi_soubor.pk %}#nahoru"></a>
</div>
{% endwith %}
{% endif%}
<span id="nahoru" class="kotva_obrazku"></span>
{% zobrazit soubor.jako_bazmek alt=soubor.popisek title=soubor.popisek class="obrazek" %}
{% if soubory_dalsi %}
{% with soubory_dalsi|first as dalsi_soubor %}
<div>
<a title="Další" class="dalsi_obrazek" href="{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=galerie.pk soubor=dalsi_soubor.pk %}#nahoru"></a>
</div>
{% endwith %}
{% endif%}
</div>
<!--<div>-->
<!--<a href="{{ soubor.soubor.url }}">Obrázek v plné velikosti</a>-->
<!--</div>-->
{# Popisek fotky #}
<div class="popis">
{% if upravy_popisku %}
<form action=".#nahoru" method="post" id="komentarform">
{% csrf_token %}
<table>
<tr><td><label>Aktuální komentář:</label></td><td>{{soubor.popisek}}</td>
{{form.as_table}}
<tr><td></td><td><input name="odeslat" type="submit" value="Změň komentář"></td></tr>
</table>
</form>
{% else %}
{% if soubor.popisek %}
{{soubor.popisek}}
{% endif %}
{% endif %}
</div>
<div class="galerie_nahledy">
{# odkaz na predchozi galerii #}
<div class="navigace">
{% if predchozi_galerie %}
Předchozí: <a href="{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=predchozi_galerie.pk soubor=predchozi_galerie.soubor_set.last.pk %}#nahoru">
{{predchozi_galerie}}
</a>
{% endif %}
{# nahledy predchozich souboru #}
{% for soubor in soubory_predchozi %}
<a href="{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=galerie.pk soubor=soubor.pk %}#nahoru">{% zmenseny_nahled soubor.jako_bazmek height=100 %}</a>
{% endfor %}
{% zmenseny_nahled soubor.jako_bazmek alt=soubor.popisek class="obrazek" id="prostredni" %}
{# nahledy nasledujicich souboru #}
{% for soubor in soubory_dalsi %}
<a href="{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=galerie.pk soubor=soubor.pk %}#nahoru">{% zmenseny_nahled soubor.jako_bazmek height=100 %}</a>
{% endfor %}
{# odkaz na nasledujici galerii #}
{% if nasledujici_galerie %}
Následující: <a href="{% url 'galerie_soubor' soustredeni=soustredeni.id galerie=nasledujici_galerie.pk soubor=nasledujici_galerie.soubor_set.first.pk %}#nahoru">
{{nasledujici_galerie}}
</a>
{% endif %}
</div>
</div>
</div>
{% endblock %}