diff --git a/forums/templates/forums/forum_as_li.html b/forums/templates/forums/forum_as_li.html index 8248b2fc2367127f687aaec231a76c2810cd87b7..b5e2eca3b2de5ba6199aa02d5d84868340c859f3 100644 --- a/forums/templates/forums/forum_as_li.html +++ b/forums/templates/forums/forum_as_li.html @@ -1,5 +1,6 @@ -<li> +<li class="d-flex justify-content-between"> <a href="{{ forum.get_absolute_url }}">{{ forum }}</a> + <span class="badge badge-secondary badge-pill">{% with nr_posts=forum.nr_posts %}{{ nr_posts }} post{{ nr_posts|pluralize }}{% endwith %}</span> {% if forum.child_forums.all|length > 0 %} <ul class="list-unstyled forumList"> {% for child in forum.child_forums.all %} diff --git a/forums/templates/forums/forum_detail.html b/forums/templates/forums/forum_detail.html index a3cd6c99f220e490631aeecfbdfcc0e26dcce853..425c7889085274f297e4e177e3119ce92c49619b 100644 --- a/forums/templates/forums/forum_detail.html +++ b/forums/templates/forums/forum_detail.html @@ -17,7 +17,10 @@ {% block content %} <div class="row"> <div class="col-12"> - <h3 class="highlight">{{ forum.name }}</h3> + <h3 class="highlight d-flex justify-content-between"> + {{ forum.name }} + <span class="badge badge-primary badge-pill">{% with nr_posts=forum.nr_posts %}{{ nr_posts }} post{{ nr_posts|pluralize }}{% endwith %}</span> + </h3> {% if forum.parent %} <p>Parent: <a href="{{ forum.parent.get_absolute_url }}">{{ forum.parent }}</a></p> diff --git a/forums/templates/forums/forum_list.html b/forums/templates/forums/forum_list.html index c3176627a182078c8783499fdfa3b9bb638165f2..aa5e8373ab7b49f2e9cd6e97271397605c4e46ca 100644 --- a/forums/templates/forums/forum_list.html +++ b/forums/templates/forums/forum_list.html @@ -26,8 +26,9 @@ <div class="card-columns"> {% for forum in object_list %} <div class="card"> - <div class="card-header"> + <div class="card-header d-flex justify-content-between"> <a href="{{ forum.get_absolute_url }}">{{ forum }}</a> + <span class="badge badge-primary badge-pill">{{ forum.nr_posts }} posts</span> </div> <div class="card-body"> Forum description diff --git a/forums/templates/forums/post_card.html b/forums/templates/forums/post_card.html index 369974ed815c74ce67e375c6e63cf9e750216756..772719e1526dd1d4b731683852efefd460f88c69 100644 --- a/forums/templates/forums/post_card.html +++ b/forums/templates/forums/post_card.html @@ -19,7 +19,7 @@ </div> {% if post.followup_posts.all|length > 0 %} <div class="followupPosts"> - <h3>Replies [{{ post.nr_followups }}]:</h3> + <h3><span class="badge badge-primary badge-pill">{% with nr_followups=post.nr_followups %}{{ nr_followups }} repl{{ nr_followups|pluralize:"y,ies" }}{% endwith %}</span></h3> {% for followup in post.followup_posts.all %} {% include 'forums/post_card.html' with post=followup %} {% endfor %} diff --git a/forums/views.py b/forums/views.py index 402656dd9f3e9ca6acf5d9c13fc2005005b9decf..25fee032b497e2984748130712ea093f4dcaf28b 100644 --- a/forums/views.py +++ b/forums/views.py @@ -56,7 +56,7 @@ class ForumDeleteView(PermissionRequiredMixin, DeleteView): """ A Forum can only be deleted if it does not have any descendants. Upon deletion, all object-level permissions associated to the - Forum are explicitly removed. + Forum are explicitly removed, to avoid orphaned permissions. """ forum = get_object_or_404(Forum, slug=self.kwargs.get('slug')) groups_perms_dict = get_groups_with_perms(forum, attach_perms=True)