2.8 KiB · text History 263b40b
{# Title row with topic delete/restore and, for staff, lock and pin (topic.html, topic_focus.html). Shows the Classic/Focus switch when `toggle_base` is set. #}
  <div class="flex items-start justify-between gap-3">
    <h1 id="topic-title" class="text-3xl font-bold">
      {% if topic.is_pinned %}<i class="fas fa-thumbtack text-accent mr-1" title="Pinned"></i>{% endif %}
      {% if topic.is_closed %}<i class="fas fa-lock opacity-60 mr-1" title="{{ caps.lock_message or 'Locked' }}"></i>{% endif %}
      {{ topic.title }}
    </h1>
    <div class="flex flex-wrap items-center justify-end gap-2 shrink-0">
      {% if toggle_base %}{% include "forum/_view_toggle.html" %}{% endif %}
      {% if user and user.is_staff and not topic_deleted %}
        <form method="post" action="/t/{{ topic.id }}/{% if topic.is_pinned %}unpin{% else %}pin{% endif %}" class="m-0" hx-boost="false">
          <button type="submit" class="btn btn-ghost btn-xs" data-staff-pin>
            <i class="fas fa-thumbtack mr-1"></i>{% if topic.is_pinned %}Unpin{% else %}Pin{% endif %}
          </button>
        </form>
        {% if topic.is_closed %}
        <form method="post" action="/t/{{ topic.id }}/unlock" class="m-0" hx-boost="false">
          <button type="submit" class="btn btn-ghost btn-xs" data-staff-lock><i class="fas fa-lock-open mr-1"></i>Unlock</button>
        </form>
        {% else %}
        <details class="dropdown dropdown-end">
          <summary class="btn btn-ghost btn-xs list-none" data-staff-lock><i class="fas fa-lock mr-1"></i>Lock</summary>
          <form method="post" action="/t/{{ topic.id }}/lock" hx-boost="false"
                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">
            <p class="text-xs opacity-70">No more replies, reactions or edits except from staff.</p>
            <input name="reason" maxlength="300" class="input input-bordered input-xs w-full" placeholder="Reason (shown to everyone, optional)">
            <div class="flex justify-end"><button type="submit" class="btn btn-warning btn-xs">Lock topic</button></div>
          </form>
        </details>
        {% endif %}
      {% endif %}
      {% if can_delete_topic %}
        <form method="post" action="/t/{{ topic.id }}/delete" class="m-0"
              hx-boost="false" onsubmit="return confirm('Delete this topic? It will be hidden from listings but kept so links don\'t break. Only a moderator can restore it.');">
          <button type="submit" class="btn btn-ghost btn-xs text-error">Delete topic</button>
        </form>
      {% endif %}
      {% if can_restore_topic %}
        <form method="post" action="/t/{{ topic.id }}/restore" class="m-0">
          <button type="submit" class="btn btn-ghost btn-xs">Restore topic</button>
        </form>
      {% endif %}
    </div>
  </div>