]> git.lizzy.rs Git - cheatdb.git/blob - app/templates/macros/threads.html
Add links to topic lists in user dropdown
[cheatdb.git] / app / templates / macros / threads.html
1 {% macro render_thread(thread, current_user) -%}
2
3 <ul class="comments mt-4 mb-0">
4         {% for r in thread.replies %}
5         <li class="row my-2 mx-0">
6                 <div class="col-md-1 p-1">
7                         <a href="{{ url_for('user_profile_page', username=r.author.username) }}">
8                                 <img class="img-responsive user-photo img-thumbnail img-thumbnail-1" src="{{ (r.author.email or '') | gravatar }}">
9                         </a>
10                 </div>
11                 <div class="col">
12                         <div class="card">
13                                 <div class="card-header">
14                                         <a class="author {{ r.author.rank.name }}"
15                                                         href="{{ url_for('user_profile_page', username=r.author.username) }}">
16                                                 {{ r.author.display_name }}
17                                         </a>
18                                         <a name="reply-{{ r.id }}" class="text-muted float-right"
19                                                         href="{{ url_for('thread_page', id=thread.id) }}#reply-{{ r.id }}">
20                                                 {{ r.created_at | datetime }}
21                                         </a>
22                                 </div>
23
24                                 <div class="card-body">
25                                         {{ r.comment | markdown }}
26                                 </div>
27                         </div>
28                 </div>
29         </li>
30         {% endfor %}
31 </ul>
32
33 {% if current_user.is_authenticated %}
34 <div class="row mt-0 mb-4 comments mx-0">
35         <div class="col-md-1 p-1">
36                 <img class="img-responsive user-photo img-thumbnail img-thumbnail-1" src="{{ (current_user.email or '') | gravatar }}">
37         </div>
38         <div class="col">
39                 <div class="card">
40                         <div class="card-header {{ current_user.rank.name }}">
41                                 {{ current_user.display_name }}
42                                 <a name="reply"></a>
43                         </div>
44
45                         <form method="post" action="{{ url_for('thread_page', id=thread.id)}}" class="card-body">
46                                 <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
47                                 <textarea class="form-control markdown" required maxlength=500 name="comment"></textarea><br />
48                                 <input class="btn btn-primary" type="submit" value="Comment" />
49                         </form>
50                 </div>
51         </div>
52 </div>
53 {% endif %}
54 {% endmacro %}
55
56 {% macro render_threadlist(threads, list_group=False) -%}
57         {% if not list_group %}<ul>{% endif %}
58                 <li {% if list_group %}class="list-group-item"{% endif %}>
59                 {% for t in threads %}
60                         {% if list_group %}
61                                 <a href="{{ url_for('thread_page', id=t.id) }}">
62                                         {% if t.private %}&#x1f512; {% endif %}
63                                         {{ t.title }}
64                                         by {{ t.author.display_name }}
65                                 </a>
66                         {% else %}
67                                 {% if t.private %}&#x1f512; {% endif %}
68                                 <a href="{{ url_for('thread_page', id=t.id) }}">{{ t.title }}</a>
69                                 by {{ t.author.display_name }}
70                         {% endif %}
71                 {% else %}
72                         <i>No threads found</i>
73                 {% endfor %}
74                 </li>
75         </ul>
76 {% endmacro %}