diff options
Diffstat (limited to 'app/templates/macros/topics.html')
| -rw-r--r-- | app/templates/macros/topics.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/app/templates/macros/topics.html b/app/templates/macros/topics.html new file mode 100644 index 0000000..0e01185 --- /dev/null +++ b/app/templates/macros/topics.html @@ -0,0 +1,52 @@ +{% macro render_topics_table(topics, show_author=True) -%} +<table> + <tr> + <th>Id</th> + <th></th> + <th>Title</th> + {% if show_author %}<th>Author</th>{% endif %} + <th>Name</th> + <th>Link</th> + <th>Actions</th> + </tr> + {% for topic in topics %} + <tr{% if topic.wip %} class="wiptopic"{% endif %}> + <td>{{ topic.topic_id }}</td> + <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> + {% if show_author %} + <td><a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td> + {% endif %} + <td>{{ topic.name or ""}}</td> + <td>{% if topic.link %}<a href="{{ topic.link }}">{{ topic.link | domain }}</a>{% endif %}</td> + <td> + <a href="{{ url_for('create_edit_package_page', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}">Create</a> + </td> + </tr> + {% endfor %} +</table> +{% endmacro %} + + +{% 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 %} + by <a href="{{ url_for('user_profile_page', username=topic.author.username) }}">{{ topic.author.display_name }}</a> + {% endif %} + {% if not topic.author.checkPerm(current_user, "CHANGE_AUTHOR") %} + <a href="{{ url_for('create_edit_package_page', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}">Create</a> + {% endif %} + </li> + {% endfor %} +</ul> +{% endmacro %} |
