SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 3fc0bdce authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Beautify things a bit

parent 761202f4
No related branches found
No related tags found
No related merge requests found
...@@ -185,7 +185,8 @@ class Post(models.Model): ...@@ -185,7 +185,8 @@ class Post(models.Model):
ordering = ['posted_on',] ordering = ['posted_on',]
def __str__(self): 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): def get_absolute_url(self):
return '%s#post%s' % (self.get_forum().get_absolute_url(), self.id) return '%s#post%s' % (self.get_forum().get_absolute_url(), self.id)
......
...@@ -6,21 +6,30 @@ ...@@ -6,21 +6,30 @@
{% block breadcrumb_items %} {% block breadcrumb_items %}
{{ block.super }} {{ block.super }}
<span class="breadcrumb-item">Details</span> <span class="breadcrumb-item">{% if forum.meeting %}Meeting{% else %}Forum{% endif %} Details</span>
{% endblock %} {% endblock %}
{% load scipost_extras %} {% 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" %} {% get_obj_perms request.user for forum as "user_perms" %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h3 class="highlight d-flex justify-content-between"> <h3 class="highlight">
{{ forum.name }} {% if forum.meeting %}
<span class="badge badge-primary badge-pill">{% with nr_posts=forum.nr_posts %}{{ nr_posts }} post{{ nr_posts|pluralize }}{% endwith %}</span> {% 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> </h3>
{% if forum.parent %} {% if forum.parent %}
...@@ -33,20 +42,22 @@ ...@@ -33,20 +42,22 @@
{% if perms.forums.add_forum or "can_change_forum" in user_perms %} {% if perms.forums.add_forum or "can_change_forum" in user_perms %}
<h4>Admin actions:</h4> <h4>Admin actions:</h4>
<ul> <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> <li>
{% if not forum.child_forums.all|length > 0 %} {% 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 %} {% else %}
<span class="text-danger" style="text-decoration: line-through;">Delete this Forum</span> Please delete descendant Forums first. <span class="text-danger" style="text-decoration: line-through;">Delete this Forum</span> Please delete descendant Forums first.
{% endif %} {% endif %}
</li> </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> <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> </ul>
<div class="card"> <div class="card">
<div class="card-header"> <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"> <button class="btn btn-link small" data-toggle="collapse" data-target="#permissionsCard">
View/manage</button> View/manage</button>
</div> </div>
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
{% endif %} {% endif %}
<span class="d-flex justify-content-between"> <span class="d-flex justify-content-between">
<a href="{{ forum.get_absolute_url }}">{{ forum|truncatechars:30 }}</a> <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>
<div class="card-body"> <div class="card-body">
{{ forum.description|restructuredtext }} {{ forum.description|restructuredtext }}
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="card-header"> <div class="card-header">
{{ post.subject }} {{ post.subject }}
<div class="postInfo"> <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> - <a href="{{ post.get_absolute_url }}"><i class="fa fa-link" title="permalink to this Post"></i></a>
{% if post.parent %} {% if post.parent %}
- regarding <a href="{{ post.parent.get_absolute_url }}">{{ post.parent }}</a> - regarding <a href="{{ post.parent.get_absolute_url }}">{{ post.parent }}</a>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
{% csrf_token %} {% csrf_token %}
{{ form|bootstrap }} {{ form|bootstrap }}
<input type="submit" value="Confirm Post creation" class="btn btn-primary"> <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> </form>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment