115 lines
4.3 KiB
HTML
115 lines
4.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>Post #{{ post.id }} - {{ application_name }}</title>
|
|
{% include "fragments/common_headers.html" %}
|
|
<meta property="og:site_name" content="{{ application_name }}" />
|
|
<meta
|
|
property="og:title"
|
|
content="{% if let Some(title) = post.title %}{{ title }}{% endif %}"
|
|
/>
|
|
<meta property="og:url" content="/post/{{ post.id }}" />
|
|
<meta
|
|
property="og:description"
|
|
content="{% if let Some(description) = post.description %}{{ description }}{% endif %}"
|
|
/>
|
|
<meta
|
|
property="twitter:title"
|
|
content="{% if let Some(title) = post.title %}{{ title }}{% endif %}"
|
|
/>
|
|
{% match post.media_type.as_ref() %} {% when "image" %}
|
|
<meta property="og:image" content="/files/{{ post.media }}" />
|
|
<meta property="og:image:width" content="{{ post.width }}" />
|
|
<meta property="og:image:height" content="{{ post.height }}" />
|
|
<meta property="og:image:alt" content="{{ tags_post }}" />
|
|
<meta property="twitter:card" content="summary_large_image" />
|
|
{% when "video" %}
|
|
<meta property="og:video" content="/files/{{ post.media }}" />
|
|
<meta property="og:video:width" content="{{ post.width }}" />
|
|
<meta property="og:video:height" content="{{ post.height }}" />
|
|
<meta property="og:video:alt" content="{{ tags_post }}" />
|
|
<meta property="og:video:type" content="video/mp4" />
|
|
<meta property="twitter:card" content="player" />
|
|
<meta name="twitter:player" content="/files/{{ post.media }}" />
|
|
<meta name="twitter:player:width" content="{{ post.width }}" />
|
|
<meta name="twitter:player:height" content="{{ post.height }}" />
|
|
<meta name="twitter:image" content="/files/{{ post.thumbnail }}" />
|
|
{% else %} {% endmatch %}
|
|
</head>
|
|
<body>
|
|
<div><a href="{% if let Some(tags_text) = tags_text %}/posts/1?tags={{ tags_text.replace(' ', "+") }}{% else %}/posts/1{% endif %}">< To posts</a></div>
|
|
<article>
|
|
<h2>Search</h2>
|
|
<form method="get" action="/posts">
|
|
<input
|
|
class="tags"
|
|
type="text"
|
|
id="search-tags"
|
|
name="tags"
|
|
hx-post="/search_tags"
|
|
hx-trigger="input changed"
|
|
hx-target="next .tags-autocomplete"
|
|
hx-vals="js:{selection_end: event.target.selectionEnd}"
|
|
hx-on::after-settle="this.focus(); this.setSelectionRange(-1, -1);"
|
|
value="{% if let Some(tags_text) = tags_text %}{{ tags_text }}{% endif %}"
|
|
autofocus
|
|
/>
|
|
<ul class="tags-autocomplete" id="search-autocomplete"></ul>
|
|
<button type="submit">Search</button>
|
|
</form>
|
|
</article>
|
|
<article>
|
|
<h2>Tags</h2>
|
|
{% if tags.is_empty() %}
|
|
<p>No tags in post. Consider adding some!</p>
|
|
{% else %}
|
|
<ul id="tags-list">
|
|
{% for tag in tags %}
|
|
<li>
|
|
<a href="/posts?tags={{ tag.name }}">{{ tag.name }}</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</article>
|
|
<main>
|
|
<h1>View post #{{ post.id }}</h1>
|
|
<div>
|
|
{% match post.media_type.as_ref() %}{% when "image" %}{% include
|
|
"fragments/get_image_media.html" %}{% when "video" %}{% include
|
|
"fragments/get_video_media.html" %}{% else %}{% endmatch %}
|
|
</div>
|
|
</main>
|
|
<article>
|
|
<h2>Details</h2>
|
|
{% include "fragments/post_details.html" %}
|
|
</article>
|
|
{% if let Some(parent_post) = parent_post %}
|
|
<article id="parent-post">
|
|
<h2>Parent</h2>
|
|
<a href="/post/{{ parent_post.id }}" title="{% if let Some(tags) = parent_post.tags %}{{ tags }}{% endif %}">
|
|
<img src="/files/{{ parent_post.thumbnail }}" />
|
|
<div>{{ parent_post.rating }}</div>
|
|
<div>{{ parent_post.media_type }}</div>
|
|
</a>
|
|
</article>
|
|
{% else %}
|
|
<article id="parent-post" hidden></article>
|
|
{% endif %} {% if !children_posts.is_empty() %}
|
|
<article>
|
|
<h2>Child posts</h2>
|
|
<ul>
|
|
{% for child_post in children_posts %}
|
|
<li>
|
|
<a href="/post/{{ child_post.id }}" title="{% if let Some(tags) = child_post.tags %}{{ tags }}{% endif %}">
|
|
<img src="/files/{{ child_post.thumbnail }}" />
|
|
<div>{{ child_post.rating | upper }}</div>
|
|
<div>{{ child_post.media_type }}</div>
|
|
</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</article>
|
|
{% endif %}
|
|
</body>
|
|
</html>
|