samey/templates/pages/posts.html

68 lines
2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>Posts - {{ application_name }}</title>
{% include "fragments/common_headers.html" %}
</head>
<body>
<div><a href="/">&lt; To home</a></div>
<article>
<h2>Search</h2>
<form method="get" action="/posts">
{% let tags_value = tags_text.clone().unwrap_or("".into()) %} {% include "fragments/tags_input.html" %}
<ul class="reset tags-autocomplete" id="search-autocomplete"></ul>
<button type="submit">Search</button>
</form>
</article>
{% if let Some(tags) = tags %}
{% if !tags.is_empty() %}
<article>
<h2>Tags</h2>
<ul>
{% for tag in tags %}
<li><a href="/posts?tags={{ tag }}">{{ tag }}</a></li>
{% endfor %}
</ul>
</article>
{% endif %}
{% endif %}
<main>
<h1>Posts</h1>
{% if posts.is_empty() %}
<div>No posts found!</div>
{% else %}
<div>
<ul class="reset flex">
{% for post in posts %}
<li>
<a
href="{% if let Some(tags_text) = tags_text %}/post/{{ post.id }}?tags={{ tags_text.replace(' ', "+") }}{% else %}/post/{{ post.id }}{% endif %}"
title="{% if let Some(tags) = post.tags %}{{ tags }}{% endif %}"
>
<img src="/files/{{ post.thumbnail }}" />
<div class="flex">
<div>{{ post.rating | upper }}</div>
<div>{{ post.media_type }}</div>
</div>
</a>
</li>
{% endfor %}
</ul>
</div>
<div>
<ul>
{% for i in 1..=page_count %}
<li>
{% if i == page as u64 %}
<b>{{ i }}</b>
{% else %}
<a href="{% if let Some(tags_text) = tags_text %}/posts/{{ i }}?tags={{ tags_text.replace(' ', "+") }}{% else %}/posts/{{ i }}{% endif %}">{{ i }}</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</main>
</body>
</html>