Browse Source

Galerie: drobné úpravy

remotes/origin/imagekit
Matěj Kocián 9 years ago
parent
commit
fea69385fd
  1. 2
      galerie/models.py
  2. 21
      galerie/templates/galerie/Galerie.html
  3. 37
      galerie/templates/galerie/GalerieNahled.html
  4. 4
      galerie/views.py
  5. 26
      mamweb/static/css/mamweb.css

2
galerie/models.py

@ -104,7 +104,7 @@ class Obrazek(models.Model):
datum_int[3], datum_int[4], datum_int[5]) datum_int[3], datum_int[4], datum_int[5])
jmeno = os.path.basename(self.obrazek_velky.file.name) jmeno = os.path.basename(self.obrazek_velky.file.name)
if not self.obrazek_stredni: if not self.obrazek_stredni:
Obrazek._vyrobMiniaturu(original, jmeno, 600, self.obrazek_stredni) Obrazek._vyrobMiniaturu(original, jmeno, 1024, self.obrazek_stredni)
if not self.obrazek_maly: if not self.obrazek_maly:
Obrazek._vyrobMiniaturu(original, jmeno, 200, self.obrazek_maly) Obrazek._vyrobMiniaturu(original, jmeno, 200, self.obrazek_maly)
super(Obrazek, self).save() super(Obrazek, self).save()

21
galerie/templates/galerie/Galerie.html

@ -1,12 +1,13 @@
{% extends "galerie/Base.html" %} {% extends "galerie/Base.html" %}
{% block title %}{% block nadpis1a %} {% block nadpis1a %}
{{galerie.nazev}} | Galerie {{galerie.nazev}}: {{ obrazek.popis | default:"Fotka" }}
{% endblock %}{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="popis"> <h2>{{ obrazek.nazev }}</h2>
<h2><a title="Zpět na náhled fotek" href="../#obsah">{{galerie.nazev}}</a></h2> <div id="nahoru">
<a title="Zpět do galerie" href="../#obsah">Zpět na: {{galerie.nazev}}</a>
</div> </div>
@ -15,23 +16,27 @@
{% if obrazky_predchozi %} {% if obrazky_predchozi %}
{% with obrazky_predchozi|last as predchozi_obrazek %} {% with obrazky_predchozi|last as predchozi_obrazek %}
<div> <div>
<a title="Předchozí" class="predchozi_obrazek" href="../{{predchozi_obrazek.pk}}#popis"></a> <a title="Předchozí" class="predchozi_obrazek" href="../{{predchozi_obrazek.pk}}#nahoru"></a>
</div> </div>
{% endwith %} {% endwith %}
{% endif%} {% endif%}
<img src={{obrazek.obrazek_stredni.url}} <img src="{{obrazek.obrazek_stredni.url}}"
height="{{vyska}}" height="{{vyska}}"
width="{{sirka}}" width="{{sirka}}"
alt="{{obrazek.popis}}" alt="{{obrazek.popis}}"
class="obrazek"> class="obrazek">
{% if obrazky_dalsi %} {% if obrazky_dalsi %}
{% with obrazky_dalsi|first as dalsi_obrazek %} {% with obrazky_dalsi|first as dalsi_obrazek %}
<div> <div>
<a title="Další" class="dalsi_obrazek" href="../{{dalsi_obrazek.pk}}#popis"></a> <a title="Další" class="dalsi_obrazek" href="../{{dalsi_obrazek.pk}}#nahoru"></a>
</div> </div>
{% endwith %} {% endwith %}
{% endif%} {% endif%}
</div> </div>
{# <div> #}
{# <a href="{{ obrazek.obrazek_velky.url }}">Obrázek v plné velikosti</a> #}
{# </div> #}
{# Popisek fotky #} {# Popisek fotky #}
<div class="popis"> <div class="popis">

37
galerie/templates/galerie/GalerieNahled.html

@ -1,8 +1,8 @@
{% extends "galerie/Base.html" %} {% extends "galerie/Base.html" %}
{% block title %}{% block nadpis1a %} {% block nadpis1a %}
{{galerie.nazev}} | Galerie TODO title Galerie {{galerie.nazev}}
{% endblock %}{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h2>{{galerie.nazev}}</h2> <h2>{{galerie.nazev}}</h2>
@ -10,20 +10,33 @@
{# podgalerie #} {# podgalerie #}
{% if podgalerie or galerie.galerie_up %} {% if podgalerie or galerie.galerie_up %}
<h3> PODGALERIE </h3> <h3> PODGALERIE </h3>
<ul>
{% if galerie.galerie_up %} {% if galerie.galerie_up %}
<li><a href="../{{galerie.galerie_up.pk}}">..</a> <a href="../{{galerie.galerie_up.pk}}">..</a>
{% endif %} {% endif %}
{% if podgalerie %}
<div class="galerie_nahledy">
{% for galerie in podgalerie %} {% for galerie in podgalerie %}
<div class="podgalerie_nahled">
{% if galerie.zobrazit < 1 or user.is_staff %} {% if galerie.zobrazit < 1 or user.is_staff %}
<li><a href="../{{galerie.pk}}">{{galerie}}</a> {% with galerie.titulni_obrazek.obrazek_maly as obrazek %}
{% if user.is_staff and galerie.zobrazit > 0 %} <a href="../{{galerie.pk}}"><img src="{{ obrazek.url }}"
({{galerie.poradi}}) width={% widthratio obrazek.width 200 167 %}
<span class="plus"><a href="plus/{{galerie.pk}}/">+</a></span> height={% widthratio obrazek.height 200 167 %} /></a>
<span class="minus"><a href="minus/{{galerie.pk}}/">-</a></span> {% endwith %}
{% endif %} <div>
<a href="../{{ galerie.pk }}">{{ galerie }}</a>
</div>
{# {% if user.is_staff and galerie.zobrazit > 0 %} #}
{# ({{galerie.poradi}}) #}
{# <span class="plus"><a href="plus/{{galerie.pk}}/">+</a></span> #}
{# <span class="minus"><a href="minus/{{galerie.pk}}/">-</a></span> #}
{# {% endif %} #}
{% endif %} {% endif %}
</div>
{% endfor %} {% endfor %}
</div>
{% endif %}
</ul> </ul>
{% endif %} {% endif %}
{% if user.is_staff and galerie.zobrazit > 0 %} {% if user.is_staff and galerie.zobrazit > 0 %}
@ -38,7 +51,7 @@
{% for obrazek in obrazky %} {% for obrazek in obrazky %}
<div class="galerie_nahled"> <div class="galerie_nahled">
<span class="vystredeno"></span> <span class="vystredeno"></span>
<a title="Zobrazit tuto fotografii" href="./{{obrazek.pk}}#popis"> <a title="Zobrazit tuto fotografii" href="./{{obrazek.pk}}#nahoru">
<img <img
src="{{obrazek.obrazek_maly.url}}" src="{{obrazek.obrazek_maly.url}}"
width={% widthratio obrazek.obrazek_maly.width 200 167 %} width={% widthratio obrazek.obrazek_maly.width 200 167 %}

4
galerie/views.py

@ -35,8 +35,8 @@ def nahled(request, pk, soustredeni):
def detail(request, pk, fotka, soustredeni): def detail(request, pk, fotka, soustredeni):
"""Zobrazeni nahledu fotky s id 'fotka'.""" """Zobrazeni nahledu fotky s id 'fotka'."""
MAX_VYSKA = 600 MAX_VYSKA = 900
MAX_SIRKA = 600 MAX_SIRKA = 900
MAX_VYSKA_MALA = 100 MAX_VYSKA_MALA = 100
MAX_SIRKA_MALA = 200 MAX_SIRKA_MALA = 200
NAHLEDU = 1 NAHLEDU = 1

26
mamweb/static/css/mamweb.css

@ -470,7 +470,7 @@ div.zadani_azad_termin {
.galerie { .galerie {
position: relative; position: relative;
text-align: center; text-align: center;
width: 630px; /*width: 100%;*/
margin: 0 auto 0 auto; margin: 0 auto 0 auto;
} }
@ -479,14 +479,18 @@ div.zadani_azad_termin {
} }
.popis { .popis {
text-align: center;
margin: 10px 10px 30px 10px; margin: 10px 10px 30px 10px;
} }
#nahoru {
text-align: center;
}
.galerie_nahledy{ .galerie_nahledy{
/*margin: 1em 0;*/ /*margin: 1em 0;*/
margin: 0 auto 0 auto; margin: 0 auto 0 auto;
text-align: center; text-align: center;
overflow: auto;
} }
.galerie_nahledy img{ .galerie_nahledy img{
@ -499,15 +503,18 @@ div.zadani_azad_termin {
} }
.galerie_nahled{ /* frame */ .galerie_nahled{ /* frame */
position: relative;
float: left; float: left;
width: 190px; width: 200px;
height: 190px; height: 200px;
text-align: center; text-align: center;
border: solid; border: solid;
border-width: 2px; border-width: 2px;
border-radius: 5px; border-radius: 5px;
border-color: #ffa500; /*border-color: #ffa500;*/
background-color: #ffb52d; border-color: #ffd546;
/*background-color: #ffb52d;*/
background-color: white;
white-space: nowrap; white-space: nowrap;
margin: 10px; margin: 10px;
} }
@ -525,6 +532,13 @@ div.zadani_azad_termin {
max-width: 180px; max-width: 180px;
} }
.galerie_nahled div {
position: absolute;
bottom: 0px;
width: 100%;
text-align: center;
}
/* titulni stranka */ /* titulni stranka */

Loading…
Cancel
Save