Verified Commit 6f23b034 authored by Jonathan Weth's avatar Jonathan Weth

Update namespace and add AlekSIS base template to templates

parent 797aa1f3
{% extends "core/base.html" %}
{% load msg_box %}
{% block content %}
{% if msg == "success" %}
{% msg_box "Der Speiseplan wurde erfolgreich hochgeladen." "success" "check_circle" %}
{% elif msg == "delete_success" %}
{% msg_box "Der Speiseplan wurde erfolgreich gelöscht." "success" "check_circle" %}
{% endif %}
<script type="text/javascript">
$('#alert_close').click(function () {
$("#alert_box").fadeOut("slow", function () {
});
});
</script>
<a class="waves-effect waves-light btn green" href="{% url "menu_upload" %}"><i class="material-icons left">add</i>
Neuen Speiseplan hochladen
</a>
<a class="waves-effect waves-light btn orange" href="{% url "menu_show_current" %}"><i class="material-icons left">picture_as_pdf</i>
Aktuellen Speiseplan anzeigen
</a>
<h5>Übersicht der hochgeladenen Speisepläne</h5>
<ul class="collection">
{% for menu in menus %}
<li class="collection-item ">
<span class="title">{{ menu }}</span>
<p>
<a class="btn-flat waves-effect waves-green" href="/media/{{ menu.pdf }}" target="_blank">
<i class="material-icons left">picture_as_pdf</i> Anzeigen
</a>
<a class="btn-flat delete-menu waves-effect waves-red" href="{% url "menu_delete" menu.id %}">
<i class="material-icons left">delete</i> Löschen
</a>
</p>
</li>
{% endfor %}
</ul>
<script type="text/javascript">
$(".delete-menu").click(function (e) {
if (!confirm("Wirklich löschen?")) {
e.preventDefault();
}
})
</script>
{% endblock %}
{% extends "core/base.html" %}
{% load msg_box %}
{% block content %}
<h5>Speiseplan hochladen</h5>
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{% msg_box form.non_field_errors "error" "error" %}
<div class="row">
<div class="input-field col s5">
{% msg_box form.calendar_week.errors "error" "error" %}
<small>Kalenderwoche</small>
{{ form.calendar_week }}
</div>
<div class="col s2 center-align">
<small>&nbsp;</small>
<h4>/</h4>
</div>
<div class="input-field col s5">
{% msg_box form.year.errors "error" "error" %}
<small>Jahr</small>
{{ form.year }}
</div>
</div>
<div class="file-field input-field">
{% msg_box form.pdf.errors "error" "error" %}
<div class="btn">
<span><i class="material-icons center">cloud_upload</i></span>
<input type="file" name="{{ form.pdf.html_name }}">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
</div>
<button class="waves-effect waves-light btn green" type="submit">
<i class="material-icons left">cloud_upload</i>
Speiseplan hochladen und veröffentlichen
</button>
</form>
<p>
<a href="{% url 'menu_index' %}" class="waves-effect waves-teal btn-flat">Zurück zur Übersicht</a>
</p>
{% endblock %}
{% include 'partials/header.html' %}
{% load msg_box %}
<main>
{% if msg == "success" %}
{% msg_box "Der Speiseplan wurde erfolgreich hochgeladen." "success" "check_circle" %}
{% elif msg == "delete_success" %}
{% msg_box "Der Speiseplan wurde erfolgreich gelöscht." "success" "check_circle" %}
{% endif %}
<script type="text/javascript">
$('#alert_close').click(function () {
$("#alert_box").fadeOut("slow", function () {
});
});
</script>
<a class="waves-effect waves-light btn green" href="{% url "menu_upload" %}"><i class="material-icons left">add</i>
Neuen Speiseplan hochladen
</a>
<a class="waves-effect waves-light btn orange" href="{% url "menu_show_current" %}"><i class="material-icons left">picture_as_pdf</i>
Aktuellen Speiseplan anzeigen
</a>
<h5>Übersicht der hochgeladenen Speisepläne</h5>
<ul class="collection">
{% for menu in menus %}
<li class="collection-item ">
<span class="title">{{ menu }}</span>
<p>
<a class="btn-flat waves-effect waves-green" href="/media/{{ menu.pdf }}" target="_blank">
<i class="material-icons left">picture_as_pdf</i> Anzeigen
</a>
<a class="btn-flat delete-menu waves-effect waves-red" href="{% url "menu_delete" menu.id %}">
<i class="material-icons left">delete</i> Löschen
</a>
</p>
</li>
{% endfor %}
</ul>
<script type="text/javascript">
$(".delete-menu").click(function (e) {
if (!confirm("Wirklich löschen?")) {
e.preventDefault();
}
})
</script>
</main>
{% include 'partials/footer.html' %}
{% include 'partials/header.html' %}
{% load msg_box %}
<main>
<h5>Speiseplan hochladen</h5>
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{% msg_box form.non_field_errors "error" "error" %}
<div class="row">
<div class="input-field col s5">
{% msg_box form.calendar_week.errors "error" "error" %}
<small>Kalenderwoche</small>
{{ form.calendar_week }}
</div>
<div class="col s2 center-align">
<small>&nbsp;</small>
<h4>/</h4>
</div>
<div class="input-field col s5">
{% msg_box form.year.errors "error" "error" %}
<small>Jahr</small>
{{ form.year }}
</div>
</div>
<div class="file-field input-field">
{% msg_box form.pdf.errors "error" "error" %}
<div class="btn">
<span><i class="material-icons center">cloud_upload</i></span>
<input type="file" name="{{ form.pdf.html_name }}">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
</div>
<button class="waves-effect waves-light btn green" type="submit">
<i class="material-icons left">cloud_upload</i>
Speiseplan hochladen und veröffentlichen
</button>
</form>
<p>
<a href="{% url 'menu_index' %}" class="waves-effect waves-teal btn-flat">Zurück zur Übersicht</a>
</p>
</main>
{% include 'partials/footer.html' %}
......@@ -13,7 +13,7 @@ from .forms import MenuUploadForm
@login_required
@permission_required("menu.add_menu")
@permission_required("mensa.add_menu")
def upload(request):
if request.method == 'POST':
form = MenuUploadForm(request.POST, request.FILES)
......@@ -23,13 +23,13 @@ def upload(request):
return redirect('menu_index_msg', msg="success")
else:
form = MenuUploadForm()
return render(request, 'menu/upload.html', {
return render(request, 'mensa/upload.html', {
'form': form
})
@login_required
@permission_required("menu.add_menu")
@permission_required("mensa.add_menu")
def delete(request, id):
# print(id)
Menu.objects.get(id=id).delete()
......@@ -41,7 +41,7 @@ def delete(request, id):
@permission_required("menu.add_menu")
def index(request, msg=None):
menus = Menu.objects.all().order_by("calendar_week", "year")
return render(request, 'menu/index.html', {"msg": msg, "menus": menus})
return render(request, 'mensa/index.html', {"msg": msg, "menus": menus})
def return_pdf(filename):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment