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

Improve ak creation handling & introduce message handling into views

Add template and template tag for messages
Adapt success url of AK creation to point to detail page of created AK and show success message
parent f2bad4a9
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-18 22:22+0000\n" "POT-Creation-Date: 2019-10-18 23:53+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"
...@@ -25,42 +25,43 @@ msgstr "" ...@@ -25,42 +25,43 @@ msgstr ""
#: templates/AKSubmission/submission_overview.html:6 #: templates/AKSubmission/submission_overview.html:6
#: templates/AKSubmission/submission_overview.html:11 #: templates/AKSubmission/submission_overview.html:11
#: templates/AKSubmission/submission_overview.html:15 #: templates/AKSubmission/submission_overview.html:15
#: templates/AKSubmission/submit_new.html:12
msgid "AK Submission" msgid "AK Submission"
msgstr "AK-Eintragung" msgstr "AK-Eintragung"
#: templates/AKSubmission/ak_detail.html:30 #: templates/AKSubmission/ak_detail.html:32
#: templates/AKSubmission/ak_list_table.html:10 #: templates/AKSubmission/ak_list_table.html:10
msgid "Who?" msgid "Who?"
msgstr "Wer?" msgstr "Wer?"
#: templates/AKSubmission/ak_detail.html:32 #: templates/AKSubmission/ak_detail.html:34
#: templates/AKSubmission/ak_list_table.html:11 #: templates/AKSubmission/ak_list_table.html:11
msgid "Category" msgid "Category"
msgstr "Kategorie" msgstr "Kategorie"
#: templates/AKSubmission/ak_detail.html:38 #: templates/AKSubmission/ak_detail.html:40
msgid "Present this AK" msgid "Present this AK"
msgstr "Diesen AK vorstellen" msgstr "Diesen AK vorstellen"
#: templates/AKSubmission/ak_detail.html:42 #: templates/AKSubmission/ak_detail.html:44
#: templates/AKSubmission/ak_list.html:26 #: templates/AKSubmission/ak_list.html:26
#: templates/AKSubmission/ak_list_table.html:12 #: templates/AKSubmission/ak_list_table.html:12
msgid "Tags" msgid "Tags"
msgstr "Tags" msgstr "Tags"
#: templates/AKSubmission/ak_detail.html:48 #: templates/AKSubmission/ak_detail.html:50
msgid "Reso?" msgid "Reso?"
msgstr "Reso?" msgstr "Reso?"
#: templates/AKSubmission/ak_detail.html:60 #: templates/AKSubmission/ak_detail.html:62
msgid "When?" msgid "When?"
msgstr "Wann?" msgstr "Wann?"
#: templates/AKSubmission/ak_detail.html:61 #: templates/AKSubmission/ak_detail.html:63
msgid "Duration" msgid "Duration"
msgstr "Dauer" msgstr "Dauer"
#: templates/AKSubmission/ak_detail.html:62 #: templates/AKSubmission/ak_detail.html:64
msgid "Room" msgid "Room"
msgstr "Raum" msgstr "Raum"
...@@ -87,13 +88,19 @@ msgstr "Reso" ...@@ -87,13 +88,19 @@ msgstr "Reso"
#: templates/AKSubmission/submission_overview.html:17 #: templates/AKSubmission/submission_overview.html:17
msgid "" msgid ""
"On this page you can see a list of current AKs, change them and add new ones." "On this page you can see a list of current AKs, change them and add new ones."
msgstr "Auf dieser Seite kannst du eine Liste von aktuellen AKs sehen, diese bearbeiten und neue hinzufügen." msgstr ""
"Auf dieser Seite kannst du eine Liste von aktuellen AKs sehen, diese "
"bearbeiten und neue hinzufügen."
#: templates/AKSubmission/submission_overview.html:20 #: templates/AKSubmission/submission_overview.html:20
#: templates/AKSubmission/submit_new.html:26
msgid "Submit" msgid "Submit"
msgstr "Eintragen" msgstr "Eintragen"
#: templates/AKSubmission/submission_overview.html:21 #: templates/AKSubmission/submission_overview.html:21
#: templates/AKSubmission/submit_new.html:7
#: templates/AKSubmission/submit_new.html:13
#: templates/AKSubmission/submit_new.html:18
msgid "New AK" msgid "New AK"
msgstr "Neuer AK" msgstr "Neuer AK"
...@@ -104,3 +111,11 @@ msgstr "Neuer AK-Wunsch" ...@@ -104,3 +111,11 @@ msgstr "Neuer AK-Wunsch"
#: templates/AKSubmission/submission_overview.html:26 #: templates/AKSubmission/submission_overview.html:26
msgid "Current AKs" msgid "Current AKs"
msgstr "Aktuelle AKs" msgstr "Aktuelle AKs"
#: templates/AKSubmission/submit_new.html:23
msgid "Reset"
msgstr "Zurücksetzen"
#: views.py:71
msgid "AK successfully created"
msgstr "AK erfolgreich angelegt"
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
{% block content %} {% block content %}
<h1 style="margin-bottom: 30px;">{{ ak.event.name }}: {% trans "AK Submission" %}</h1> <h1 style="margin-bottom: 30px;">{{ ak.event.name }}: {% trans "AK Submission" %}</h1>
{% include "AKSubmission/messages.html" %}
<div class="float-right"> <div class="float-right">
{% if ak.link != "" %} {% if ak.link != "" %}
<a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a> <a href="{{ ak.link }}" class="btn btn-info">{% fontawesome_icon 'external-link-alt' %}</a>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% include "AKSubmission/messages.html" %}
<h2>{% trans 'New AK' %}</h2> <h2>{% trans 'New AK' %}</h2>
<form method="POST" class="post-form">{% csrf_token %} <form method="POST" class="post-form">{% csrf_token %}
{% bootstrap_form form %} {% bootstrap_form form %}
......
...@@ -24,3 +24,15 @@ def category_list(categories, event_slug): ...@@ -24,3 +24,15 @@ def category_list(categories, event_slug):
@register.inclusion_tag("AKSubmission/category_linked_badge.html") @register.inclusion_tag("AKSubmission/category_linked_badge.html")
def category_linked_badge(category, event_slug): def category_linked_badge(category, event_slug):
return {"category": category, "event_slug": event_slug} return {"category": category, "event_slug": event_slug}
@register.filter
def message_bootstrap_class(tag):
print(tag)
if tag == "error":
return "alert-danger"
elif tag == "success":
return "alert-success"
elif tag == "warning":
return "alert-warning"
return "alert-info"
from django.contrib import messages
from django.http import Http404 from django.http import Http404
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
...@@ -67,4 +68,5 @@ class AKSubmissionView(CreateView): ...@@ -67,4 +68,5 @@ class AKSubmissionView(CreateView):
form_class = AKForm form_class = AKForm
def get_success_url(self): def get_success_url(self):
return reverse_lazy('submit:submission_overview', kwargs={'event_slug': self.kwargs['event_slug']}) messages.add_message(self.request, messages.SUCCESS, _("AK successfully created"))
return reverse_lazy('submit:ak_detail', kwargs={'event_slug': self.kwargs['event_slug'], 'pk': self.object.pk})
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