Šablona a makro pro výpis senzamu galerií

content
Emil Miler 4 years ago
parent 9fc96bb8f0
commit 43e56c306c

@ -2,6 +2,7 @@
title = "Galerie" title = "Galerie"
weight = 4 weight = 4
template = "gallery-list.html"
page_template = "gallery.html" page_template = "gallery.html"
[extra] [extra]

@ -374,6 +374,29 @@ main {
img:hover { box-shadow: 0px 1px 9px #00000088 } img:hover { box-shadow: 0px 1px 9px #00000088 }
} }
.gallery.index {
a {
position: relative;
color: #fff;
}
.description {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
padding: .7rem;
background-color: rgba(46, 52, 64, 0.85);
text-align: left;
font-weight: normal;
font-size: .85rem;
.date {
margin-top: .5em;
text-align: right;
color: #ccc;
}
}
}
.button { .button {
border: 0; border: 0;

@ -0,0 +1,27 @@
{% extends "base.html" %}
{% block styles %}
<link rel="stylesheet" href="{{ get_url(path="fancybox/jquery.fancybox.min.css") }}">
{% endblock styles %}
{% block extra %}
{{ macro::breadcrumbs(page=section) }}
{% endblock %}
{% block content %}
<main class="fullwidth">
<section class="centering">
<h1>{% if section.extra.heading %}
{{ section.extra.heading }}
{% else %}
{{ section.title }}
{% endif %}</h1>
{{ macro::gallery_list() }}
</section>
</main>
{% endblock content %}
{% block javascript %}
<script src="{{ get_url(path="lib/jquery-3.6.0.min.js") }}"></script>
<script src="{{ get_url(path="fancybox/jquery.fancybox.min.js") }}"></script>
{% endblock %}

@ -216,3 +216,32 @@
{% endfor %} {% endfor %}
</div> </div>
{% endmacro %} {% endmacro %}
{% macro gallery_list() %}
<div class="gallery index">
{% for gallery in section.pages %}
<a href="{{ gallery.permalink }}">
{% set_global img_found = 0 %}
{% for asset in gallery.assets %}
{% if asset is matching("[.](jpg|png)$") %}
{% set_global img_found = 1 %}
<img src="{{ resize_image(path=asset, width=300, height=200, op="fill") }}" alt="">
{% break %}
{% endif %}
{% endfor %}
{% if not img_found == 1 %}
<img src="{{ get_url(path="placeholder-avatar.jpg") }}" alt="{{ gallery.title }}">
{% endif %}
<div class="description">
{% if gallery.description %}
{{ gallery.description }}
{% else %}
{{ gallery.title }}
{% endif %}
<div class="date">2021-05-02</div>
</div>
</a>
{% endfor %}
</div>
{% endmacro %}

Loading…
Cancel
Save