Simplify image gallery logic

This commit is contained in:
Zed 2019-06-23 22:06:48 +02:00
parent 096471b50d
commit c559ab1f1a

View file

@ -34,16 +34,15 @@
#var first = true #var first = true
<div class="attachments media-body"> <div class="attachments media-body">
#for photos in groups: #for photos in groups:
#let style = if first: "" else: "margin-top: .25em;" #let margin = if not first: "margin-top: .25em;" else: ""
<div class="gallery-row cover-fit" style="${style}"> #let flex = if photos.len > 1 or groups.len > 1: "display: flex;" else: ""
<div class="gallery-row cover-fit" style="${margin}">
#for photo in photos: #for photo in photos:
<div class="attachment image"> <div class="attachment image">
##TODO: why doesn't this work? ##TODO: why doesn't this work?
<a href=${getSigUrl(photo & "?name=orig", "pic")} target="_blank" class="image-attachment"> <a href=${getSigUrl(photo & "?name=orig", "pic")} target="_blank" class="image-attachment">
#let style = if photos.len > 1 or groups.len > 1: "display: flex;" else: "" <div class="still-image" style="${flex}">
#let istyle = if photos.len > 1 or groups.len > 1: "" else: "border-radius: 7px;" <img src=${getSigUrl(photo, "pic")} referrerpolicy="">
<div class="still-image" style="${style}">
<img src=${getSigUrl(photo, "pic")} referrerpolicy="" style="${istyle}">
</div> </div>
</a> </a>
</div> </div>