2024-04-03 19:30:08 +02:00
|
|
|
{% macro render_topics_table(topics, show_author=True, current_user=current_user, class_=None) -%}
|
2021-01-29 20:38:14 +01:00
|
|
|
<table class="table {{ class_ }}">
|
2018-06-06 00:45:15 +02:00
|
|
|
<tr>
|
2018-07-07 00:15:56 +02:00
|
|
|
<th></th>
|
2022-01-08 00:27:00 +01:00
|
|
|
<th>{{ _("Title") }}</th>
|
|
|
|
{% if show_author %}<th>{{ _("Author") }}</th>{% endif %}
|
|
|
|
<th>{{ _("Name") }}</th>
|
|
|
|
<th>{{ _("Date") }}</th>
|
|
|
|
<th>{{ _("Actions") }}</th>
|
2018-06-06 00:45:15 +02:00
|
|
|
</tr>
|
|
|
|
{% for topic in topics %}
|
2024-04-03 19:30:08 +02:00
|
|
|
<tr class="{% if topic.wip %}wiptopic{% endif %}">
|
2018-07-07 00:15:56 +02:00
|
|
|
<td>
|
2022-01-14 19:25:28 +01:00
|
|
|
[{{ topic.type.text }}]
|
2018-07-07 00:15:56 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
|
2022-01-08 00:27:00 +01:00
|
|
|
{% if topic.wip %}[{{ _("WIP") }}]{% endif %}
|
2018-07-07 00:15:56 +02:00
|
|
|
</td>
|
2018-06-06 00:45:15 +02:00
|
|
|
{% if show_author %}
|
2019-11-16 00:51:42 +01:00
|
|
|
<td><a href="{{ url_for('users.profile', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td>
|
2018-06-06 00:45:15 +02:00
|
|
|
{% endif %}
|
|
|
|
<td>{{ topic.name or ""}}</td>
|
2018-12-24 01:11:15 +01:00
|
|
|
<td>{{ topic.created_at | date }}</td>
|
2018-12-24 00:49:49 +01:00
|
|
|
<td class="btn-group">
|
2023-06-18 22:56:19 +02:00
|
|
|
{% if current_user == topic.author or topic.author.check_perm(current_user, "CHANGE_AUTHOR") %}
|
2018-12-25 18:58:44 +01:00
|
|
|
<a class="btn btn-primary"
|
2023-06-19 22:27:49 +02:00
|
|
|
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) }}">
|
2022-01-08 00:27:00 +01:00
|
|
|
{{ _("Create") }}
|
2018-12-25 18:58:44 +01:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
2018-12-24 01:11:15 +01:00
|
|
|
{% if topic.link %}
|
2018-12-24 01:37:44 +01:00
|
|
|
<a class="btn btn-info" href="{{ topic.link }}">{{ topic.link | domain | truncate(18) }}</a>
|
2018-12-24 01:11:15 +01:00
|
|
|
{% endif %}
|
2018-06-06 00:45:15 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
{% endmacro %}
|
2018-08-25 19:20:45 +02:00
|
|
|
|
|
|
|
|
2024-04-03 19:30:08 +02:00
|
|
|
{% macro render_topics(topics, current_user) -%}
|
|
|
|
<div class="list-group">
|
2018-08-25 19:20:45 +02:00
|
|
|
{% for topic in topics %}
|
2024-04-03 19:30:08 +02:00
|
|
|
<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>
|
2018-08-25 19:20:45 +02:00
|
|
|
{% endfor %}
|
2024-04-03 19:30:08 +02:00
|
|
|
</div>
|
2018-08-25 19:20:45 +02:00
|
|
|
{% endmacro %}
|