]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/macros/topics.html
Fix typo
[cheatdb.git] / app / templates / macros / topics.html
1 {% macro render_topics_table(topics, show_author=True, show_discard=False, current_user=current_user) -%}
2 <table class="table">
3         <tr>
4                 <th></th>
5                 <th>Title</th>
6                 {% if show_author %}<th>Author</th>{% endif %}
7                 <th>Name</th>
8                 <th>Date</th>
9                 <th>Actions</th>
10         </tr>
11         {% for topic in topics %}
12                 <tr class="{% if topic.wip %}wiptopic{% endif %}{% if topic.discarded %}discardtopic{% endif %}">
13                         <td>
14                                 [{{ topic.type.value }}]
15                         </td>
16                         <td>
17                                 <a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
18                                 {% if topic.wip %}[WIP]{% endif %}
19                         </td>
20                         {% if show_author %}
21                                 <td><a href="{{ url_for('users.profile', username=topic.author.username) }}">{{ topic.author.display_name}}</a></td>
22                         {% endif %}
23                         <td>{{ topic.name or ""}}</td>
24                         <td>{{ topic.created_at | date }}</td>
25                         <td class="btn-group">
26                                 {% if current_user == topic.author or topic.author.checkPerm(current_user, "CHANGE_AUTHOR") %}
27                                         <a class="btn btn-primary"
28                                                         href="{{ url_for('packages.create_edit', author=topic.author.username, repo=topic.getRepoURL(), forums=topic.topic_id, title=topic.title, bname=topic.name) }}">
29                                                 Create
30                                         </a>
31                                 {% endif %}
32                                 {% if show_discard and current_user.is_authenticated and topic.checkPerm(current_user, "TOPIC_DISCARD") %}
33                                         <a class="btn btn-{% if topic.discarded %}success{% else %}danger{% endif %} topic-discard" data-tid={{ topic.topic_id }}>
34                                                 {% if topic.discarded %}
35                                                         Show
36                                                 {% else %}
37                                                         Discard
38                                                 {% endif %}
39                                         </a>
40                                 {% endif %}
41                                 {% if topic.link %}
42                                         <a class="btn btn-info" href="{{ topic.link }}">{{ topic.link | domain | truncate(18) }}</a>
43                                 {% endif %}
44                         </td>
45                 </tr>
46         {% endfor %}
47 </table>
48 {% endmacro %}
49
50
51 {% macro render_topics(topics, current_user, show_author=True) -%}
52 <ul>
53         {% for topic in topics %}
54                 <li{% if topic.wip %} class="wiptopic"{% endif %}>
55                         <a href="https://forum.minetest.net/viewtopic.php?t={{ topic.topic_id}}">{{ topic.title }}</a>
56                         {% if topic.wip %}[WIP]{% endif %}
57                         {% if topic.discarded %}[Old]{% endif %}
58                         {% if topic.name %}[{{ topic.name }}]{% endif %}
59                         {% if show_author %}
60                                 by <a href="{{ url_for('users.profile', username=topic.author.username) }}">{{ topic.author.display_name }}</a>
61                         {% endif %}
62                         {% if topic.author == current_user or topic.author.checkPerm(current_user, "CHANGE_AUTHOR") %}
63                                 | <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>
64                         {% endif %}
65                 </li>
66         {% endfor %}
67 </ul>
68 {% endmacro %}