2.6 KiB · text History 263b40b
{% extends "root.html" %}
{% import "_avatar.html" as ui %}

{% block content %}
<div class="space-y-4 text-left">
  <div class="text-sm opacity-70">
    <a href="/c/" class="link link-hover">Categories</a>
    {% for a in ancestors %} / <a href="/c/{{ a.slug }}" class="link link-hover">{{ a.name }}</a>{% endfor %}
    / {{ category.name }}
  </div>

  <div class="flex items-center justify-between gap-3">
    <h1 class="text-3xl font-bold flex items-center gap-2">
      <span class="size-6 rounded-full border border-base-content/20" style="background: {{ category_widget_bg }}"></span>
      {{ category.name }}
      {% for r in rules %}<span class="badge badge-outline badge-sm font-normal" title="Posting rule">{{ r }}</span>{% endfor %}
    </h1>
    <div class="flex items-center gap-2 shrink-0">
    {% set toggle_base = "/c/" ~ category.slug ~ "?sort=" ~ current_sort %}{% set view_mode = "classic" %}
    {% include "forum/_view_toggle.html" %}
    {% if user %}
      {% include "forum/_watch_button.html" %}
      {% if can_create_topic %}
      <a href="/c/{{ category.slug }}/new" class="btn btn-primary btn-sm">
        <i class="fas fa-plus mr-1"></i> New Topic
      </a>
      {% elif create_block %}
      <span class="badge badge-ghost gap-1 py-3 text-xs" data-create-block="{{ create_block.code }}"><i class="fas fa-ban opacity-60"></i>{{ create_block.message }}</span>
      {% endif %}
    {% endif %}
    </div>
  </div>
  {% if category.description %}<p class="opacity-70">{{ category.description }}</p>{% endif %}

  <div class="flex flex-wrap items-center justify-between gap-2">
    <div class="flex flex-wrap gap-2">
      {% for s in subcategories %}
      <a href="/c/{{ s.slug }}" class="badge badge-outline gap-1 py-3">
        <span class="size-3 rounded-full border border-base-content/20" style="background: {{ s.widget_bg }}"></span>{{ s.name }}
      </a>
      {% endfor %}
    </div>
    <div role="tablist" class="tabs tabs-bordered w-fit">
      {% for opt in ["latest", "top", "hot", "bottom"] %}
      <a role="tab" class="tab {% if current_sort == opt %}tab-active{% endif %}"
         href="/c/{{ category.slug }}?sort={{ opt }}">{{ opt | capitalize }}</a>
      {% endfor %}
    </div>
  </div>

  {# Follows live updates for this category and those under it (f/js/live.js). #}
  <div id="category-topics" data-live="category" data-live-category="{{ category.id }}">
  {% if topics|length == 0 %}
    <p class="opacity-70">No topics yet.{% if can_create_topic %} Be the first to post one.{% endif %}</p>
  {% else %}
    {% include "forum/_topic_list.html" %}
  {% endif %}
  </div>
</div>
{% endblock %}