2019-07-20 00:46:26 +04:00
|
|
|
@use super::{data_positions, page_base, photo_link};
|
|
|
|
@use crate::models::Coord;
|
|
|
|
@use crate::server::{Context, PhotoLink};
|
|
|
|
@use crate::server::search::SearchQuery;
|
|
|
|
|
|
|
|
@(context: &Context, query: &SearchQuery, photos: &[PhotoLink], coords: &[(Coord, i32)])
|
|
|
|
|
|
|
|
@:page_base(context, "Search", &[], {}, {
|
|
|
|
|
|
|
|
<form class="search" action="/search/" method="get">
|
|
|
|
<label for="s_q" accesskey="s" title="Search">🔍</label>
|
|
|
|
<div class="refs">
|
2019-09-29 17:16:05 +04:00
|
|
|
@for p in &query.p {
|
|
|
|
<label class="@if !p.inc {not }p">@p.item.person_name <input type="checkbox" name="p" value="@if !p.inc {!}@p.item.slug" checked/></label>
|
2019-08-13 20:57:15 +04:00
|
|
|
}
|
2019-09-29 17:16:05 +04:00
|
|
|
@for t in &query.t {
|
|
|
|
<label class="@if !t.inc {not }t">@t.item.tag_name <input type="checkbox" name="t" value="@if !t.inc {!}@t.item.slug" checked/></label>
|
2019-08-13 20:57:15 +04:00
|
|
|
}
|
2019-09-29 17:16:05 +04:00
|
|
|
@for l in &query.l {
|
|
|
|
<label class="@if !l.inc {not }l">@l.item.place_name <input type="checkbox" name="l" value="@if !l.inc {!}@l.item.slug" checked/></label>
|
2019-07-20 00:46:26 +04:00
|
|
|
}
|
2019-08-01 23:04:46 +04:00
|
|
|
@if let Some(pos) = &query.pos {
|
2019-09-24 13:24:22 +04:00
|
|
|
<label@if !pos { class="not"}>pos <input type="checkbox" name="pos" value="@if !pos {!}t" checked/></label>
|
2019-08-01 23:04:46 +04:00
|
|
|
}
|
2019-07-20 00:46:26 +04:00
|
|
|
<input id="s_q" name="q" type="search"/>
|
|
|
|
</div>
|
|
|
|
<div class="time">
|
|
|
|
<span><input type="date" name="since_date" value='@query.since.map(|d| d.format("%Y-%m-%d").to_string()).unwrap_or_default()'><input type="time" name="since_time" value='@query.since.map(|d| d.format("%H:%M:%S").to_string()).unwrap_or_default()'></span>
|
|
|
|
-
|
|
|
|
<span><input type="date" name="until_date" value='@query.until.map(|d| d.format("%Y-%m-%d").to_string()).unwrap_or_default()'><input type="time" name="until_time" value='@query.until.map(|d| d.format("%H:%M:%S").to_string()).unwrap_or_default()'></span>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
@if !query.q.is_empty() {
|
|
|
|
<p>Sorry, no raw queries supported yet.
|
|
|
|
Try selection some suggestions
|
|
|
|
(javascript is needed for this, sorry again).</p>
|
|
|
|
}
|
|
|
|
<div class="group"@:data_positions(coords)>
|
|
|
|
@for p in photos {@:photo_link(p)}
|
|
|
|
</div>
|
|
|
|
})
|