2018-12-25 18:51:29 +01:00
|
|
|
{% macro render_topics_table(topics, show_author=True, show_discard=False, current_user=current_user) -%}
|
2018-12-22 13:36:49 +01:00
|
|
|
<table class="table">
|
2018-06-06 00:45:15 +02:00
|
|
|
<tr>
|
2018-07-07 00:15:56 +02:00
|
|
|
<th></th>
|
2018-06-06 00:45:15 +02:00
|
|
|
<th>Title</th>
|
|
|
|
{% if show_author %}<th>Author</th>{% endif %}
|
|
|
|
<th>Name</th>
|
2018-12-24 01:11:15 +01:00
|
|
|
<th>Date</th>
|
2018-06-06 00:45:15 +02:00
|
|
|
<th>Actions</th>
|
|
|
|
</tr>
|
|
|
|
{% for topic in topics %}
|
2018-12-24 00:49:49 +01:00
|
|
|
<tr class="{% if topic.wip %}wiptopic{% endif %}{% if topic.discarded %}discardtopic{% endif %}">
|
2018-07-07 00:15:56 +02:00
|
|
|
<td>
|
|
|
|
[{{ topic.type.value }}]
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
<a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
|
|
|
|
{% if topic.wip %}[WIP]{% endif %}
|
|
|
|
</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">
|
2018-12-25 19:15:11 +01:00
|
|
|
{% if current_user == topic.author or topic.author.checkPerm(current_user, "CHANGE_AUTHOR") %}
|
2018-12-25 18:58:44 +01:00
|
|
|
<a class="btn btn-primary"
|
2019-11-16 00:51:42 +01:00
|
|
|
href="{{ url_for('packages.create_edit', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}">
|
2018-12-25 18:58:44 +01:00
|
|
|
Create
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
2018-12-25 18:51:29 +01:00
|
|
|
{% if show_discard and current_user.is_authenticated and topic.checkPerm(current_user, "TOPIC_DISCARD") %}
|
2018-12-24 00:49:49 +01:00
|
|
|
<a class="btn btn-{% if topic.discarded %}success{% else %}danger{% endif %} topic-discard" data-tid={{ topic.topic_id }}>
|
|
|
|
{% if topic.discarded %}
|
|
|
|
Show
|
|
|
|
{% else %}
|
|
|
|
Discard
|
|
|
|
{% endif %}
|
|
|
|
</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
|
|
|
|
|
|
|
|
|
|
|
{% macro render_topics(topics, current_user, show_author=True) -%}
|
|
|
|
<ul>
|
|
|
|
{% for topic in topics %}
|
|
|
|
<li{% if topic.wip %} class="wiptopic"{% endif %}>
|
|
|
|
<a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
|
|
|
|
{% if topic.wip %}[WIP]{% endif %}
|
|
|
|
{% if topic.name %}[{{ topic.name }}]{% endif %}
|
|
|
|
{% if show_author %}
|
2019-11-16 00:51:42 +01:00
|
|
|
by <a href="{{ url_for('users.profile', username=topic.author.username) }}">{{ topic.author.display_name }}</a>
|
2018-08-25 19:20:45 +02:00
|
|
|
{% endif %}
|
2018-08-25 20:12:42 +02:00
|
|
|
{% if topic.author == current_user or topic.author.checkPerm(current_user, "CHANGE_AUTHOR") %}
|
2019-11-16 00:51:42 +01:00
|
|
|
| <a href="{{ url_for('packages.create_edit', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}">Create</a>
|
2018-08-25 19:20:45 +02:00
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% endmacro %}
|