diff --git a/AKDashboard/locale/de_DE/LC_MESSAGES/django.po b/AKDashboard/locale/de_DE/LC_MESSAGES/django.po new file mode 100644 index 0000000000000000000000000000000000000000..e292f2bec1137909c2cc83c6682481fe4fbe69b3 --- /dev/null +++ b/AKDashboard/locale/de_DE/LC_MESSAGES/django.po @@ -0,0 +1,42 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-01-09 00:07+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: templates/AKDashboard/dashboard.html:31 +msgid "Current AKs" +msgstr "Aktuelle AKs" + +#: templates/AKDashboard/dashboard.html:36 +msgid "AK Wall" +msgstr "AK-Wall" + +#: templates/AKDashboard/dashboard.html:44 +msgid "AK Submission" +msgstr "AK-Submission" + +#: templates/AKDashboard/dashboard.html:51 +msgid "Write to organizers of this event for questions and comments" +msgstr "Kontaktiere die Organisator*innen des Events bei Fragen oder Kommentaren" + +#: templates/AKDashboard/dashboard.html:58 +msgid "Currently, there are no Events!" +msgstr "Aktuell gibt es keine Events!" + +#: templates/AKDashboard/dashboard.html:61 +msgid "Please contact an administrator if you want to use AKPlanning." +msgstr "Bitte kontaktiere eine*n Administrator*in, falls du AKPlanning verwenden möchtest." diff --git a/AKDashboard/static/AKDashboard/style.css b/AKDashboard/static/AKDashboard/style.css new file mode 100644 index 0000000000000000000000000000000000000000..4cb50650bdc69552a845563e88bc4ebab918d43b --- /dev/null +++ b/AKDashboard/static/AKDashboard/style.css @@ -0,0 +1,29 @@ +.dashboard-row { + margin-bottom: 5em; +} + +.dashboard-row > .row { + margin-left: 0; + padding-bottom: 1em; +} + +.dashboard-box .fa { + font-size: 26pt; +} + +.dashboard-box span.text { + display: block; + padding-top: 10px; + font-size: 12pt; +} + +.dashboard-box { + display: block; + padding: 2em; + +} + +.dashboard-button { + display: inline; + padding: 0; +} diff --git a/AKDashboard/templates/AKDashboard/dashboard.html b/AKDashboard/templates/AKDashboard/dashboard.html new file mode 100644 index 0000000000000000000000000000000000000000..0c4399ba1e13cec27b7b44dabbdebcf3a7f05163 --- /dev/null +++ b/AKDashboard/templates/AKDashboard/dashboard.html @@ -0,0 +1,65 @@ +{% extends 'base.html' %} + +{% load fontawesome %} +{% load i18n %} +{% load static %} +{% load tags_AKModel %} + +{% block imports %} + + {{ block.super }} + + <link rel="stylesheet" href="{% static 'AKDashboard/style.css' %}"> + +{% endblock %} + +{% block breadcrumbs %} + <li class="breadcrumb-item">AKPlanning</li> +{% endblock %} + +{% block content %} + {% for event in events %} + <div class="dashboard-row"> + <h2> {{ event.name }} </h2> + <div class="row"> + {% if 'AKPlan'|check_app_installed %} + + <a class="Color-Default" + href="{% url 'plan:ak_plan_current_next' event_slug=event.slug %}"> + <div class="col-sm-12 col-md-3 col-lg-2 dashboard-button"><span + class="fa fa-list-ul"></span> <span + class='text'>{% trans 'Current AKs' %}</span></div> + </a> + <a class="Color-Default" + href="{% url 'plan:ak_plan_timeline' event_slug=event.slug %}"> + <div class="col-sm-12 col-md-3 col-lg-2 dashboard-button"><span + class="fa fa-calendar"></span> <span class='text'>{% trans "AK Wall" %}</span></div> + </a> + {% endif %} + {% if 'AKSubmission'|check_app_installed %} + <a class="dashboard-box btn btn-primary" + href="{% url 'submit:submission_overview' event_slug=event.slug %}"> + <div class="col-sm-12 col-md-3 col-lg-2 dashboard-button"><span + class="fa fa-pencil-alt"></span> <span + class='text'>{% trans 'AK Submission' %}</span></div> + </a> + + {% endif %} + </div> + {% if event.contact_email %} + <p> + <a href="mailto:{{ event.contact_email }}">{% fontawesome_icon "envelope" %} {% trans "Write to organizers of this event for questions and comments" %}</a> + </p> + {% endif %} + </div> + {% empty %} + <div class="jumbotron"> + <h2 class="display-4"> + {% trans 'Currently, there are no Events!' %} + </h2> + <p class="lead"> + {% trans 'Please contact an administrator if you want to use AKPlanning.' %} + </p> + </div> + {% endfor %} +{% endblock %} \ No newline at end of file diff --git a/AKDashboard/urls.py b/AKDashboard/urls.py index b920578cef772d34fcb6bf8dcc428f9bb7d33009..24497d3008495e6545b9be678a77f218f7e6eb82 100644 --- a/AKDashboard/urls.py +++ b/AKDashboard/urls.py @@ -5,5 +5,5 @@ from AKDashboard import views app_name = "dashboard" urlpatterns = [ - path('', views.TopLevelRedirectView.as_view(), name='top_level_redirect'), + path('', views.DashboardView.as_view(), name="dashboard"), ] diff --git a/AKDashboard/views.py b/AKDashboard/views.py index 14660a24ea1038c685e4a9c4888c7fe0dc87ac5c..6d870680ea24ea27b53c1cdfefaa0a12f39e968a 100644 --- a/AKDashboard/views.py +++ b/AKDashboard/views.py @@ -1,12 +1,18 @@ -from django.urls import reverse_lazy -from django.views.generic import RedirectView +from django.utils.decorators import method_decorator +from django.views.decorators.csrf import ensure_csrf_cookie +from django.views.generic import TemplateView from AKModel.models import Event -class TopLevelRedirectView(RedirectView): - is_permanent = False +class DashboardView(TemplateView): + template_name = 'AKDashboard/dashboard.html' - def get_redirect_url(self, *args, **kwargs): - return reverse_lazy('submit:submission_overview', - kwargs={'event_slug': Event.objects.filter(active=True).last().slug}) + @method_decorator(ensure_csrf_cookie) + def dispatch(self, *args, **kwargs): + return super().dispatch(*args, **kwargs) + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context['events'] = Event.objects.all() + return context diff --git a/AKModel/templatetags/tags_AKModel.py b/AKModel/templatetags/tags_AKModel.py index 4c154816021ab08908b03290c86de25480075ea3..4540e85997647ba46b2cae4ac1404d03194e329c 100644 --- a/AKModel/templatetags/tags_AKModel.py +++ b/AKModel/templatetags/tags_AKModel.py @@ -1,9 +1,16 @@ from django import template +from django.apps import apps from django.conf import settings register = template.Library() + # Get Footer Info from settings @register.simple_tag def footer_info(): return settings.FOOTER_INFO + + +@register.filter +def check_app_installed(name): + return apps.is_installed(name) diff --git a/AKPlanning/settings.py b/AKPlanning/settings.py index ae81292a55b9540cd5b6cbd54fa32d16cf07203d..4d10d860b1df8ca0a698c15bfee04177d0b3f325 100644 --- a/AKPlanning/settings.py +++ b/AKPlanning/settings.py @@ -11,9 +11,8 @@ https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os -from django.utils.translation import gettext_lazy as _ - +from django.utils.translation import gettext_lazy as _ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) from split_settings.tools import optional, include @@ -37,7 +36,7 @@ INSTALLED_APPS = [ 'AKDashboard.apps.AkdashboardConfig', 'AKSubmission.apps.AksubmissionConfig', 'AKScheduling.apps.AkschedulingConfig', - 'AKPlan.apps.AkplanConfig', + # 'AKPlan.apps.AkplanConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes',