HTMX drop-down for available cross posts

This commit is contained in:
freamon 2025-01-12 12:09:16 +00:00
parent f3bdb9b9b0
commit 8714144b32
2 changed files with 23 additions and 27 deletions

View file

@ -170,9 +170,21 @@
</div>
{% if post.cross_posts -%}
<div class="cross_post_button">
<a href="{{ url_for('post.post_cross_posts', post_id=post.id) }}" aria-label="{{ _('Show cross-posts') }}"
title="{{ _('Show cross-posts') }}"><span class="fe fe-layers"></span>
<span aria-label="{{ _('Number of cross-posts:') }}">{{ len(post.cross_posts) }}</span></a>
<div class="dropdown">
<a href="{{ url_for('post.post_cross_posts', post_id=post.id) }}" aria-label="{{ _('Show cross-posts') }}"
title="{{ _('Show cross-posts') }}" data-bs-toggle="dropdown" rel="nofollow">
<span class="fe fe-layers"></span>
<span aria-label="{{ _('Number of cross-posts:') }}">{{ len(post.cross_posts) }}</span>
</a>
<ul class="dropdown-menu" style="width: 380px; white-space: nowrap; overflow: hidden">
<div
hx-get="{{ url_for('post.post_cross_posts', post_id=post.id) }}"
hx-trigger="intersect once"
hx-target="this"
hx-swap="outerHTML"
></div>
</ul>
</div>
</div>
{% endif -%}
<div class="notify_toggle pull-right">

View file

@ -1,24 +1,8 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %}
{% from 'bootstrap/form.html' import render_form %}
{% block app_content %}
<div class="row">
<div class="col col-login mx-auto">
<h3 class="mt-2 post_title">{{ _('Cross-posts for "%(post_title)s"', post_title=post.title) }}</h3>
<p>{{ _('Posts to the same url have also been created in the following communities:') }}</p>
<ul class="cross_post_list">
{% for cross_post in cross_posts %}
<li><a href="{{ url_for('activitypub.post_ap', post_id=cross_post.id) }}">
{{ cross_post.community.title }}@{{ cross_post.community.ap_domain }}</a>
<span class="fe fe-reply"></span>
<span>{{ cross_post.reply_count }}</span>
</li>
{% endfor %}
</ul>
</div>
</div>
{% endblock %}
{% for cross_post in cross_posts %}
<li class="dropdown-item">
<a href="{{ url_for('activitypub.post_ap', post_id=cross_post.id) }}" class="no-underline" rel="nofollow">
<span class="fe fe-reply"></span>{{ cross_post.reply_count }} |
{{ cross_post.community.name }}@{{ cross_post.community.ap_domain }}
</a>
</li>
{% endfor %}