Improve template markup for img size attrs.

This commit is contained in:
Rasmus Kaj 2018-04-08 02:37:02 +02:00
parent ecac1eec08
commit b3bcdec2dd
3 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ authors = ["Rasmus Kaj <kaj@kth.se>"]
build = "src/build.rs"
[build-dependencies]
ructe = { version = "^0.3.12", features = ["sass", "mime02"] }
ructe = { version = "^0.3.14", features = ["sass", "mime02"] }
[dependencies]
nickel = "~0.10.0"

View File

@ -1,13 +1,13 @@
@use nickel::Request;
@use nickel_jwt_session::SessionRequestExtensions;
@use models::{Photo, Person, Place, Tag, Camera, Coord};
@use server::Link;
@use server::{Link, SizeTag};
@use templates::page_base;
@(req: &Request, lpath: &[Link], people: &[Person], places: &[Place], tags: &[Tag], position: &Option<Coord>, attribution: &Option<String>, camera: &Option<Camera>, photo: &Photo)
@:page_base(req, "Photo details", lpath, {
<div class="details" data-imgid="@photo.id"@if let Some(g) = photo.grade { data-grade="@g"}@if let Some(ref p) = *position { data-position="[@p.x, @p.y]"}>
<div class="item"><img src="/img/@photo.id-m.jpg" @if let Some(s) = photo.get_size(960) { width="@s.0" height="@s.1"}></div>
<div class="item"><img src="/img/@photo.id-m.jpg"@if let Some((w,h)) = photo.get_size(SizeTag::Medium.px()) { width="@w" height="@h"}></div>
<div class="meta">
@if req.authorized_user().is_some() {
<p><a href="/img/@photo.id-l.jpg">@photo.path</a></p>

View File

@ -2,6 +2,6 @@
@(photo: &PhotoLink)
<div class="item">@if let Some(ref title) = photo.title {<h2>@title</h2>}
<a href="@photo.href"><img src="/img/@photo.id-s.jpg" @if let Some(s) = photo.size {width="@s.0" height="@s.1"} alt="Photo @photo.id"></a>
<a href="@photo.href"><img src="/img/@photo.id-s.jpg" @if let Some((w, h)) = photo.size {width="@w" height="@h"} alt="Photo @photo.id"></a>
@if let Some(ref d) = photo.lable {<span class="lable">@d</span>}
</div>