diff --git a/forums/forms.py b/forums/forms.py new file mode 100644 index 0000000000000000000000000000000000000000..8edd8b1187e8181bd99a2f41e83de749f71c8d13 --- /dev/null +++ b/forums/forms.py @@ -0,0 +1,13 @@ +__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)" +__license__ = "AGPL v3" + + +from django import forms + +from .models import Forum + + +class ForumForm(forms.ModelForm): + class Meta: + model = Forum + fields = ['name', 'slug', 'publicly_visible', 'moderators'] diff --git a/forums/templates/forums/base.html b/forums/templates/forums/base.html new file mode 100644 index 0000000000000000000000000000000000000000..83076f2ac5c43e84223489d441e1ca50836c9e5b --- /dev/null +++ b/forums/templates/forums/base.html @@ -0,0 +1,13 @@ +{% extends 'scipost/base.html' %} + +{% block breadcrumb %} + <div class="container-outside header"> + <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_detail.html b/forums/templates/forums/forum_detail.html new file mode 100644 index 0000000000000000000000000000000000000000..e143e851e57ff42246c5e34db6a771dc8852d492 --- /dev/null +++ b/forums/templates/forums/forum_detail.html @@ -0,0 +1,21 @@ +{% extends 'forums/base.html' %} + +{% load bootstrap %} + +{% block breadcrumb_items %} + {{ block.super }} +<span class="breadcrumb-item">Details</span> +{% endblock %} + +{% load scipost_extras %} + +{% block pagetitle %}: Forum details{% endblock pagetitle %} + +{% block content %} +<div class="row"> + <div class="col-12"> + <p>{{ forum }}</p> + </div> +</div> + +{% endblock content %} diff --git a/forums/templates/forums/forum_form.html b/forums/templates/forums/forum_form.html new file mode 100644 index 0000000000000000000000000000000000000000..578e4e4b43abac73689e3ae3647756416442e203 --- /dev/null +++ b/forums/templates/forums/forum_form.html @@ -0,0 +1,25 @@ +{% extends 'forums/base.html' %} + +{% load bootstrap %} + +{% block breadcrumb_items %} +{{ 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 %} + + +{% 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> +</div> + + +{% endblock content %} diff --git a/forums/templates/forums/forum_list.html b/forums/templates/forums/forum_list.html new file mode 100644 index 0000000000000000000000000000000000000000..88c33f56819ffe426b6a377c1a8fee0ad2675c2a --- /dev/null +++ b/forums/templates/forums/forum_list.html @@ -0,0 +1,38 @@ +{% extends 'forums/base.html' %} + +{% load bootstrap %} + + +{% block breadcrumb_items %} +{{ block.super }} +<span class="breadcrumb-item">Forums</span> +{% endblock %} + + +{% block pagetitle %}: Forums{% endblock pagetitle %} + +{% block content %} + +<div class="row"> + <div class="col-12"> + <h3 class="highlight">Forums</h3> + <ul> + <li><a href="{% url 'forums:forum_create' %}">Create a new Forum</a></li> + </ul> + <table class="table"> + <tbody> + {% for forum in object_list %} + <tr> + <td>{{ forum }}</td> + </tr> + {% empty %} + <tr> + <td>No Forum defined</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> +</div> + +{% endblock content %} diff --git a/forums/urls.py b/forums/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..76098d09adcb472a4141186baca4079035cbb00a --- /dev/null +++ b/forums/urls.py @@ -0,0 +1,25 @@ +__copyright__ = "Copyright © Stichting SciPost (SciPost Foundation)" +__license__ = "AGPL v3" + + +from django.conf.urls import url + +from . import views + +urlpatterns = [ + url( + r'^add/$', + views.ForumCreateView.as_view(), + name='forum_create' + ), + url( + r'^(?P<slug>[\w-]+)/$', + views.ForumDetailView.as_view(), + name='forum_detail' + ), + url( + r'^$', + views.ForumListView.as_view(), + name='forums' + ), +]