This repository has been archived on 2026-02-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
federation/templates/federation/_interaction_buttons.html
giles b694d1f4f9
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 52s
Add full fediverse social service
Social blueprint with timeline, compose, search, follow/unfollow,
like/boost interactions, and notifications. Inbox handler extended
for Create/Update/Delete/Accept/Like/Announce with notification
creation. HTMX-powered infinite scroll and interaction buttons.
Nav updated with Timeline, Public, Search, and Notifications links.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 11:57:24 +00:00

62 lines
3.1 KiB
HTML

{% set oid = item.object_id if item is defined and item.object_id is defined else item_object_id | default('') %}
{% set ainbox = item.author_inbox if item is defined and item.author_inbox is defined else item_author_inbox | default('') %}
{% set lcount = item.like_count if item is defined and item.like_count is defined else like_count | default(0) %}
{% set bcount = item.boost_count if item is defined and item.boost_count is defined else boost_count | default(0) %}
{% set liked = item.liked_by_me if item is defined and item.liked_by_me is defined else liked_by_me | default(false) %}
{% set boosted = item.boosted_by_me if item is defined and item.boosted_by_me is defined else boosted_by_me | default(false) %}
<div class="flex items-center gap-4 mt-3 text-sm text-stone-500">
{% if liked %}
<form hx-post="{{ url_for('social.unlike') }}"
hx-target="#interactions-{{ oid | replace('/', '_') | replace(':', '_') }}"
hx-swap="innerHTML">
<input type="hidden" name="object_id" value="{{ oid }}">
<input type="hidden" name="author_inbox" value="{{ ainbox }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="flex items-center gap-1 text-red-500 hover:text-red-600">
<span>&#x2665;</span> {{ lcount }}
</button>
</form>
{% else %}
<form hx-post="{{ url_for('social.like') }}"
hx-target="#interactions-{{ oid | replace('/', '_') | replace(':', '_') }}"
hx-swap="innerHTML">
<input type="hidden" name="object_id" value="{{ oid }}">
<input type="hidden" name="author_inbox" value="{{ ainbox }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="flex items-center gap-1 hover:text-red-500">
<span>&#x2661;</span> {{ lcount }}
</button>
</form>
{% endif %}
{% if boosted %}
<form hx-post="{{ url_for('social.unboost') }}"
hx-target="#interactions-{{ oid | replace('/', '_') | replace(':', '_') }}"
hx-swap="innerHTML">
<input type="hidden" name="object_id" value="{{ oid }}">
<input type="hidden" name="author_inbox" value="{{ ainbox }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="flex items-center gap-1 text-green-600 hover:text-green-700">
<span>&#x21BB;</span> {{ bcount }}
</button>
</form>
{% else %}
<form hx-post="{{ url_for('social.boost') }}"
hx-target="#interactions-{{ oid | replace('/', '_') | replace(':', '_') }}"
hx-swap="innerHTML">
<input type="hidden" name="object_id" value="{{ oid }}">
<input type="hidden" name="author_inbox" value="{{ ainbox }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="flex items-center gap-1 hover:text-green-600">
<span>&#x21BB;</span> {{ bcount }}
</button>
</form>
{% endif %}
{% if oid %}
<a href="{{ url_for('social.compose_form', reply_to=oid) }}"
class="hover:text-stone-700">Reply</a>
{% endif %}
</div>