redsunlib/templates/post.html

137 lines
4.9 KiB
HTML
Raw Normal View History

2020-11-23 13:29:05 +13:00
{% extends "base.html" %}
2021-01-01 12:54:13 +13:00
{% import "utils.html" as utils %}
2020-11-23 13:29:05 +13:00
{% block title %}{{ post.title }} - r/{{ post.community }}{% endblock %}
2021-01-01 12:54:13 +13: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 13:29:05 +13:00
{% block head %}
{% call super() %}
2021-01-17 12:02:24 +13:00
<meta name="author" content="u/{{ post.author.name }}">
2020-11-23 13:29:05 +13:00
{% endblock %}
2020-12-20 16:54:46 +13:00
2021-01-30 21:47:30 +13:00
{% block subscriptions %}
2021-01-30 23:21:54 +13:00
{% call utils::sub_list(post.community.as_str(), "narrow") %}
{% endblock %}
2021-01-04 16:44:44 +13:00
<!-- OPEN COMMENT MACRO -->
2020-12-20 16:54:46 +13:00
{% macro comment(item) -%}
<div id="{{ item.id }}" class="comment">
2020-12-20 16:54:46 +13:00
<div class="comment_left">
2020-12-29 15:42:46 +13:00
<p class="comment_score">{{ item.score }}</p>
2020-12-20 16:54:46 +13:00
<div class="line"></div>
</div>
<details class="comment_right" open>
2021-01-17 12:02:24 +13:00
<summary class="comment_data">
<a class="comment_author {{ item.author.distinguished }} {% if item.author.name == post.author.name %}op{% endif %}" href="/u/{{ item.author.name }}">u/{{ item.author.name }}</a>
{% if item.author.flair.flair_parts.len() > 0 %}
<small class="author_flair">{% call utils::render_flair(item.author.flair.flair_parts) %}</small>
2021-01-13 11:34:16 +13:00
{% endif %}
<span class="created" title="{{ post.created }}">{{ item.rel_time }}</span>
2020-12-20 16:54:46 +13:00
</summary>
2021-01-13 17:18:20 +13:00
<div class="comment_body">{{ item.body }}</div>
2020-12-20 16:54:46 +13:00
{%- endmacro %}
2021-01-04 16:44:44 +13:00
<!-- CLOSE COMMENT MACRO -->
{% macro close() %}
</details></div>
{% endmacro %}
2020-11-23 13:29:05 +13:00
{% block content %}
2020-12-24 19:16:04 +13:00
<div id="column_one">
2021-01-04 16:44:44 +13:00
<!-- POST CONTENT -->
2021-01-06 15:04:49 +13: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 %}
<small class="post_flair" style="color:{{ post.flair.foreground_color }}; background:{{ post.flair.background_color }};">{% call utils::render_flair(post.flair.flair_parts) %}</small>
{% endif %}
{% if post.flags.nsfw %} <small class="nsfw">NSFW</small>{% endif %}
</p>
2021-01-05 16:26:41 +13:00
<!-- POST MEDIA -->
{% if post.post_type == "image" %}
<a href="{{ post.media.url }}" style="display:contents" >
<svg class="post_media"
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 }}"/>
</dev>
</svg>
</a>
{% else if post.post_type == "video" || post.post_type == "gif" %}
2021-01-29 18:53:10 +13:00
<video class="post_media" src="{{ post.media.url }}" controls autoplay loop></video>
{% else if post.post_type == "link" %}
2021-01-18 09:58:12 +13: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 19:16:04 +13:00
</div>
2020-11-23 13:29:05 +13:00
</div>
2021-01-04 16:44:44 +13:00
<!-- SORT FORM -->
2021-01-01 12:54:13 +13:00
<form id="sort">
2021-01-18 11:49:36 +13:00
<select name="sort" title="Sort comments by">
2021-01-08 05:38:05 +13:00
{% call utils::options(sort, ["confidence", "top", "new", "controversial", "old"], "confidence") %}
2021-01-18 12:51:03 +13: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 19:16:04 +13:00
</form>
2020-12-20 16:54:46 +13:00
2021-01-04 16:44:44 +13:00
<!-- COMMENTS -->
2020-12-24 19:16:04 +13:00
{% for c in comments -%}
2021-01-04 16:44:44 +13:00
<div class="thread">
<!-- EACH COMMENT -->
{% call comment(c) %}
2021-01-16 23:00:15 +13:00
<blockquote class="replies">{% for reply1 in c.replies %}{% call comment(reply1) %}
2021-01-04 16:44:44 +13:00
<!-- FIRST-LEVEL REPLIES -->
2021-01-16 23:00:15 +13:00
<blockquote class="replies">{% for reply2 in reply1.replies %}{% call comment(reply2) %}
2021-01-04 16:44:44 +13:00
<!-- SECOND-LEVEL REPLIES -->
2021-01-16 23:00:15 +13:00
<blockquote class="replies">{% for reply3 in reply2.replies %}{% call comment(reply3) %}
2021-01-04 16:44:44 +13:00
<!-- THIRD-LEVEL REPLIES -->
{% if reply3.replies.len() > 0 %}
<!-- LINK TO CONTINUE REPLIES -->
<a class="deeper_replies" href="{{ post.permalink }}{{ reply3.id }}">&rarr; More replies</a>
{% endif %}
{% call close() %}
2020-12-24 19:16:04 +13:00
{% endfor %}
2021-01-16 23:00:15 +13:00
</blockquote>{% call close() %}
2021-01-04 16:44:44 +13:00
{% endfor %}
2021-01-16 23:00:15 +13:00
</blockquote>{% call close() %}
2021-01-04 16:44:44 +13:00
{% endfor %}
2021-01-16 23:00:15 +13:00
</blockquote>{% call close() %}
2021-01-04 16:44:44 +13:00
</div>
2020-12-24 19:16:04 +13:00
{%- endfor %}
2021-01-04 16:44:44 +13:00
2020-12-24 19:16:04 +13:00
</div>
2021-01-13 10:43:03 +13:00
{% endblock %}