{# A silence/suspend dropdown. `action` silence|suspend, `label`, `target`
the user id, `post_id` set when acting from the queue (the answer is the
queue item, `#flags-<post>`), else the user (`#user-<id>`); `mode`,
`durations`. #}
{% set swap_target = ("#flags-" ~ post_id) if post_id else ("#user-" ~ target) %}
<details class="dropdown">
<summary class="btn btn-ghost btn-xs list-none {% if action == 'suspend' %}text-error{% else %}text-warning{% endif %}">{{ label }}…</summary>
<form hx-post="/admin/users/{{ target }}/{{ action }}" hx-target="{{ swap_target }}" hx-select="unset" hx-swap="outerHTML"
class="dropdown-content z-20 mt-1 w-64 space-y-2 rounded-box border border-base-300 bg-base-100 p-3 shadow-lg">
<input type="hidden" name="mode" value="{{ mode }}">
{% if post_id %}<input type="hidden" name="post" value="{{ post_id }}">{% endif %}
<p class="text-xs opacity-70">{% if action == 'suspend' %}Can't sign in; signed out of every browser and device now.{% else %}Can read; can't post, reply, react or flag.{% endif %}</p>
<input name="reason" class="input input-bordered input-xs w-full" placeholder="Reason (they see it)">
<select name="duration" class="select select-bordered select-xs w-full">
{% for v, l in durations %}<option value="{{ v }}" {% if v == "168h" %}selected{% endif %}>{{ l }}</option>{% endfor %}
</select>
<div class="flex justify-end"><button class="btn btn-xs {% if action == 'suspend' %}btn-error{% else %}btn-warning{% endif %}" type="submit">{{ label }}</button></div>
</form>
</details>
neiam
/recourse
public · Issues · Pulls · Labels · Forks · Compare · Actions running · Badges · Packages
⭐
Log in to mark this repository.
1.6 KiB · text
History
3d71adc