mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-24 06:52:24 +01:00
61 lines
2.0 KiB
HTML
61 lines
2.0 KiB
HTML
{% macro render_topics_table(topics, show_author=True, current_user=current_user, class_=None) -%}
|
|
<table class="table {{ class_ }}">
|
|
<tr>
|
|
<th></th>
|
|
<th>{{ _("Title") }}</th>
|
|
{% if show_author %}<th>{{ _("Author") }}</th>{% endif %}
|
|
<th>{{ _("Name") }}</th>
|
|
<th>{{ _("Date") }}</th>
|
|
<th>{{ _("Actions") }}</th>
|
|
</tr>
|
|
{% for topic in topics %}
|
|
<tr class="{% if topic.wip %}wiptopic{% endif %}">
|
|
<td>
|
|
[{{ topic.type.text }}]
|
|
</td>
|
|
<td>
|
|
<a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
|
|
{% if topic.wip %}[{{ _("WIP") }}]{% endif %}
|
|
</td>
|
|
{% if show_author %}
|
|
<td><a href="{{ url_for('users.profile', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td>
|
|
{% endif %}
|
|
<td>{{ topic.name or ""}}</td>
|
|
<td>{{ topic.created_at | date }}</td>
|
|
<td class="btn-group">
|
|
{% if current_user == topic.author or topic.author.check_perm(current_user, "CHANGE_AUTHOR") %}
|
|
<a class="btn btn-primary"
|
|
href="{{ url_for('packages.create_edit', author=topic.author.username, repo=topic.get_repo_url(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}">
|
|
{{ _("Create") }}
|
|
</a>
|
|
{% endif %}
|
|
{% if topic.link %}
|
|
<a class="btn btn-info" href="{{ topic.link }}">{{ topic.link | domain | truncate(18) }}</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
{% endmacro %}
|
|
|
|
|
|
{% macro render_topics(topics, current_user) -%}
|
|
<div class="list-group">
|
|
{% for topic in topics %}
|
|
<a class="list-group-item list-group-item-action" href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">
|
|
<span class="float-end text-muted">
|
|
{{ topic.created_at | date }}
|
|
</span>
|
|
{% set title %}
|
|
<strong>{{ topic.title }}</strong>
|
|
{% endset %}
|
|
{{ _("%(title)s by %(author)s", title=title, author=topic.author.display_name) }}
|
|
<span class="text-muted">
|
|
{% if topic.wip %}[{{ _("WIP") }}]{% endif %}
|
|
{% if topic.name %}[{{ topic.name }}]{% endif %}
|
|
</span>
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% endmacro %}
|