redsunlib/templates/user.html
2021-09-06 12:02:52 -07:00

97 lines
2.9 KiB
HTML

{% extends "base.html" %}
{% import "utils.html" as utils %}
{% block search %}
{% call utils::search("".to_owned(), "", "") %}
{% endblock %}
{% block title %}{{ user.name.replace("u/", "") }} (u/{{ user.name }}) - Libreddit{% endblock %}
{% block subscriptions %}
{% call utils::sub_list("") %}
{% endblock %}
{% block body %}
<main>
<div id="column_one">
<form id="sort">
<select name="sort">
{% call utils::options(sort.0, ["hot", "new", "top"], "") %}
</select>{% if sort.0 == "top" %}<select id="timeframe" name="t">
{% call utils::options(sort.1, ["hour", "day", "week", "month", "year", "all"], "all") %}
</select>{% endif %}<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>
</form>
<div id="posts">
{% for post in posts %}
{% if post.flags.nsfw && prefs.show_nsfw != "on" %}
{% else if post.title != "Comment" %}
{% call utils::post_in_list(post) %}
{% else %}
<div class="comment">
<div class="comment_left">
<p class="comment_score" title="{{ post.score.1 }}">{{ post.score.0 }}</p>
<div class="line"></div>
</div>
<details class="comment_right" open>
<summary class="comment_data">
<a class="comment_link" href="{{ post.permalink }}">COMMENT</a>
<span class="created" title="{{ post.created }}">{{ post.rel_time }}</span>
</summary>
<p class="comment_body">{{ post.body }}</p>
</details>
</div>
{% endif %}
{% endfor %}
{% if prefs.use_hls == "on" %}
<script src="/hls.min.js"></script>
<script src="/playHLSVideo.js"></script>
{% endif %}
</div>
<footer>
{% if ends.0 != "" %}
<a href="?sort={{ sort.0 }}&t={{ sort.1 }}&before={{ ends.0 }}">PREV</a>
{% endif %}
{% if ends.1 != "" %}
<a href="?sort={{ sort.0 }}&t={{ sort.1 }}&after={{ ends.1 }}">NEXT</a>
{% endif %}
</footer>
</div>
<aside>
<div class="panel" id="user">
<img loading="lazy" id="user_icon" src="{{ user.icon }}" alt="User icon">
<p id="user_title">{{ user.title }}</p>
<p id="user_name">u/{{ user.name }}</p>
<div id="user_description">{{ user.description }}</div>
<div id="user_details">
<label>Karma</label>
<label>Created</label>
<div>{{ user.karma }}</div>
<div>{{ user.created }}</div>
</div>
<div id="user_subscription">
{% let name = ["u_", user.name.as_str()].join("") %}
{% if prefs.subscriptions.contains(name) %}
<form action="/r/u_{{ user.name }}/unsubscribe" method="POST">
<button class="unsubscribe">Unfollow</button>
</form>
{% else %}
<form action="/r/u_{{ user.name }}/subscribe" method="POST">
<button class="subscribe">Follow</button>
</form>
{% endif %}
</div>
</div>
</aside>
</main>
{% endblock %}