libreddit/templates/post.html

131 lines
4.9 KiB
HTML
Raw Normal View History

2020-11-23 01:29:05 +01:00
{% extends "base.html" %}
2021-01-01 00:54:13 +01:00
{% import "utils.html" as utils %}
2020-11-23 01:29:05 +01:00
{% block title %}{{ post.title }} - r/{{ post.community }}{% endblock %}
2021-01-01 00:54:13 +01:00
{% block search %}
{% call utils::search(["/r/", post.community.as_str()].concat(), "") %}
{% endblock %}
{% block root %}/r/{{ post.community }}{% endblock %}{% block location %}r/{{ post.community }}{% endblock %}
2020-11-23 01:29:05 +01:00
{% block head %}
{% call super() %}
2021-02-16 20:16:32 +01:00
<!-- Meta Tags -->
2021-01-17 00:02:24 +01:00
<meta name="author" content="u/{{ post.author.name }}">
2021-02-16 20:16:32 +01:00
<meta name="title" content="{{ post.title }} - r/{{ post.community }}">
<meta property="og:type" content="website">
<meta property="og:url" content="{{ post.permalink }}">
<meta property="og:title" content="{{ post.title }} - r/{{ post.community }}">
<meta property="og:description" content="View on Libreddit, an alternative private front-end to Reddit.">
<meta property="og:image" content="{{ post.thumbnail.url }}">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="{{ post.permalink }}">
<meta property="twitter:title" content="{{ post.title }} - r/{{ post.community }}">
<meta property="twitter:description" content="View on Libreddit, an alternative private front-end to Reddit.">
<meta property="twitter:image" content="{{ post.thumbnail.url }}">
2020-11-23 01:29:05 +01:00
{% endblock %}
2020-12-20 04:54:46 +01:00
2021-01-30 09:47:30 +01:00
{% block subscriptions %}
2021-01-30 23:52:18 +01:00
{% call utils::sub_list(post.community.as_str()) %}
{% endblock %}
2020-11-23 01:29:05 +01:00
{% block content %}
2020-12-24 07:16:04 +01:00
<div id="column_one">
2021-01-04 04:44:44 +01:00
<!-- POST CONTENT -->
2021-01-06 03:04:49 +01:00
<div class="post highlighted">
<p class="post_header">
<a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a>
<span class="dot">&bull;</span>
<a class="post_author" href="/u/{{ post.author.name }}">u/{{ post.author.name }}</a>
{% if post.author.flair.flair_parts.len() > 0 %}
<small class="author_flair">{% call utils::render_flair(post.author.flair.flair_parts) %}</small>
{% endif %}
<span class="dot">&bull;</span>
<span class="created" title="{{ post.created }}">{{ post.rel_time }}</span>
</p>
<p class="post_title">
<a href="{{ post.permalink }}">{{ post.title }}</a>
{% if post.flair.flair_parts.len() > 0 %}
2021-02-22 05:28:04 +01:00
<a href="/r/{{ post.community }}/search/?q=flair_name%3A%22{{ post.flair.text }}%22&restrict_sr=on"
class="post_flair"
style="color:{{ post.flair.foreground_color }}; background:{{ post.flair.background_color }};">{% call utils::render_flair(post.flair.flair_parts) %}</a>
{% endif %}
{% if post.flags.nsfw %} <small class="nsfw">NSFW</small>{% endif %}
</p>
2021-01-05 04:26:41 +01:00
<!-- POST MEDIA -->
{% if post.post_type == "image" %}
<a href="{{ post.media.url }}" class="post_media_image" >
<svg
width="{{ post.media.width }}px"
height="{{ post.media.height }}px"
xmlns="http://www.w3.org/2000/svg">
<image width="100%" height="100%" href="{{ post.media.url }}"/>
<desc>
<img alt="Post image" src="{{ post.media.url }}"/>
2021-02-01 20:25:57 +01:00
</desc>
</svg>
</a>
{% else if post.post_type == "video" || post.post_type == "gif" %}
<video class="post_media_video" src="{{ post.media.url }}" controls autoplay loop><a href={{ post.media.url }}>Video</a></video>
2021-02-06 21:05:11 +01:00
{% else if post.post_type == "gallery" %}
<div class="gallery">
{% for image in post.gallery -%}
<figure>
<a href="{{ image.url }}" ><img alt="Gallery image" src="{{ image.url }}"/></a>
<figcaption>
<p>{{ image.caption }}</p>
{% if image.outbound_url.len() > 0 %}
<p><a class="outbound_url" href="{{ image.outbound_url }}">{{ image.outbound_url }}</a>
{% endif %}
</figcaption>
</figure>
{%- endfor %}
</div>
{% else if post.post_type == "link" %}
2021-01-17 21:58:12 +01:00
<a id="post_url" href="{{ post.media.url }}">{{ post.media.url }}</a>
{% endif %}
<!-- POST BODY -->
<div class="post_body">{{ post.body }}</div>
<div class="post_score">{{ post.score }}<span class="label"> Upvotes</span></div>
<div class="post_footer">
<ul id="post_links">
<li><a href="/{{ post.id }}">permalink</a></li>
<li><a href="https://reddit.com/{{ post.id }}">reddit</a></li>
</ul>
<p>{{ post.upvote_ratio }}% Upvoted</p>
2020-12-24 07:16:04 +01:00
</div>
2020-11-23 01:29:05 +01:00
</div>
2021-01-04 04:44:44 +01:00
<!-- SORT FORM -->
2021-01-01 00:54:13 +01:00
<form id="sort">
2021-01-17 23:49:36 +01:00
<select name="sort" title="Sort comments by">
2021-01-07 17:38:05 +01:00
{% call utils::options(sort, ["confidence", "top", "new", "controversial", "old"], "confidence") %}
2021-01-18 00:51:03 +01:00
</select><button id="sort_submit" class="submit">
<svg width="15" viewBox="0 0 110 100" fill="none" stroke-width="10" stroke-linecap="round">
<path d="M20 50 H100" />
<path d="M75 15 L100 50 L75 85" />
&rarr;
</svg>
</button>
2020-12-24 07:16:04 +01:00
</form>
2020-12-20 04:54:46 +01:00
2021-01-04 04:44:44 +01:00
<!-- COMMENTS -->
2020-12-24 07:16:04 +01:00
{% for c in comments -%}
2021-01-04 04:44:44 +01:00
<div class="thread">
{% if single_thread %}
<p class="thread_nav"><a href="/{{ post.id }}">View all comments</a></p>
{% if c.parent_kind == "t1" %}
<p class="thread_nav"><a href="?context=9999">Show parent comments</a></p>
{% endif %}
{% endif %}
{{ c.render().unwrap() }}
2021-01-04 04:44:44 +01:00
</div>
2020-12-24 07:16:04 +01:00
{%- endfor %}
2021-01-04 04:44:44 +01:00
2020-12-24 07:16:04 +01:00
</div>
2021-01-12 22:43:03 +01:00
{% endblock %}