From 3fc0bdce08c02862a8e1f1e9ac52472e2725b379 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 9 Mar 2019 11:53:57 +0100
Subject: [PATCH] Beautify things a bit

---
 forums/models.py                              |  3 ++-
 forums/templates/forums/forum_detail.html     | 27 +++++++++++++------
 forums/templates/forums/forum_list.html       |  3 ++-
 forums/templates/forums/post_card.html        |  2 +-
 .../templates/forums/post_confirm_create.html |  2 +-
 5 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/forums/models.py b/forums/models.py
index 44117bd82..ea844a286 100644
--- a/forums/models.py
+++ b/forums/models.py
@@ -185,7 +185,8 @@ class Post(models.Model):
         ordering = ['posted_on',]
 
     def __str__(self):
-        return '%s: %s' % (self.posted_by, self.subject[:32])
+        return '%s %s: %s' % (self.posted_by.first_name,
+                              self.posted_by.last_name, self.subject[:32])
 
     def get_absolute_url(self):
         return '%s#post%s' % (self.get_forum().get_absolute_url(), self.id)
diff --git a/forums/templates/forums/forum_detail.html b/forums/templates/forums/forum_detail.html
index 5820665ae..040dedf19 100644
--- a/forums/templates/forums/forum_detail.html
+++ b/forums/templates/forums/forum_detail.html
@@ -6,21 +6,30 @@
 
 {% block breadcrumb_items %}
     {{ block.super }}
-<span class="breadcrumb-item">Details</span>
+<span class="breadcrumb-item">{% if forum.meeting %}Meeting{% else %}Forum{% endif %} Details</span>
 {% endblock %}
 
 {% load scipost_extras %}
 
-{% block pagetitle %}: Forum details{% endblock pagetitle %}
+{% block pagetitle %}: {% if forum.meeting %}Meeting{% else %}Forum{% endif %} details{% endblock pagetitle %}
 
 {% get_obj_perms request.user for forum as "user_perms" %}
 
 {% block content %}
 <div class="row">
   <div class="col-12">
-    <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 class="highlight">
+      {% if forum.meeting %}
+      {% with context_colors=forum.meeting.context_colors %}
+      <span class="badge badge-{{ context_colors.bg }} mx-0 mb-2 p-2 text-{{ context_colors.text }}">{{ context_colors.message }}</span>
+      {% endwith %}
+      <br/>
+      {% endif %}
+
+      <span class="d-flex justify-content-between">
+	<a href="{{ forum.get_absolute_url }}">{{ forum }}</a>
+	<span class="badge badge-primary badge-pill">{% with nr_posts=forum.nr_posts %}{{ nr_posts }} post{{ nr_posts|pluralize }}{% endwith %}</span>
+      </span>
     </h3>
 
     {% if forum.parent %}
@@ -33,20 +42,22 @@
     {% if perms.forums.add_forum or "can_change_forum" in user_perms %}
     <h4>Admin actions:</h4>
     <ul>
-      <li><a href="{% url 'forums:forum_update' slug=forum.slug %}" class="text-warning">Update this Forum</a></li>
+      <li><a href="{% url 'forums:forum_update' slug=forum.slug %}" class="text-warning">Update this {% if forum.meeting %}Meeting{% else %}Forum{% endif %}</a></li>
       <li>
 	{% if not forum.child_forums.all|length > 0 %}
-	<a href="{% url 'forums:forum_delete' slug=forum.slug %}" class="text-danger">Delete this Forum (and all Posts it contains)</a>
+	<a href="{% url 'forums:forum_delete' slug=forum.slug %}" class="text-danger">Delete this {% if forum.meeting %}Meeting{% else %}Forum{% endif %} (and all Posts {% if forum.meeting %}and Motions {% endif %}it contains)</a>
 	{% else %}
 	<span class="text-danger" style="text-decoration: line-through;">Delete this Forum</span> Please delete descendant Forums first.
 	{% endif %}
       </li>
+      {% if not forum.meeting %}
       <li><a href="{% url 'forums:forum_create' parent_model='forum' parent_id=forum.id %}">Create a (sub)Forum within this one</a></li>
+      {% endif %}
     </ul>
 
     <div class="card">
       <div class="card-header">
-	Permissions on this Forum instance
+	Permissions on this {% if forum.meeting %}Meeting{% else %}Forum{% endif %} instance
 	<button class="btn btn-link small" data-toggle="collapse" data-target="#permissionsCard">
 	View/manage</button>
       </div>
diff --git a/forums/templates/forums/forum_list.html b/forums/templates/forums/forum_list.html
index 9df6817b4..4e0283eca 100644
--- a/forums/templates/forums/forum_list.html
+++ b/forums/templates/forums/forum_list.html
@@ -37,7 +37,8 @@
 	  {% endif %}
 	  <span class="d-flex justify-content-between">
 	    <a href="{{ forum.get_absolute_url }}">{{ forum|truncatechars:30 }}</a>
-	  <span class="badge badge-primary badge-pill">{{ forum.nr_posts }} post{{ forum.nr_posts|pluralize }}</span>
+	    <span class="badge badge-primary badge-pill">{% with nr_posts=forum.nr_posts %}{{ nr_posts }} post{{ nr_posts|pluralize }}{% endwith %}</span>
+	  </span>
 	</div>
 	<div class="card-body">
 	  {{ forum.description|restructuredtext }}
diff --git a/forums/templates/forums/post_card.html b/forums/templates/forums/post_card.html
index 0e8b2d5b1..d3374fe62 100644
--- a/forums/templates/forums/post_card.html
+++ b/forums/templates/forums/post_card.html
@@ -4,7 +4,7 @@
   <div class="card-header">
     {{ post.subject }}
     <div class="postInfo">
-      {{ post.posted_by }} on {{ post.posted_on|date:"Y-m-d" }}
+      {{ post.posted_by.first_name }} {{ post.posted_by.last_name }} on {{ post.posted_on|date:"Y-m-d" }}
       - <a href="{{ post.get_absolute_url }}"><i class="fa fa-link" title="permalink to this Post"></i></a>
       {% if post.parent %}
       - regarding <a href="{{ post.parent.get_absolute_url }}">{{ post.parent }}</a>
diff --git a/forums/templates/forums/post_confirm_create.html b/forums/templates/forums/post_confirm_create.html
index c0f4b229c..145af977b 100644
--- a/forums/templates/forums/post_confirm_create.html
+++ b/forums/templates/forums/post_confirm_create.html
@@ -49,7 +49,7 @@
       {% csrf_token %}
       {{ form|bootstrap }}
       <input type="submit" value="Confirm Post creation" class="btn btn-primary">
-      <span class="text-danger">Not happy? Hit your browser's back button and redraft your Post</span>
+      <span class="text-danger">&nbsp;<strong>Not satisfied?</strong> Hit your browser's back button and redraft your Post</span>
     </form>
 
   </div>
-- 
GitLab