Improve template markup for img size attrs.
This commit is contained in:
parent
ecac1eec08
commit
b3bcdec2dd
@ -6,7 +6,7 @@ authors = ["Rasmus Kaj <kaj@kth.se>"]
|
|||||||
build = "src/build.rs"
|
build = "src/build.rs"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
ructe = { version = "^0.3.12", features = ["sass", "mime02"] }
|
ructe = { version = "^0.3.14", features = ["sass", "mime02"] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nickel = "~0.10.0"
|
nickel = "~0.10.0"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
@use nickel::Request;
|
@use nickel::Request;
|
||||||
@use nickel_jwt_session::SessionRequestExtensions;
|
@use nickel_jwt_session::SessionRequestExtensions;
|
||||||
@use models::{Photo, Person, Place, Tag, Camera, Coord};
|
@use models::{Photo, Person, Place, Tag, Camera, Coord};
|
||||||
@use server::Link;
|
@use server::{Link, SizeTag};
|
||||||
@use templates::page_base;
|
@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)
|
@(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, {
|
@: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="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">
|
<div class="meta">
|
||||||
@if req.authorized_user().is_some() {
|
@if req.authorized_user().is_some() {
|
||||||
<p><a href="/img/@photo.id-l.jpg">@photo.path</a></p>
|
<p><a href="/img/@photo.id-l.jpg">@photo.path</a></p>
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
@(photo: &PhotoLink)
|
@(photo: &PhotoLink)
|
||||||
<div class="item">@if let Some(ref title) = photo.title {<h2>@title</h2>}
|
<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>}
|
@if let Some(ref d) = photo.lable {<span class="lable">@d</span>}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user