38 lines
3.0 KiB
HTML
38 lines
3.0 KiB
HTML
{% extends 'core/base.html' %}
|
|
{% load i18n markdown_extras %}
|
|
{% block content %}
|
|
<div class="d-md-none alert alert-info">{% trans "Collections are currently available on desktop only." %}</div>
|
|
<article class="d-none d-md-block collection-document">
|
|
<header class="mb-5">
|
|
<div class="d-flex justify-content-between align-items-start gap-3">
|
|
<div>
|
|
<a class="btn btn-sm btn-outline-secondary mb-3" href="{% if user.is_authenticated %}{% url 'collection_list' %}{% else %}/{% endif %}">← {% if user.is_authenticated %}{% trans "Collections" %}{% else %}Start{% endif %}</a>
|
|
<h1 class="display-5 mb-3">{{ collection.title }}</h1>
|
|
<div class="d-flex flex-wrap gap-2 align-items-center">
|
|
{% if collection.mode == 'tags' %}<span class="badge text-bg-info">{% trans "Tag collection" %}</span>{% endif %}
|
|
{% if collection.team %}<span class="badge text-bg-warning">{{ collection.team.name }}</span>{% else %}<span class="badge text-bg-light">{{ collection.get_visibility_display }}</span>{% endif %}
|
|
{% for tag in collection.filter_tags.all %}<span class="badge rounded-pill text-bg-light">#{{ tag.name }}</span>{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% if can_edit %}<a class="btn btn-dark" href="{% if collection.mode == 'tags' %}{% url 'collection_edit' collection.id %}{% else %}{% url 'collection_manage' collection.id %}{% endif %}">{% trans "Edit collection" %}</a>{% endif %}
|
|
</div>
|
|
{% if collection.description %}<div class="content lead mt-4">{{ collection.description|markdown }}</div>{% endif %}
|
|
</header>
|
|
|
|
{% if sections or tag_items %}
|
|
<nav class="collection-toc mb-5" aria-label="{% trans 'Contents' %}">
|
|
<div class="small fw-semibold text-uppercase text-muted mb-2">{% trans "Contents" %}</div>
|
|
<ol class="mb-0">{% if collection.mode == 'tags' %}{% for item in tag_items %}<li><a href="#item-{{ item.id }}">{{ item.content|markdown_title|truncatechars:90 }}</a></li>{% endfor %}{% else %}{% for section in sections %}<li><a href="#section-{{ section.id }}">{% if section.item %}{{ section.title|default:section.item.content|markdown_title|truncatechars:90 }}{% else %}{{ section.title|default:section.sub_collection.title|truncatechars:90 }}{% endif %}</a></li>{% endfor %}{% endif %}</ol>
|
|
</nav>
|
|
{% endif %}
|
|
|
|
<div class="collection-flow content">
|
|
{% if collection.mode == 'tags' %}
|
|
{% for item in tag_items %}<section id="item-{{ item.id }}" class="collection-flow-section">{{ item|collection_item_markdown }}{% if item.comment %}<div class="text-muted border-start ps-3 mt-3">{{ item.comment|markdown }}</div>{% endif %}</section>{% empty %}<div class="text-center text-muted py-5">{% trans "No notes match the selected tags yet." %}</div>{% endfor %}
|
|
{% else %}
|
|
{% for section in sections %}{% include 'core/_collection_section_read.html' with section=section %}{% empty %}<div class="text-center text-muted py-5">{% trans "This collection has no sections yet." %}</div>{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
{% endblock %}
|