lib.itmens/common/templates/_sidebar.html

234 lines
8.5 KiB
HTML
Raw Normal View History

{% load static %}
{% load i18n %}
2024-06-03 07:27:44 -04:00
{% load humanize %}
{% load mastodon %}
{% load thumb %}
{% load collection %}
{% load bleach_tags %}
2024-04-06 11:53:31 -04:00
{% load duration %}
<aside class="grid__aside sidebar">
{% if request.user.unread_announcements %}
<section class="announcement">
<article>
2024-04-17 00:00:40 -04:00
<details open>
2024-05-20 23:17:47 -04:00
<summary>{% trans "Unread Announcements" %}</summary>
2024-04-17 00:00:40 -04:00
{% for ann in request.user.unread_announcements %}<div>{{ ann.html }}</div>{% endfor %}
<form action="{% url 'users:mark_announcements_read' %}" method="post">
{% csrf_token %}
2024-05-20 23:17:47 -04:00
<input type="submit"
class="secondary outline"
value="{% trans 'mark all as read' %}">
2024-04-17 00:00:40 -04:00
</form>
</details>
</article>
</section>
{% endif %}
{% if show_profile %}
<section class="profile">
<article>
<details class="auto-collapse" open>
<summary>
<div>
<div class="avatar">
2023-08-13 18:00:10 -04:00
<a href="{{ identity.url }}" onclick="window.location = this.href;">
{% comment %} onclick to workaround webkit issue with <a /> in <summary /> {% endcomment %}
2024-04-06 11:53:31 -04:00
<img src="{{ identity.avatar|relative_uri }}" alt="">
</a>
</div>
<div>
<hgroup>
2023-08-13 18:00:10 -04:00
<h6 class="nickname">{{ identity.display_name }}</h6>
<div>
<span class="handler">@{{ identity.full_handle }}</span>
</div>
</hgroup>
</div>
</div>
</summary>
2023-07-07 18:33:34 -04:00
<span class="action">
2023-08-13 18:00:10 -04:00
{% if identity.user == request.user %}
{% if identity.locked %}
2023-07-07 02:02:48 -04:00
<span>
2024-05-20 23:17:47 -04:00
<a title="{% trans "approving followers manually" %}">
2023-07-07 16:54:15 -04:00
<i class="fa-solid fa-user-shield"></i>
2023-07-07 02:02:48 -04:00
</a>
</span>
{% endif %}
2023-08-15 15:46:11 -04:00
{% if identity.user.mastodon_account %}
<span>
<a href="{{ identity.user.mastodon_account.url }}"
target="_blank"
rel="noopener"
title="@{{ identity.user.mastodon_acct }}">
<i class="fa-brands fa-mastodon"></i>
</a>
</span>
{% endif %}
2023-08-14 11:42:09 -04:00
{% elif request.user.is_authenticated %}
2023-07-07 16:54:15 -04:00
{% include 'users/profile_actions.html' %}
2023-07-07 02:02:48 -04:00
{% endif %}
</span>
2024-04-07 20:31:54 -04:00
<p>
{{ identity.summary|bleach:"a,p,span,br"|default:"<br>" }}
</p>
</details>
</article>
</section>
{% endif %}
{% if show_progress %}
<section>
<article>
2023-08-13 18:00:10 -04:00
<details {% if identity.featured_collections.all %}open{% endif %}>
2024-05-20 23:17:47 -04:00
<summary>{% trans 'Current Targets' %}</summary>
2023-08-13 18:00:10 -04:00
{% for featured_collection in identity.featured_collections.all %}
{% user_visibility_of featured_collection as visible %}
{% if visible %}
2023-08-13 23:11:12 -04:00
{% user_stats_of collection=featured_collection identity=identity as stats %}
<div>
<a href="{{ featured_collection.collection.url }}">{{ featured_collection.collection.title }}</a> <small>{{ stats.complete }} / {{ stats.total }}</small>
<br>
<progress value="{{ stats.percentage }}" max="100" />
</div>
{% endif %}
{% empty %}
2023-08-13 23:11:12 -04:00
{% if request.user == identity.user %}
2024-05-20 23:17:47 -04:00
<div class="empty">{% trans "Set a collection as target, its progress will show up here." %}</div>
{% else %}
2024-05-20 23:17:47 -04:00
<div class="empty">{% trans "nothing so far." %}</div>
{% endif %}
{% endfor %}
</details>
</article>
</section>
{% endif %}
{% if recent_podcast_episodes %}
<section>
<article>
<details class="auto-collapse" open>
2024-05-20 23:17:47 -04:00
<summary>{% trans 'Recent podcast episodes' %}</summary>
<div class="shelf">
<ul class="cards">
{% for item in recent_podcast_episodes %}
<li class="card">
<a class="episode"
data-uuid="{{ item.uuid }}"
data-media="{{ item.media_url }}"
data-cover="{{ item.cover_url|default:item.program.cover.url }}"
data-title="{{ item.title }}"
data-album="{{ item.program.title }}"
data-hosts="{{ item.program.hosts|join:' / ' }}"
2024-02-09 03:39:02 -05:00
{% if request.user.is_authenticated %} data-comment-href="{% url 'journal:comment' item.uuid %}" {% endif %}
data-position="0"
href="{{ item.url }}"
title="{{ item.title }}">
2024-04-06 11:53:31 -04:00
<img src="{{ item.cover_image_url|default:item.cover.url|relative_uri }}"
alt="{{ item.title }}"
loading="lazy">
<div class="card-title">
<i class="fa-solid fa-circle-play"></i> {{ item.title }}
</div>
</a>
</li>
{% endfor %}
</ul>
</div>
</details>
</article>
</section>
{% endif %}
{% if books_in_progress %}
<section>
<article>
<details class="auto-collapse" open>
2024-05-20 23:17:47 -04:00
<summary>{% trans 'Currently reading' %}</summary>
<div class="shelf">
<ul class="cards">
{% for item in books_in_progress %}
<li class="card">
<a href="{{ item.url }}" title="{{ item.title }}">
<img src="{{ item.cover|thumb:'normal' }}"
alt="{{ item.title }}"
loading="lazy">
<div class="card-title">{{ item.title }}</div>
</a>
</li>
{% endfor %}
</ul>
</div>
</details>
</article>
</section>
{% endif %}
{% if tvshows_in_progress %}
<section>
<article>
<details class="auto-collapse" open>
2024-05-20 23:17:47 -04:00
<summary>{% trans 'Currently watching' %}</summary>
<div class="shelf">
<ul class="cards">
{% for item in tvshows_in_progress %}
<li class="card">
<a href="{{ item.url }}" title="{{ item.title }}">
<img src="{{ item.cover|thumb:'normal' }}"
alt="{{ item.title }}"
loading="lazy">
<div class="card-title">{{ item.title }}</div>
</a>
</li>
{% endfor %}
</ul>
</div>
</details>
</article>
</section>
{% endif %}
{% if top_tags %}
<section>
<article>
<details {% if top_tags %}class="auto-collapse" open{% endif %}>
2024-05-20 23:17:47 -04:00
<summary>{% trans 'Common Tags' %}</summary>
<div class="tag-list">
{% for t in top_tags %}
<span>
2024-05-13 15:58:19 -04:00
<a href="{% url 'journal:user_tag_member_list' identity.user.handler t.title %}">{{ t.title }}</a>
<small>({{ t.total }})</small>
</span>
{% empty %}
2024-05-20 23:17:47 -04:00
<div class="empty">{% trans "nothing so far." %}</div>
{% endfor %}
</div>
<small>
{% if top_tags %}
2024-05-20 23:17:47 -04:00
<a href="{% url 'journal:user_tag_list' identity.user.handler %}">...{% trans 'show more' %}</a>
{% endif %}
</small>
</details>
</article>
</section>
2024-06-03 12:59:24 -04:00
{% endif %}
{% if recent_posts is not None %}
<section>
<article>
<details class="auto-collapse" open>
<summary>{% trans 'Recent Posts' %}</summary>
<div style="font-size:80%">{% include "posts.html" with posts=recent_posts %}</div>
</details>
</article>
</section>
{% endif %}
2023-10-30 00:59:54 -04:00
{% if sidebar_template %}
{% include sidebar_template %}
{% endif %}
2023-12-01 17:29:40 -05:00
{% if request.user.is_superuser and identity.local and request.user.identity != identity and request.GET.sudo %}
<section class="hijacker">
<form action="{% url 'hijack:acquire' %}" method="post">
{% csrf_token %}
<input type="hidden" name="user_pk" value="{{ identity.user.pk }}">
2024-05-20 23:17:47 -04:00
<button type="submit">Debug as them</button>
2023-12-01 17:29:40 -05:00
<button _="on click hide .hijacker then halt default">Hide</button>
<input type="hidden" name="next" value="{{ request.path }}">
</form>
</section>
{% endif %}
</aside>