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. 45
      galerie/templates/galerie/GalerieNahled.html
  4. 4
      galerie/views.py
  5. 34
      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])
jmeno = os.path.basename(self.obrazek_velky.file.name)
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:
Obrazek._vyrobMiniaturu(original, jmeno, 200, self.obrazek_maly)
super(Obrazek, self).save()

21
galerie/templates/galerie/Galerie.html

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

45
galerie/templates/galerie/GalerieNahled.html

@ -1,8 +1,8 @@
{% extends "galerie/Base.html" %}
{% block title %}{% block nadpis1a %}
{{galerie.nazev}} | Galerie TODO title
{% endblock %}{% endblock %}
{% block nadpis1a %}
Galerie {{galerie.nazev}}
{% endblock %}
{% block content %}
<h2>{{galerie.nazev}}</h2>
@ -10,20 +10,33 @@
{# podgalerie #}
{% if podgalerie or galerie.galerie_up %}
<h3> PODGALERIE </h3>
<ul>
{% if galerie.galerie_up %}
<li><a href="../{{galerie.galerie_up.pk}}">..</a>
<a href="../{{galerie.galerie_up.pk}}">..</a>
{% endif %}
{% if podgalerie %}
<div class="galerie_nahledy">
{% for galerie in podgalerie %}
<div class="podgalerie_nahled">
{% if galerie.zobrazit < 1 or user.is_staff %}
{% with galerie.titulni_obrazek.obrazek_maly as obrazek %}
<a href="../{{galerie.pk}}"><img src="{{ obrazek.url }}"
width={% widthratio obrazek.width 200 167 %}
height={% widthratio obrazek.height 200 167 %} /></a>
{% endwith %}
<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 %}
</div>
{% endfor %}
</div>
{% endif %}
{% for galerie in podgalerie %}
{% if galerie.zobrazit < 1 or user.is_staff %}
<li><a href="../{{galerie.pk}}">{{galerie}}</a>
{% 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 %}
{% endfor %}
</ul>
{% endif %}
{% if user.is_staff and galerie.zobrazit > 0 %}
@ -38,7 +51,7 @@
{% for obrazek in obrazky %}
<div class="galerie_nahled">
<span class="vystredeno"></span>
<a title="Zobrazit tuto fotografii" href="./{{obrazek.pk}}#popis">
<a title="Zobrazit tuto fotografii" href="./{{obrazek.pk}}#nahoru">
<img
src="{{obrazek.obrazek_maly.url}}"
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):
"""Zobrazeni nahledu fotky s id 'fotka'."""
MAX_VYSKA = 600
MAX_SIRKA = 600
MAX_VYSKA = 900
MAX_SIRKA = 900
MAX_VYSKA_MALA = 100
MAX_SIRKA_MALA = 200
NAHLEDU = 1

34
mamweb/static/css/mamweb.css

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

Loading…
Cancel
Save