From f4d5401e156fb6cfcb889ec36033621d01b18c79 Mon Sep 17 00:00:00 2001 From: "J.-S. Caux" <J.S.Caux@uva.nl> Date: Mon, 15 Apr 2019 08:53:57 +0200 Subject: [PATCH] Template style: app forums --- forums/templates/forums/base.html | 16 +- forums/templates/forums/forum_as_li.html | 10 +- .../forums/forum_confirm_delete.html | 32 +-- forums/templates/forums/forum_detail.html | 272 +++++++++--------- forums/templates/forums/forum_form.html | 34 +-- forums/templates/forums/forum_list.html | 140 ++++----- .../templates/forums/forum_permissions.html | 26 +- .../forums/motion_confirm_create.html | 78 ++--- forums/templates/forums/motion_form.html | 22 +- forums/templates/forums/post_card.html | 96 +++---- .../templates/forums/post_confirm_create.html | 78 ++--- forums/templates/forums/post_form.html | 22 +- 12 files changed, 413 insertions(+), 413 deletions(-) diff --git a/forums/templates/forums/base.html b/forums/templates/forums/base.html index 422ab8927..975e5fbd5 100644 --- a/forums/templates/forums/base.html +++ b/forums/templates/forums/base.html @@ -1,13 +1,13 @@ {% extends 'scipost/base.html' %} {% block breadcrumb %} - <div class="breadcrumb-container"> - <div class="container"> - <nav class="breadcrumb hidden-sm-down"> - {% block breadcrumb_items %} - <a href="{% url 'forums:forums' %}" class="breadcrumb-item">Forums</a> - {% endblock %} - </nav> - </div> + <div class="breadcrumb-container"> + <div class="container"> + <nav class="breadcrumb hidden-sm-down"> + {% block breadcrumb_items %} + <a href="{% url 'forums:forums' %}" class="breadcrumb-item">Forums</a> + {% endblock %} + </nav> </div> + </div> {% endblock %} diff --git a/forums/templates/forums/forum_as_li.html b/forums/templates/forums/forum_as_li.html index b4afb1dd4..9b48c0d60 100644 --- a/forums/templates/forums/forum_as_li.html +++ b/forums/templates/forums/forum_as_li.html @@ -2,10 +2,10 @@ <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 %} - {% include 'forums/forum_as_li.html' with forum=child %} - {% endfor %} - </ul> + <ul class="list-unstyled forumList"> + {% for child in forum.child_forums.all %} + {% include 'forums/forum_as_li.html' with forum=child %} + {% endfor %} + </ul> {% endif %} </li> diff --git a/forums/templates/forums/forum_confirm_delete.html b/forums/templates/forums/forum_confirm_delete.html index e1b83558d..1727cadb4 100644 --- a/forums/templates/forums/forum_confirm_delete.html +++ b/forums/templates/forums/forum_confirm_delete.html @@ -6,30 +6,30 @@ {% block pagetitle %}: Delete Forum{% endblock pagetitle %} {% block content %} -<div class="row"> + <div class="row"> <div class="col-12"> - <h1 class="highlight">Delete Forum</h1> + <h1 class="highlight">Delete Forum</h1> - <h3 class="highlight">Description</h3> - {{ object.description|restructuredtext }} + <h3 class="highlight">Description</h3> + {{ object.description|restructuredtext }} - <h3 class="highlight">Posts</h3> - {% for post in object.posts.all %} + <h3 class="highlight">Posts</h3> + {% for post in object.posts.all %} {% include 'forums/post_card.html' with forum=object post=post %} - {% endfor %} + {% endfor %} </div> -</div> + </div> -<div class="row"> - <div class="col-12"> + <div class="row"> + <div class="col-12"> - <form method="post"> - {% csrf_token %} - <h3 class="mb-2">Are you sure you want to delete this Forum (and all associated Posts)?</h3> - <input type="submit" class="btn btn-danger" value="Yes, delete it" /> - </form> + <form method="post"> + {% csrf_token %} + <h3 class="mb-2">Are you sure you want to delete this Forum (and all associated Posts)?</h3> + <input type="submit" class="btn btn-danger" value="Yes, delete it" /> + </form> + </div> </div> -</div> {% endblock content %} diff --git a/forums/templates/forums/forum_detail.html b/forums/templates/forums/forum_detail.html index 2d3d0626f..6eda7a0f4 100644 --- a/forums/templates/forums/forum_detail.html +++ b/forums/templates/forums/forum_detail.html @@ -5,8 +5,8 @@ {% load restructuredtext %} {% block breadcrumb_items %} - {{ block.super }} -<span class="breadcrumb-item">{% if forum.meeting %}Meeting{% else %}Forum{% endif %} Details</span> + {{ block.super }} + <span class="breadcrumb-item">{% if forum.meeting %}Meeting{% else %}Forum{% endif %} Details</span> {% endblock %} {% load scipost_extras %} @@ -17,159 +17,159 @@ {% block content %} -<div class="row"> - <div class="col-12"> - <h2 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 class="small text-muted"> [{{ forum.meeting.date_from|date:"Y-m-d" }} to {{ forum.meeting.date_until|date:"Y-m-d" }}]</span> - </span> - {% endwith %} - <br/> + <div class="row"> + <div class="col-12"> + <h2 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 class="small text-muted"> [{{ forum.meeting.date_from|date:"Y-m-d" }} to {{ forum.meeting.date_until|date:"Y-m-d" }}]</span> + </span> + {% endwith %} + <br/> + {% endif %} + + <span class="d-flex flex-wrap 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> + </h2> + + {% if forum.parent %} + <p>Parent: <a href="{{ forum.parent.get_absolute_url }}">{{ forum.parent }}</a></p> + {% endif %} + {% if forum.child_forums.all|length > 0 %} + <p>Descendants: {% for child in forum.child_forums.all %}<a href="{{ child.get_absolute_url }}">{{ child }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p> {% endif %} - <span class="d-flex flex-wrap 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> - </h2> - - {% if forum.parent %} - <p>Parent: <a href="{{ forum.parent.get_absolute_url }}">{{ forum.parent }}</a></p> - {% endif %} - {% if forum.child_forums.all|length > 0 %} - <p>Descendants: {% for child in forum.child_forums.all %}<a href="{{ child.get_absolute_url }}">{{ child }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p> - {% endif %} - - {% if perms.forums.add_forum or "can_change_forum" in user_perms %} - <div class="container border border-danger m-2 p-2"> - <h4>Admin actions:</h4> - <ul> - <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 {% 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> - <li><a href="{% url 'forums:meeting_create' parent_model='forum' parent_id=forum.id %}">Create a Meeting within this Forum</a></li> + {% if perms.forums.add_forum or "can_change_forum" in user_perms %} + <div class="container border border-danger m-2 p-2"> + <h4>Admin actions:</h4> + <ul> + <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 {% 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> + <li><a href="{% url 'forums:meeting_create' parent_model='forum' parent_id=forum.id %}">Create a Meeting within this Forum</a></li> + {% endif %} + </ul> + + <div class="card"> + <div class="card-header"> + 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> + <div class="card-body collapse" id="permissionsCard"> + <p><a href="{% url 'forums:forum_permissions' slug=forum.slug %}">Grant permissions to a new group</a></p> + <p>Groups with permissions [click on the Group's name to manage permissions]:</p> + <ul> + {% for group in groups_with_perms %} + {% get_obj_perms group for forum as "group_perms" %} + <li><a href="{% url 'forums:forum_permissions' slug=forum.slug group_id=group.id %}">{{ group.name }}</a>: {{ group_perms }}</li> + {% empty %} + <li>No group has permissions on this Forum</li> + {% endfor %} + </ul> + + <p>Users with permissions:</p> + <ul> + {% for u in users_with_perms %} + {% get_obj_perms u for forum as "u_perms" %} + <li>{{ u.first_name }} {{ u.last_name }}: {{ u_perms }}</li> + {% endfor %} + </ul> + </div> + </div> + </div> {% endif %} - </ul> - <div class="card"> - <div class="card-header"> - 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> - <div class="card-body collapse" id="permissionsCard"> - <p><a href="{% url 'forums:forum_permissions' slug=forum.slug %}">Grant permissions to a new group</a></p> - <p>Groups with permissions [click on the Group's name to manage permissions]:</p> - <ul> - {% for group in groups_with_perms %} - {% get_obj_perms group for forum as "group_perms" %} - <li><a href="{% url 'forums:forum_permissions' slug=forum.slug group_id=group.id %}">{{ group.name }}</a>: {{ group_perms }}</li> - {% empty %} - <li>No group has permissions on this Forum</li> - {% endfor %} - </ul> - <p>Users with permissions:</p> + <h2>Table of Contents</h2> + <div class="m-2"> <ul> - {% for u in users_with_perms %} - {% get_obj_perms u for forum as "u_perms" %} - <li>{{ u.first_name }} {{ u.last_name }}: {{ u_perms }}</li> - {% endfor %} + <li><a href="#Description">Description</a></li> + {% if forum.meeting %} + <li><a href="#Preamble">Preamble</a></li> + <li><a href="#Motions">Motions</a></li> + {% endif %} + <li><a href="#Posts">Posts</a></li> + {% if forum.meeting %} + <li><a href="#Minutes">Minutes</a></li> + {% endif %} </ul> </div> </div> - </div> - {% endif %} - + </div> - <h2>Table of Contents</h2> - <div class="m-2"> - <ul> - <li><a href="#Description">Description</a></li> - {% if forum.meeting %} - <li><a href="#Preamble">Preamble</a></li> - <li><a href="#Motions">Motions</a></li> - {% endif %} - <li><a href="#Posts">Posts</a></li> - {% if forum.meeting %} - <li><a href="#Minutes">Minutes</a></li> - {% endif %} - </ul> + <div class="row"> + <div class="col-12"> + <h2 class="highlight" id="Description">Description</h2> + <div class="m-2"> + {{ forum.descripteion|restructuredtext }} + </div> </div> </div> -</div> -<div class="row"> - <div class="col-12"> - <h2 class="highlight" id="Description">Description</h2> - <div class="m-2"> - {{ forum.descripteion|restructuredtext }} + {% if forum.meeting %} + <div class="row"> + <div class="col-12"> + <h2 class="highlight" id="Preamble">Preamble</h2> + <div class="m-2"> + {{ forum.meeting.preamble|restructuredtext }} + </div> + </div> </div> - </div> -</div> - -{% if forum.meeting %} -<div class="row"> - <div class="col-12"> - <h2 class="highlight" id="Preamble">Preamble</h2> - <div class="m-2"> - {{ forum.meeting.preamble|restructuredtext }} + + <div class="row"> + <div class="col-12"> + <h2 class="highlight" id="Motions">Motions</h2> + <ul> + {% if forum.meeting.future %} + <li>Adding Motions will be activated once the meeting starts</li> + {% elif forum.meeting.past %} + <li><span class="text-danger">Adding Motions is deactivated</span> (Meeting is over)</li> + {% else %} + <li><a href="{% url 'forums:motion_create' slug=forum.slug parent_model='forum' parent_id=forum.id %}">Add a new Motion</a></li> + {% endif %} + </ul> + {% for motion in forum.motions.all %} + {% include 'forums/post_card.html' with forum=forum post=motion.post %} + {% endfor %} + </div> </div> - </div> -</div> - -<div class="row"> - <div class="col-12"> - <h2 class="highlight" id="Motions">Motions</h2> - <ul> - {% if forum.meeting.future %} - <li>Adding Motions will be activated once the meeting starts</li> - {% elif forum.meeting.past %} - <li><span class="text-danger">Adding Motions is deactivated</span> (Meeting is over)</li> - {% else %} - <li><a href="{% url 'forums:motion_create' slug=forum.slug parent_model='forum' parent_id=forum.id %}">Add a new Motion</a></li> - {% endif %} - </ul> - {% for motion in forum.motions.all %} - {% include 'forums/post_card.html' with forum=forum post=motion.post %} - {% endfor %} - </div> -</div> -{% endif %} + {% endif %} -<div class="row"> - <div class="col-12"> - <h2 class="highlight" id="Posts">Posts</h2> - <ul> - <li><a href="{% url 'forums:post_create' slug=forum.slug parent_model='forum' parent_id=forum.id %}">Add a new Post</a></li> - </ul> + <div class="row"> + <div class="col-12"> + <h2 class="highlight" id="Posts">Posts</h2> + <ul> + <li><a href="{% url 'forums:post_create' slug=forum.slug parent_model='forum' parent_id=forum.id %}">Add a new Post</a></li> + </ul> - {% for post in forum.posts.motions_excluded %} - {% include 'forums/post_card.html' with forum=forum post=post %} - {% endfor %} + {% for post in forum.posts.motions_excluded %} + {% include 'forums/post_card.html' with forum=forum post=post %} + {% endfor %} - </div> -</div> - -{% if forum.meeting %} -<div class="row"> - <div class="col-12"> - <h2 class="highlight" id="Minutes">Minutes</h2> - <div class="m-2"> - {{ forum.meeting.minutes|restructuredtext }} </div> </div> -</div> -{% endif %} + + {% if forum.meeting %} + <div class="row"> + <div class="col-12"> + <h2 class="highlight" id="Minutes">Minutes</h2> + <div class="m-2"> + {{ forum.meeting.minutes|restructuredtext }} + </div> + </div> + </div> + {% endif %} {% endblock content %} diff --git a/forums/templates/forums/forum_form.html b/forums/templates/forums/forum_form.html index 75e06ae88..e79540359 100644 --- a/forums/templates/forums/forum_form.html +++ b/forums/templates/forums/forum_form.html @@ -3,21 +3,21 @@ {% load bootstrap %} {% block headsup %} -<script> -$(document).ready(function() { + <script> + $(document).ready(function() { -$("#id_name").keyup(function() { - slug_value = this.value.split(" ").join("_"); - $("#id_slug").val(slug_value); -}); + $("#id_name").keyup(function() { + slug_value = this.value.split(" ").join("_"); + $("#id_slug").val(slug_value); + }); -}); -</script> + }); + </script> {% endblock headsup %} {% block breadcrumb_items %} -{{ block.super }} -<span class="breadcrumb-item">{% if form.instance.id %}Update {{ form.instance }}{% else %}Add new Forum{% endif %}</span> + {{ block.super }} + <span class="breadcrumb-item">{% if form.instance.id %}Update {{ form.instance }}{% else %}Add new Forum{% endif %}</span> {% endblock %} {% block pagetitle %}: Forums{% endblock pagetitle %} @@ -25,13 +25,13 @@ $("#id_name").keyup(function() { {% block content %} -<div class="row"> - <div class="col-12"> - <form action="" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" value="Submit" class="btn btn-primary"> + <div class="row"> + <div class="col-12"> + <form action="" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input type="submit" value="Submit" class="btn btn-primary"> + </div> </div> -</div> {% endblock content %} diff --git a/forums/templates/forums/forum_list.html b/forums/templates/forums/forum_list.html index 81e76c3a1..3a53c66c7 100644 --- a/forums/templates/forums/forum_list.html +++ b/forums/templates/forums/forum_list.html @@ -5,8 +5,8 @@ {% block breadcrumb_items %} -{{ block.super }} -<span class="breadcrumb-item">Forums</span> + {{ block.super }} + <span class="breadcrumb-item">Forums</span> {% endblock %} @@ -14,80 +14,80 @@ {% block content %} -<div class="row"> - <div class="col-12"> + <div class="row"> + <div class="col-12"> - <h3 class="highlight">Forums</h3> - {% if perms.forums.can_add_forum %} - <ul> - <li><a href="{% url 'forums:forum_create' %}">Create a new Forum</a></li> - <li><a href="{% url 'forums:meeting_create' %}">Create a new Meeting</a></li> - </ul> - {% endif %} + <h3 class="highlight">Forums</h3> + {% if perms.forums.can_add_forum %} + <ul> + <li><a href="{% url 'forums:forum_create' %}">Create a new Forum</a></li> + <li><a href="{% url 'forums:meeting_create' %}">Create a new Meeting</a></li> + </ul> + {% endif %} - <div class="card-columns"> - {% for forum in object_list %} - <div class="card"> - <div class="card-header"> - {% 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 flex-wrap justify-content-between"> - <a href="{{ forum.get_absolute_url }}">{{ forum|truncatechars:30 }}</a> - <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 }} - {% if forum.child_forums.all|length > 0 %} - <hr/> - <p>Descendants:</p> - <ul class="list-unstyled forumList"> - {% for child in forum.child_forums.all %} - {% include 'forums/forum_as_li.html' with forum=child %} - {% endfor %} - </ul> - {% endif %} - </div> + <div class="card-columns"> + {% for forum in object_list %} + <div class="card"> + <div class="card-header"> + {% 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 flex-wrap justify-content-between"> + <a href="{{ forum.get_absolute_url }}">{{ forum|truncatechars:30 }}</a> + <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 }} + {% if forum.child_forums.all|length > 0 %} + <hr/> + <p>Descendants:</p> + <ul class="list-unstyled forumList"> + {% for child in forum.child_forums.all %} + {% include 'forums/forum_as_li.html' with forum=child %} + {% endfor %} + </ul> + {% endif %} + </div> + </div> + {% empty %} + <p>No visible Forums found.</p> + {% endfor %} </div> - {% empty %} - <p>No visible Forums found.</p> - {% endfor %} </div> </div> -</div> -<div class="row"> - <div class="col-12"> - <h3 class="highlight">Latest postings</h3> - <table class="table"> - <thead class="thead-default"> - <tr> - <th>Forum</th> - <th>Latest post</th> - <th>Posted on</th> - <th>Nr posts</th> - </tr> - </thead> - <tbody> - {% for forum in object_list %} - <tr> - <td><a href="{{ forum.get_absolute_url }}">{{ forum }}</a></td> - <td>{{ forum.latest_post }}</td> - <td>{{ forum.latest_post.posted_on|date:"Y-m-d" }}</td> - <td><span class="badge badge-primary badge-pill">{{ forum.nr_posts }}</span></td> - </tr> - {% empty %} - <tr> - <td>No visible Posts found.</td> - </tr> - {% endfor %} - </tbody> - </table> + <div class="row"> + <div class="col-12"> + <h3 class="highlight">Latest postings</h3> + <table class="table"> + <thead class="thead-default"> + <tr> + <th>Forum</th> + <th>Latest post</th> + <th>Posted on</th> + <th>Nr posts</th> + </tr> + </thead> + <tbody> + {% for forum in object_list %} + <tr> + <td><a href="{{ forum.get_absolute_url }}">{{ forum }}</a></td> + <td>{{ forum.latest_post }}</td> + <td>{{ forum.latest_post.posted_on|date:"Y-m-d" }}</td> + <td><span class="badge badge-primary badge-pill">{{ forum.nr_posts }}</span></td> + </tr> + {% empty %} + <tr> + <td>No visible Posts found.</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> </div> -</div> {% endblock content %} diff --git a/forums/templates/forums/forum_permissions.html b/forums/templates/forums/forum_permissions.html index 55f0c5580..045282875 100644 --- a/forums/templates/forums/forum_permissions.html +++ b/forums/templates/forums/forum_permissions.html @@ -4,8 +4,8 @@ {% load guardian_tags %} {% block breadcrumb_items %} - {{ block.super }} -<span class="breadcrumb-item">Forum permissions</span> + {{ block.super }} + <span class="breadcrumb-item">Forum permissions</span> {% endblock %} {% load scipost_extras %} @@ -15,23 +15,23 @@ {% block content %} -<div class="row"> - <div class="col-12"> + <div class="row"> + <div class="col-12"> - <h3 class="highlight">{{ forum.name }}: permissions{% if group %} for Group {{ group.name }}{% endif %}</h3> + <h3 class="highlight">{{ forum.name }}: permissions{% if group %} for Group {{ group.name }}{% endif %}</h3> - <form action="{% url 'forums:forum_permissions' slug=forum.slug %}" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" value="Assign permissions" class="btn btn-primary"> - </form> + <form action="{% url 'forums:forum_permissions' slug=forum.slug %}" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input type="submit" value="Assign permissions" class="btn btn-primary"> + </form> + </div> </div> -</div> {% endblock content %} {% block footer_script %} -{{ block.super }} -{{ form.media }} + {{ block.super }} + {{ form.media }} {% endblock footer_script %} diff --git a/forums/templates/forums/motion_confirm_create.html b/forums/templates/forums/motion_confirm_create.html index 3d626c706..d6d2f68fa 100644 --- a/forums/templates/forums/motion_confirm_create.html +++ b/forums/templates/forums/motion_confirm_create.html @@ -5,54 +5,54 @@ {% block breadcrumb_items %} -{{ block.super }} -<span class="breadcrumb-item">Confirm Motion creation</span> + {{ block.super }} + <span class="breadcrumb-item">Confirm Motion creation</span> {% endblock %} {% block pagetitle %}: Motion: confirm creation{% endblock pagetitle %} {% block content %} -<div class="row"> - <div class="col-12"> - <h3 class="highlight">Preview</h3> - - <div class="card"> - <div class="card-header"> - {{ form.initial.subject }} - </div> - <div class="card-body"> - {% if form.initial.text %} - {{ form.initial.text|restructuredtext }} - {% else %} - <span class="text-danger">No text given</span> - {% endif %} + <div class="row"> + <div class="col-12"> + <h3 class="highlight">Preview</h3> + + <div class="card"> + <div class="card-header"> + {{ form.initial.subject }} + </div> + <div class="card-body"> + {% if form.initial.text %} + {{ form.initial.text|restructuredtext }} + {% else %} + <span class="text-danger">No text given</span> + {% endif %} + </div> </div> - </div> - {% if form.errors %} - {% for field in form %} - {% for error in field.errors %} - <div class="alert alert-danger"> - <strong>{{ field.name }} - {{ error|escape }}</strong> - </div> - {% endfor %} - {% endfor %} - {% for error in form.non_field_errors %} - <div class="alert alert-danger"> - <strong>{{ error|escape }}</strong> - </div> - {% endfor %} - {% endif %} - - <form action="" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" value="Confirm Motion creation" class="btn btn-primary"> - <span class="text-danger"> <strong>Not satisfied?</strong> Hit your browser's back button and redraft your Motion</span> - </form> + {% if form.errors %} + {% for field in form %} + {% for error in field.errors %} + <div class="alert alert-danger"> + <strong>{{ field.name }} - {{ error|escape }}</strong> + </div> + {% endfor %} + {% endfor %} + {% for error in form.non_field_errors %} + <div class="alert alert-danger"> + <strong>{{ error|escape }}</strong> + </div> + {% endfor %} + {% endif %} + + <form action="" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input type="submit" value="Confirm Motion creation" class="btn btn-primary"> + <span class="text-danger"> <strong>Not satisfied?</strong> Hit your browser's back button and redraft your Motion</span> + </form> + </div> </div> -</div> {% endblock content %} diff --git a/forums/templates/forums/motion_form.html b/forums/templates/forums/motion_form.html index ce4f3e20e..75018ddaf 100644 --- a/forums/templates/forums/motion_form.html +++ b/forums/templates/forums/motion_form.html @@ -5,23 +5,23 @@ {% block breadcrumb_items %} -{{ block.super }} -<span class="breadcrumb-item">{% if form.instance.id %}Update {{ form.instance }}{% else %}New Motion{% endif %}</span> + {{ block.super }} + <span class="breadcrumb-item">{% if form.instance.id %}Update {{ form.instance }}{% else %}New Motion{% endif %}</span> {% endblock %} {% block pagetitle %}: Motion{% endblock pagetitle %} {% block content %} -<div class="row"> - <div class="col-12"> - <h3 class="highlight">Create a new Motion</h3> - <form action="" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" value="Run preview" class="btn btn-primary"> - </form> + <div class="row"> + <div class="col-12"> + <h3 class="highlight">Create a new Motion</h3> + <form action="" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input type="submit" value="Run preview" class="btn btn-primary"> + </form> + </div> </div> -</div> {% endblock content %} diff --git a/forums/templates/forums/post_card.html b/forums/templates/forums/post_card.html index 6abd15a0b..4e740b40c 100644 --- a/forums/templates/forums/post_card.html +++ b/forums/templates/forums/post_card.html @@ -7,7 +7,7 @@ {{ 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 and not post.motion %} - - regarding <a href="{{ post.parent.get_absolute_url }}">{{ post.parent }}</a> + - regarding <a href="{{ post.parent.get_absolute_url }}">{{ post.parent }}</a> {% endif %} </div> </div> @@ -18,63 +18,63 @@ <div class="d-flex flex-wrap justify-content-end align-items-center"> <div class="flex-grow-1"> {% if post.followup_posts.all|length > 0 %} - <span class="badge badge-primary badge-pill">{% with nr_followups=post.nr_followups %}{{ nr_followups }} repl{{ nr_followups|pluralize:"y,ies" }}{% endwith %}</span> + <span class="badge badge-primary badge-pill">{% with nr_followups=post.nr_followups %}{{ nr_followups }} repl{{ nr_followups|pluralize:"y,ies" }}{% endwith %}</span> {% endif %} {% if post.post_ptr %} - <a href="{% url 'forums:post_create' slug=forum.slug parent_model='post' parent_id=post.post_ptr.id %}">{% if post.motion %}Post a Comment on this Motion{% else %}Reply to the above post{% endif %}</a> + <a href="{% url 'forums:post_create' slug=forum.slug parent_model='post' parent_id=post.post_ptr.id %}">{% if post.motion %}Post a Comment on this Motion{% else %}Reply to the above post{% endif %}</a> {% else %} - <a href="{% url 'forums:post_create' slug=forum.slug parent_model='post' parent_id=post.id %}">{% if post.motion %}Post a Comment on this Motion{% else %}Reply to the above post{% endif %}</a> + <a href="{% url 'forums:post_create' slug=forum.slug parent_model='post' parent_id=post.id %}">{% if post.motion %}Post a Comment on this Motion{% else %}Reply to the above post{% endif %}</a> {% endif %} </div> {% if post.motion %} - <div class="align-self-center px-2"> - Voting results - <span class="text-white-50"> - {% if request.user in post.motion.in_agreement.all %} - <br/>You have voted <span class="text-success">Agree</span> - {% elif request.user in post.motion.in_doubt.all %} - <br/>You have voted <span class="text-warning">Doubt</span> - {% elif request.user in post.motion.in_disagreement.all %} - <br/>You have voted <span class="text-danger">Disagree</span> - {% elif request.user in post.motion.in_abstain.all %} - <br/>You have <span class="text-white-50">Abstained</span> - {% elif request.user in post.motion.eligible_for_voting.all %} - <br/>[click to vote] - {% endif %} - </span> - </div> - <div> - <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='Y' %}" method="post">{% csrf_token %} - <input type="submit" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Agree" value="{{ post.motion.in_agreement.all|length }}"> - </form> - </div> - <div> - <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='M' %}" method="post">{% csrf_token %} - <input type="submit" class="btn btn-warning" data-toggle="tooltip" data-placement="top" title="Doubt" value="{{ post.motion.in_doubt.all|length }}"> - </form> - </div> - <div> - <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='N' %}" method="post">{% csrf_token %} - <input type="submit" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Disagree" value="{{ post.motion.in_disagreement.all|length }}"> - </form> - </div> - <div> - <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='A' %}" method="post">{% csrf_token %} - <input type="submit" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Abstain" value="{{ post.motion.in_abstain.all|length }}"> - </form> - </div> - <div class="align-self-center px-2"> - Voting deadline:<br/>{{ post.motion.voting_deadline|date:'Y-m-d' }} - </div> + <div class="align-self-center px-2"> + Voting results + <span class="text-white-50"> + {% if request.user in post.motion.in_agreement.all %} + <br/>You have voted <span class="text-success">Agree</span> + {% elif request.user in post.motion.in_doubt.all %} + <br/>You have voted <span class="text-warning">Doubt</span> + {% elif request.user in post.motion.in_disagreement.all %} + <br/>You have voted <span class="text-danger">Disagree</span> + {% elif request.user in post.motion.in_abstain.all %} + <br/>You have <span class="text-white-50">Abstained</span> + {% elif request.user in post.motion.eligible_for_voting.all %} + <br/>[click to vote] + {% endif %} + </span> + </div> + <div> + <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='Y' %}" method="post">{% csrf_token %} + <input type="submit" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Agree" value="{{ post.motion.in_agreement.all|length }}"> + </form> + </div> + <div> + <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='M' %}" method="post">{% csrf_token %} + <input type="submit" class="btn btn-warning" data-toggle="tooltip" data-placement="top" title="Doubt" value="{{ post.motion.in_doubt.all|length }}"> + </form> + </div> + <div> + <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='N' %}" method="post">{% csrf_token %} + <input type="submit" class="btn btn-danger" data-toggle="tooltip" data-placement="top" title="Disagree" value="{{ post.motion.in_disagreement.all|length }}"> + </form> + </div> + <div> + <form action="{% url 'forums:motion_vote' slug=forum.slug motion_id=post.motion.id vote='A' %}" method="post">{% csrf_token %} + <input type="submit" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Abstain" value="{{ post.motion.in_abstain.all|length }}"> + </form> + </div> + <div class="align-self-center px-2"> + Voting deadline:<br/>{{ post.motion.voting_deadline|date:'Y-m-d' }} + </div> {% endif %} </div> </div> {% if post.followup_posts.all|length > 0 %} - <div class="followupPosts{% if post.motion %}AfterMotion{% endif %}"> - {% for followup in post.followup_posts.all %} - {% include 'forums/post_card.html' with post=followup %} - {% endfor %} - </div> + <div class="followupPosts{% if post.motion %}AfterMotion{% endif %}"> + {% for followup in post.followup_posts.all %} + {% include 'forums/post_card.html' with post=followup %} + {% endfor %} + </div> {% endif %} </div> diff --git a/forums/templates/forums/post_confirm_create.html b/forums/templates/forums/post_confirm_create.html index 145af977b..ecfe1118e 100644 --- a/forums/templates/forums/post_confirm_create.html +++ b/forums/templates/forums/post_confirm_create.html @@ -5,54 +5,54 @@ {% block breadcrumb_items %} -{{ block.super }} -<span class="breadcrumb-item">Confirm Post creation</span> + {{ block.super }} + <span class="breadcrumb-item">Confirm Post creation</span> {% endblock %} {% block pagetitle %}: Post: confirm creation{% endblock pagetitle %} {% block content %} -<div class="row"> - <div class="col-12"> - <h3 class="highlight">Preview</h3> - - <div class="card"> - <div class="card-header"> - {{ form.initial.subject }} - </div> - <div class="card-body"> - {% if form.initial.text %} - {{ form.initial.text|restructuredtext }} - {% else %} - <span class="text-danger">No text given</span> - {% endif %} + <div class="row"> + <div class="col-12"> + <h3 class="highlight">Preview</h3> + + <div class="card"> + <div class="card-header"> + {{ form.initial.subject }} + </div> + <div class="card-body"> + {% if form.initial.text %} + {{ form.initial.text|restructuredtext }} + {% else %} + <span class="text-danger">No text given</span> + {% endif %} + </div> </div> - </div> - {% if form.errors %} - {% for field in form %} - {% for error in field.errors %} - <div class="alert alert-danger"> - <strong>{{ field.name }} - {{ error|escape }}</strong> - </div> - {% endfor %} - {% endfor %} - {% for error in form.non_field_errors %} - <div class="alert alert-danger"> - <strong>{{ error|escape }}</strong> - </div> - {% endfor %} - {% endif %} - - <form action="" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" value="Confirm Post creation" class="btn btn-primary"> - <span class="text-danger"> <strong>Not satisfied?</strong> Hit your browser's back button and redraft your Post</span> - </form> + {% if form.errors %} + {% for field in form %} + {% for error in field.errors %} + <div class="alert alert-danger"> + <strong>{{ field.name }} - {{ error|escape }}</strong> + </div> + {% endfor %} + {% endfor %} + {% for error in form.non_field_errors %} + <div class="alert alert-danger"> + <strong>{{ error|escape }}</strong> + </div> + {% endfor %} + {% endif %} + + <form action="" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input type="submit" value="Confirm Post creation" class="btn btn-primary"> + <span class="text-danger"> <strong>Not satisfied?</strong> Hit your browser's back button and redraft your Post</span> + </form> + </div> </div> -</div> {% endblock content %} diff --git a/forums/templates/forums/post_form.html b/forums/templates/forums/post_form.html index 867b3e610..b78bd613d 100644 --- a/forums/templates/forums/post_form.html +++ b/forums/templates/forums/post_form.html @@ -5,23 +5,23 @@ {% block breadcrumb_items %} -{{ block.super }} -<span class="breadcrumb-item">{% if form.instance.id %}Update {{ form.instance }}{% else %}New Post{% endif %}</span> + {{ block.super }} + <span class="breadcrumb-item">{% if form.instance.id %}Update {{ form.instance }}{% else %}New Post{% endif %}</span> {% endblock %} {% block pagetitle %}: Post{% endblock pagetitle %} {% block content %} -<div class="row"> - <div class="col-12"> - <h3 class="highlight">Compose a new Post</h3> - <form action="" method="post"> - {% csrf_token %} - {{ form|bootstrap }} - <input type="submit" value="Run preview" class="btn btn-primary"> - </form> + <div class="row"> + <div class="col-12"> + <h3 class="highlight">Compose a new Post</h3> + <form action="" method="post"> + {% csrf_token %} + {{ form|bootstrap }} + <input type="submit" value="Run preview" class="btn btn-primary"> + </form> + </div> </div> -</div> {% endblock content %} -- GitLab