Skip to content
Snippets Groups Projects
Commit 5f6407a6 authored by Benjamin Hättasch's avatar Benjamin Hättasch
Browse files

Add more views to submission component and improve existing one

Add dynamic title handling to base html
Add more information to submission overview
Move AK list to own file for use in other pages
Add detail view for AK
Add views with AK overview list as well as filtered lists (by type and tag)
Add corresponding German translations
parent ff336ff4
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ msgid "" ...@@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-17 14:14+0000\n" "POT-Creation-Date: 2019-10-17 23:30+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -17,27 +17,70 @@ msgstr "" ...@@ -17,27 +17,70 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: templates/AKSubmission/submission_overview.html:9 #: templates/AKSubmission/ak_detail.html:6
#: templates/AKSubmission/submission_overview.html:13 #: templates/AKSubmission/ak_detail.html:11
#: templates/AKSubmission/ak_detail.html:16
#: templates/AKSubmission/ak_list.html:6 templates/AKSubmission/ak_list.html:11
#: templates/AKSubmission/ak_list.html:16
#: templates/AKSubmission/submission_overview.html:6
#: templates/AKSubmission/submission_overview.html:11
#: templates/AKSubmission/submission_overview.html:15
msgid "AK Submission" msgid "AK Submission"
msgstr "AK-Eintragung" msgstr "AK-Eintragung"
#: templates/AKSubmission/submission_overview.html:18 #: templates/AKSubmission/ak_detail.html:28
msgid "Submit" #: templates/AKSubmission/ak_list_table.html:6
msgstr "Eintragen" msgid "Who?"
msgstr "Wer?"
#: templates/AKSubmission/submission_overview.html:24 #: templates/AKSubmission/ak_detail.html:29
msgid "Current AKs" #: templates/AKSubmission/ak_list_table.html:6
msgstr "Aktuelle AKs" msgid "Type"
msgstr "Typ"
#: templates/AKSubmission/ak_detail.html:31
#: templates/AKSubmission/ak_list_table.html:6
msgid "Tags"
msgstr "Tags"
#: templates/AKSubmission/ak_detail.html:39
msgid "Reso?"
msgstr "Reso?"
#: templates/AKSubmission/ak_detail.html:55
msgid "When?"
msgstr "Wann?"
#: templates/AKSubmission/ak_detail.html:56
msgid "Duration"
msgstr "Dauer"
#: templates/AKSubmission/ak_detail.html:57
msgid "Room"
msgstr "Raum"
#: templates/AKSubmission/submission_overview.html:27 #: templates/AKSubmission/ak_list.html:12
msgid "AKs"
msgstr "AKs"
#: templates/AKSubmission/ak_list_table.html:6
msgid "Name" msgid "Name"
msgstr "Name" msgstr "Name"
#: templates/AKSubmission/submission_overview.html:27 #: templates/AKSubmission/ak_list_table.html:13
msgid "Who?" #, fuzzy
msgstr "Wer?" #| msgid "Current AKs"
msgid "Present AK"
msgstr "Aktuelle AKs"
#: templates/AKSubmission/submission_overview.html:27 #: templates/AKSubmission/ak_list_table.html:15
msgid "Tags" msgid "Reso"
msgstr "Tags" msgstr "Reso"
#: templates/AKSubmission/submission_overview.html:20
msgid "Submit"
msgstr "Eintragen"
#: templates/AKSubmission/submission_overview.html:26
msgid "Current AKs"
msgstr "Aktuelle AKs"
{% extends 'base.html' %}
{% load i18n %}
{% load fontawesome %}
{% block title %}{{ ak.event.slug }} - {% trans "AK Submission" %} - {{ ak.slug }}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="#">AKPlanning</a></li>
<li class="breadcrumb-item"><a href="#">{{ ak.event.slug }}</a></li>
<li class="breadcrumb-item"><a href="{% url 'submit:submission_overview' event_slug=ak.event.slug %}">{% trans "AK Submission" %}</a></li>
<li class="breadcrumb-item active">{{ ak.name }}</li>
{% endblock %}
{% block content %}
<h1 style="margin-bottom: 30px;">{{ ak.event.name }}: {% trans "AK Submission" %}</h1>
<div class="float-right">
{% if ak.link != "" %}
<a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a>
{% endif %}
<a href="#" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a>
</div>
<h2>{{ ak.name }}</h2>
<table class="table table-borderless">
<tr><td>{% trans "Who?" %}</td><td>{{ ak.owners_list }}</td></tr>
<tr><td>{% trans "Type" %}</td><td><a href="{% url 'submit:ak_list_by_type' event_slug=ak.event.slug type_pk=ak.type.pk %}"><span class="badge badge-primary">{{ ak.type }}</span></a></td></tr>
<tr>
<td>{% trans "Tags" %}</td>
<td>
{% for tag in ak.tags.all %}
<a href="{% url 'submit:ak_list_by_tag' event_slug=ak.event.slug tag_pk=tag.pk %}"><span class="badge badge-info">{{ tag }}</span></a>
{% endfor %}
</td>
</tr>
<tr>
<td>{% trans "Reso?" %}</td>
<td>
{% if ak.reso %}
{% fontawesome_icon "check" %}
{% else %}
{% fontawesome_icon "times" %}
{% endif %}
</td>
</tr>
</table>
<p style="margin-top: 30px;margin-bottom: 30px;">{{ ak.description }}</p>
<table class="table">
<thead>
<tr>
<th>{% trans "When?" %}</th>
<th>{% trans "Duration" %}</th>
<th>{% trans "Room" %}</th>
</tr>
</thead>
<tbody>
{% for slot in ak.akslot_set.all %}
<tr>
<td>{{ slot.start_simplified }}</td>
<td>{{ slot.duration }}</td>
<td>{{ slot.room }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% extends 'base.html' %}
{% load i18n %}
{% load fontawesome %}
{% block title %}{{ event.slug }} - {% trans "AK Submission" %}{% endblock %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="#">AKPlanning</a></li>
<li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li>
<li class="breadcrumb-item"><a href="{% url 'submit:submission_overview' event_slug=event.slug %}">{% trans "AK Submission" %}</a></li>
<li class="breadcrumb-item active">{% trans "AKs" %}</li>
{% endblock %}
{% block content %}
<h1>{{ event.name }}: {% trans "AK Submission" %}</h1>
<b>Types:</b>
{% for type in types %}
<a href="{% url 'submit:ak_list_by_type' event_slug=event.slug type_pk=type.pk %}"><span class="badge badge-primary">{{ type }}</span></a>
{% endfor %}
<br><br>
<b>Tags:</b>
{% for tag in tags.all %}
<a href="{% url 'submit:ak_list_by_tag' event_slug=event.slug tag_pk=tag.pk %}"><span class="badge badge-primary">{{ tag }}</span></a>
{% endfor %}
<br><br>
{% if filter_condition_string != "" %}
<h2 class="text-secondary">{{ filter_condition_string }}</h2>
{% endif %}
{% include "AKSubmission/ak_list_table.html" %}
{% endblock %}
{% load i18n %}
{% load fontawesome %}
<table id="akTable" class="table table-striped">
<thead>
<tr><th>{% trans "Name" %}</th><th>{% trans "Who?" %}</th><th>{% trans "Type" %}</th><th>{% trans "Tags" %}</th><th></th></tr>
</thead>
<tbody>
{% for ak in AKs %}
<tr>
<td>
<b>{{ ak.name }}</b>
<span class="badge badge-dark badge-pill" title="{% trans 'Present AK' %}">{% fontawesome_icon "bullhorn" %}</span>
{% if ak.reso %}
<span class="badge badge-dark badge-pill" title="{% trans 'Reso' %}">{% fontawesome_icon "scroll" %}</span>
{% endif %}
</td>
<td>{{ ak.owners_list }}</td>
<td><a href="{% url 'submit:ak_list_by_type' event_slug=event.slug type_pk=ak.type.pk %}"><span class="badge badge-primary">{{ ak.type }}</span></a></td>
<td>
{% for tag in ak.tags.all %}
<a href="{% url 'submit:ak_list_by_tag' event_slug=event.slug tag_pk=tag.pk %}"><span class="badge badge-info">{{ tag }}</span></a>
{% endfor %}
</td>
<td class="text-right">
<a href="{% url 'submit:ak_detail' event_slug=ak.event.slug pk=ak.pk %}" class="btn btn-primary">{% fontawesome_icon 'info' %}</a>
{% if ak.link != "" %}
<a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a>
{% endif %}
<a href="#" class="btn btn-success">{% fontawesome_icon 'pencil-alt' %}</a>
</td>
</tr>
<tr>
<td colspan="5" class="small">{{ ak.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
{% load i18n %} {% load i18n %}
{% load fontawesome %} {% load fontawesome %}
{% block title %}{{ event.slug }} - {% trans "AK Submission" %}{% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
<li class="breadcrumb-item"><a href="#">AKPlanning</a></li> <li class="breadcrumb-item"><a href="#">AKPlanning</a></li>
<li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li> <li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li>
...@@ -23,23 +25,6 @@ ...@@ -23,23 +25,6 @@
<h2>{% trans "Current AKs" %}</h2> <h2>{% trans "Current AKs" %}</h2>
<table class="table table-striped"> {% include "AKSubmission/ak_list_table.html" %}
<tr><th>{% trans "Name" %}</th><th>{% trans "Who?" %}</th><th>{% trans "Tags" %}</th><th></th></tr>
{% for ak in AKs %}
<tr>
<td>{{ ak.name }}</td>
<td>{{ ak.owners_list }}</td>
<td>
{% for tag in ak.tags.all %}
<span class="badge badge-info">{{ tag }}</span>
{% endfor %}
</td>
<td>
<a href="#" class="btn btn-primary">{% fontawesome_icon 'info' %}</a>
<a href="#" class="btn btn-success">{% fontawesome_icon 'edit' %}</a>
</td>
</tr>
{% endfor %}
</table>
{% endblock %} {% endblock %}
...@@ -9,6 +9,10 @@ urlpatterns = [ ...@@ -9,6 +9,10 @@ urlpatterns = [
'<slug:event_slug>/', '<slug:event_slug>/',
include([ include([
path('submission/', views.SubmissionOverviewView.as_view(), name='submission_overview'), path('submission/', views.SubmissionOverviewView.as_view(), name='submission_overview'),
path('submission/ak/<int:pk>', views.AKDetailView.as_view(), name='ak_detail'),
path('submission/aks/', views.AKListView.as_view(), name='ak_list'),
path('submission/aks/type/<int:type_pk>', views.AKListByTypeView.as_view(), name='ak_list_by_type'),
path('submission/aks/tag/<int:tag_pk>', views.AKListByTagView.as_view(), name='ak_list_by_tag'),
]) ])
), ),
] ]
from django.views.generic import ListView from django.http import Http404
from django.views.generic import ListView, DetailView
from AKModel.models import AK from AKModel.models import AK, AKType, AKTag
from AKModel.views import FilterByEventSlugMixin from AKModel.views import FilterByEventSlugMixin
from django.utils.translation import gettext_lazy as _
class SubmissionOverviewView(FilterByEventSlugMixin, ListView): class SubmissionOverviewView(FilterByEventSlugMixin, ListView):
model = AK model = AK
context_object_name = "AKs" context_object_name = "AKs"
template_name = "AKSubmission/submission_overview.html" template_name = "AKSubmission/submission_overview.html"
ordering = ["type"] ordering = ["type"]
class AKDetailView(DetailView):
model = AK
context_object_name = "ak"
template_name = "AKSubmission/ak_detail.html"
class AKListView(FilterByEventSlugMixin, ListView):
model = AK
context_object_name = "AKs"
template_name = "AKSubmission/ak_list.html"
filter_condition_string = ""
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(object_list=object_list, **kwargs)
context["types"] = AKType.objects.all()
context["tags"] = AKTag.objects.all()
context["filter_condition_string"] = self.filter_condition_string
return context
class AKListByTypeView(AKListView):
type = None
def get_queryset(self):
# Find type based on event slug
try:
self.type = AKType.objects.get(pk=self.kwargs['type_pk'])
self.filter_condition_string = f"{_('Type')} = {self.type.name}"
except AKType.DoesNotExist:
raise Http404
return super().get_queryset().filter(type=self.type)
class AKListByTagView(AKListView):
tag = None
def get_queryset(self):
# Find type based on event slug
try:
self.tag = AKTag.objects.get(pk=self.kwargs['tag_pk'])
self.filter_condition_string = f"{_('Tag')} = {self.tag.name}"
except AKTag.DoesNotExist:
raise Http404
return super().get_queryset().filter(tags=self.tag)
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>AKPlanning</title> <title>{% block title %}AK Planning{% endblock %}</title>
{# Load Bootstrap CSS and JavaScript as well as font awesome #} {# Load Bootstrap CSS and JavaScript as well as font awesome #}
{% bootstrap_css %} {% bootstrap_css %}
......
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