Skip to content
Snippets Groups Projects
Commit 18ea8002 authored by N.Geisler & B. Hättasch's avatar N.Geisler & B. Hättasch
Browse files

create first version of dashboard

deploy dashboard under /
create template view
provide template with important links for each event
handle case of no events
create template tag to ensure installed apps
parent bb7f4be9
No related branches found
No related tags found
No related merge requests found
# 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."
.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;
}
{% 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
......@@ -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"),
]
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
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)
......@@ -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',
......
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