Merge remote-tracking branch 'origin/main'
continuous-integration/drone/push Build is passing Details

main
adb-sh 2 years ago
commit c425977ed4

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Delete Comment{% endblock %}
{% block header %}<h1>Delete comment by {{ object.author }}</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,12 +1,18 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Comment{% endblock %}
{% block header %}<h1>Comment by {{ comment.author }}</h1>{% endblock %}
{% block content %} {% block content %}
<div class="detail-container"> <div class="detail-container">
<h1>By {{ comment.author }}</h1>
<h3>Timestamp: {{ comment.timestamp }}</h3>
<h3>Menu: <a href="{% url 'mensaviewer:menu_detail' comment.menu.pk %}">{{ comment.menu.name }}</a></h3> <h3>Menu: <a href="{% url 'mensaviewer:menu_detail' comment.menu.pk %}">{{ comment.menu.name }}</a></h3>
<h3>Text: {{ comment.text }}</h3> <p>Timestamp: {{ comment.timestamp }}</p>
<hr>
<p>Text: </p>
<p>{{ comment.text }}</p>
</div> </div>
{% endblock %} {% endblock %}

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Edit Comment{% endblock %}
{% block header %}<h1>Edit Comment</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,8 +1,11 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %}
<h1>Comments</h1> {% block title %}Comments{% endblock %}
{% block header %}<h1>Comments</h1>{% endblock %}
{% block content %}
<table class="comment-list"> <table class="comment-list">
<tr> <tr>
@ -11,6 +14,7 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Text</th>
<th>Author</th> <th>Author</th>
<th>Timestamp</th> <th>Timestamp</th>
<th>Menu</th> <th>Menu</th>
@ -19,8 +23,9 @@
</tr> </tr>
{% for comment in object_list %} {% for comment in object_list %}
<tr> <tr>
<td><a href="{% url 'mensaviewer:comment_detail' comment.pk %}">{{ comment.text }}</a></td>
<td>{{ comment.author }}</td> <td>{{ comment.author }}</td>
<td>{{ comment.timestamp }}</td> <td class="fit-width">{{ comment.timestamp }}</td>
<td><a href="{% url 'mensaviewer:menu_detail' comment.menu.pk %}">{{ comment.menu }}</a></td> <td><a href="{% url 'mensaviewer:menu_detail' comment.menu.pk %}">{{ comment.menu }}</a></td>
<td class="fit-width"><a href="{% url 'mensaviewer:comment_update' comment.pk %}">Edit</a></td> <td class="fit-width"><a href="{% url 'mensaviewer:comment_update' comment.pk %}">Edit</a></td>
<td class="fit-width"><a href="{% url 'mensaviewer:comment_delete' comment.pk %}">Delete</a></td> <td class="fit-width"><a href="{% url 'mensaviewer:comment_delete' comment.pk %}">Delete</a></td>

@ -16,6 +16,7 @@
</label> </label>
{% endfor %} {% endfor %}
</div> </div>
<hr>
<div class="status-filter"> <div class="status-filter">
{% for status_value in status_values %} {% for status_value in status_values %}
<label> <label>
@ -24,6 +25,7 @@
</label> </label>
{% endfor %} {% endfor %}
</div> </div>
<hr>
<div class="location-filter"> <div class="location-filter">
{% for location in locations %} {% for location in locations %}
<label> <label>
@ -41,15 +43,19 @@
<h2>{{ day }}</h2> <h2>{{ day }}</h2>
{% for menu in menus %} {% for menu in menus %}
<div class="menu {% if menu.mensa_id == 1 %}a-mensa{% elif menu.mensa_id == 6 %}b-mensa{% endif %}"> <div class="menu">
<a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a> <p>{{ menu.art }} - <a href="{% url 'mensaviewer:location_detail' menu.location.pk %}">{{ menu.location.name }}</a></p>
<p>{{ menu.art }}</p> <hr>
<p>{{ menu.price }}</p> <h4><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></h4>
<h5>{{ menu.price }}</h5>
<p>{{ menu.types }}</p> <p>{{ menu.types }}</p>
<p>{{ menu.allergens }}</p> <p>{{ menu.allergens }}</p>
<p>{{ menu.likes }}</p> <hr>
<a href="{% url 'mensaviewer:like' menu.pk %}?next={{ request.path }}">Like</a> <p>Rating: {{ menu.likes }}</p>
<a href="{% url 'mensaviewer:dislike' menu.pk %}?next={{ request.path }}">Dislike</a> <p>
<a href="{% url 'mensaviewer:like' menu.pk %}?next={{ request.path }}">Like</a> |
<a href="{% url 'mensaviewer:dislike' menu.pk %}?next={{ request.path }}">Dislike</a>
</p>
</div> </div>
{% endfor %} {% endfor %}

@ -16,6 +16,7 @@
</label> </label>
{% endfor %} {% endfor %}
</div> </div>
<hr>
<div class="status-filter"> <div class="status-filter">
{% for status_value in status_values %} {% for status_value in status_values %}
<label> <label>
@ -34,15 +35,18 @@
{% for menu in menus %} {% for menu in menus %}
<div class="menu {% if menu.location.mensa_id == '1' %}a-mensa{% elif menu.location.mensa_id == '6' %}b-mensa{% endif %}"> <div class="menu {% if menu.location.mensa_id == '1' %}a-mensa{% elif menu.location.mensa_id == '6' %}b-mensa{% endif %}">
<p>{{ menu.art }} - {{ menu.location.name }}</p> <p>{{ menu.art }} - <a href="{% url 'mensaviewer:location_detail' menu.location.pk %}">{{ menu.location.name }}</a></p>
<hr> <hr>
<h4><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></h4> <h4><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></h4>
<p>{{ menu.price }}</p> <h5>{{ menu.price }}</h5>
<p>{{ menu.types }}</p> <p>{{ menu.types }}</p>
<p>{{ menu.allergens }}</p> <p>{{ menu.allergens }}</p>
<a href="{% url 'mensaviewer:like' menu.pk %}?next={{ request.path }}">Like</a> <hr>
<span>{{ menu.likes }}</span> <p>Rating: {{ menu.likes }}</p>
<a href="{% url 'mensaviewer:dislike' menu.pk %}?next={{ request.path }}">Dislike</a> <p>
<a href="{% url 'mensaviewer:like' menu.pk %}?next={{ request.path }}">Like</a> |
<a href="{% url 'mensaviewer:dislike' menu.pk %}?next={{ request.path }}">Dislike</a>
</p>
</div> </div>
{% endfor %} {% endfor %}

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Delete Location{% endblock %}
{% block header %}<h1>Delete location {{ object.name }}</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,28 +1,64 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}{{ location.city }} |{{ location.name }}{% endblock %}
{% block header %}<h1>{{ location.city }} |{{ location.name }}</h1>{% endblock %}
{% block content %} {% block content %}
<div class="detail-container"> <div class="detail-container">
<h1>{{ location.name }}</h1> <p>
<h3>City: {{ location.city }}</h3> <a class="btn" href="{% url 'mensaviewer:news_add' location.pk %}">Add News</a>
<h3>ID: {{ location.mensa_id }}</h3> <a class="btn" href="{% url 'mensaviewer:menu_add' location.pk %}">Add Menu</a>
<a href="{% url 'mensaviewer:news_add' location.pk %}">Add News</a> <a class="btn" href="{% url 'mensaviewer:location_update' location.pk %}">Edit</a>
<a href="{% url 'mensaviewer:menu_add' location.pk %}">Add Menu</a> <a class="btn" href="{% url 'mensaviewer:location_delete' location.pk %}">Delete</a>
</p>
<div class="related-items"> <div class="related-items">
<h2>News</h2> <h2>News</h2>
{% for news_article in location.news_articles %}
<div class="news-article"> <table class="news-list">
<h3><a href="{% url 'mensaviewer:news_detail' news_article.pk %}">{{ news_article.title }}</a></h3> <tr>
</div> <th>Title</th>
{% endfor %} <th>Author</th>
<th>Timestamp</th>
<th>Menu</th>
<th></th>
<th></th>
</tr>
{% for newsarticle in location.news_articles %}
<tr>
<td><a href="{% url 'mensaviewer:news_detail' newsarticle.pk %}">{{ newsarticle.title }}</a></td>
<td>{{ newsarticle.author }}</td>
<td>{{ newsarticle.timestamp }}</td>
<td><a href="{% url 'mensaviewer:location_detail' newsarticle.location.pk %}">{{ newsarticle.location.city }} - {{ newsarticle.location.name }}</a></td>
<td class="fit-width"><a href="{% url 'mensaviewer:news_update' newsarticle.pk %}">Edit</a></td>
<td class="fit-width"><a href="{% url 'mensaviewer:news_delete' newsarticle.pk %}">Delete</a></td>
</tr>
{% endfor %}
</table>
</div> </div>
<div class="related-items"> <div class="related-items">
<h2>Menus</h2> <h2>Menus</h2>
{% for menu in location.menus %}
<div class="menu"> <table class="menu-list">
<h3><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></h3> <tr>
</div> <th>Name</th>
{% endfor %} <th>Location</th>
<th>Day</th>
<th>Edit</th>
<th>Delete</th>
</tr>
{% for menu in location.menus %}
<tr>
<td><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></td>
<td><a href="{% url 'mensaviewer:location_detail' menu.location.pk %}">{{ menu.location.name }}</a></td>
<td>{{ menu.day }}</td>
<td class="fit-width"><a href="{% url 'mensaviewer:menu_update' menu.pk %}">Edit</a></td>
<td class="fit-width"><a href="{% url 'mensaviewer:menu_delete' menu.pk %}">Delete</a></td>
</tr>
{% endfor %}
</table>
</div> </div>
</div> </div>

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Edit Location{% endblock %}
{% block header %}<h1>Edit location {{ object.name }}</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,8 +1,11 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %}
<h1>Locations</h1> {% block title %}Locations{% endblock %}
{% block header %}<h1>Locations</h1>{% endblock %}
{% block content %}
<table class="location-list"> <table class="location-list">
<tr> <tr>

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Delete Menu{% endblock %}
{% block header %}<h1>Delete menu {{ object.name }}</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,27 +1,68 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}{{ menu.name }}{% endblock %}
{% block header %}<h1>{{ menu.name }}</h1>{% endblock %}
{% block content %} {% block content %}
<div class="detail-container"> <div class="detail-container">
<h1>{{ menu.name }}</h1> <p>
<p>Art: {{ menu.art }}</p> <a class="btn" href="{% url 'mensaviewer:like' menu.id %}?next={{ request.path }}">Like</a>
<p>Price for Students: {{ menu.get_price.Student }}</p> <a class="btn" href="{% url 'mensaviewer:dislike' menu.id %}?next={{ request.path }}">Dislike</a>
<p>Price for Employees: {{ menu.get_price.Employee }}</p> <a class="btn" href="{% url 'mensaviewer:comment_add' menu.id %}">Comment</a>
<p>Price for Guests: {{ menu.get_price.Guest }}</p> </p>
<p>Allergens: {{ menu.get_allergens }}</p> <h3>Prices</h3>
<p>Types: {{ menu.get_types }}</p> <table>
<p>Rating: {{ menu.likes }}</p> <tr>
<p>Location and Date: {{ menu.location.city }} {{ menu.location.name }} | {{ menu.day }}</p> <th>Students</th>
<a href="{% url 'mensaviewer:like' menu.id %}?next={{ request.path }}">Like</a> <th>Employees</th>
<a href="{% url 'mensaviewer:dislike' menu.id %}?next={{ request.path }}">Dislike</a> <th>Guests</th>
<a href="{% url 'mensaviewer:comment_add' menu.id %}">Comment</a> </tr>
<tr>
<td>{{ menu.get_price.Student }}</td>
<td>{{ menu.get_price.Employee }}</td>
<td>{{ menu.get_price.Guest }}</td>
</tr>
</table>
<h4>Art</h4>
<p>{{ menu.art }}</p>
<hr>
<h4>Allergens</h4>
<p>{{ menu.get_allergens }}</p>
<hr>
<h4>Types</h4>
<p>{{ menu.get_types }}</p>
<hr>
<h4>Rating</h4>
<p>{{ menu.likes }}</p>
<hr>
<h4>Location and Date</h4>
<p><a href="{% url 'mensaviewer:location_detail' menu.location.pk %}">{{ menu.location.city }} {{ menu.location.name }}</a> | {{ menu.day }}</p>
<hr>
<div class="related-items"> <div class="related-items">
{% for comment in menu.comments %} <h3>Comments</h3>
<div class="comment"> <table class="comment-list">
<h3>{{ comment.author }}</h3> <tr>
<p>{{ comment.text }}</p> <th>Text</th>
</div> <th>Author</th>
{% endfor %} <th>Timestamp</th>
<th>Menu</th>
<th></th>
<th></th>
</tr>
{% for comment in menu.comments %}
<tr>
<td><a href="{% url 'mensaviewer:comment_detail' comment.pk %}">{{ comment.text }}</a></td>
<td>{{ comment.author }}</td>
<td class="fit-width">{{ comment.timestamp }}</td>
<td><a href="{% url 'mensaviewer:menu_detail' comment.menu.pk %}">{{ comment.menu }}</a></td>
<td class="fit-width"><a href="{% url 'mensaviewer:comment_update' comment.pk %}">Edit</a></td>
<td class="fit-width"><a href="{% url 'mensaviewer:comment_delete' comment.pk %}">Delete</a></td>
</tr>
{% endfor %}
</table>
</div> </div>
</div> </div>

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Edit Menu{% endblock %}
{% block header %}<h1>Edit Menu {{ object.name }}</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,8 +1,11 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %}
<h1>Menus</h1> {% block title %}Menus{% endblock %}
{% block header %}<h1>Menus</h1>{% endblock %}
{% block content %}
<table class="menu-list"> <table class="menu-list">
<tr> <tr>

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Delete News{% endblock %}
{% block header %}<h1>Delete news article {{ object.title }}</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,12 +1,23 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}{{ newsarticle.title }}{% endblock %}
{% block header %}<h1>{{ newsarticle.title }}</h1>{% endblock %}
{% block content %} {% block content %}
<div class="detail-container"> <div class="detail-container">
<h1>By {{ newsarticle.author }}</h1> <h1>Written by {{ newsarticle.author }}</h1>
<h3>Timestamp: {{ newsarticle.timestamp }}</h3> <hr>
<h3>Location: <a href="{% url 'mensaviewer:location_detail' newsarticle.location.pk %}">{{ newsarticle.location.name }}</a></h3> <h4>Timestamp</h4>
<h3>Text: {{ newsarticle.text }}</h3> <p>{{ newsarticle.timestamp }}</p>
<hr>
<h4>Location</h4>
<p><a href="{% url 'mensaviewer:location_detail' newsarticle.location.pk %}">{{ newsarticle.location.name }}</a></p>
<hr>
<h4>Text</h4>
<p>{{ newsarticle.text }}</p>
</div> </div>
{% endblock %} {% endblock %}

@ -1,5 +1,10 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Edit News Article{% endblock %}
{% block header %}<h1>Edit news article {{ object.title }}</h1>{% endblock %}
{% block content %} {% block content %}
<form class="model-form" method="post"> <form class="model-form" method="post">

@ -1,8 +1,11 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %}
<h1>News Articles</h1> {% block title %}News Articles{% endblock %}
{% block header %}<h1>News Articles</h1>{% endblock %}
{% block content %}
<table class="news-list"> <table class="news-list">
<tr> <tr>

@ -16,13 +16,15 @@ def flensburg(request):
checked_types = request.GET.getlist('type') checked_types = request.GET.getlist('type')
status = request.GET.get('status') status = request.GET.get('status')
selected_locations = Location.objects.filter(mensa_id__in=[1, 6]) selected_locations = Location.objects.filter(mensa_id__in=[7, 14])
if not selected_locations.exists():
Location(city="Flensburg", name="Hauptmensa", mensa_id=7).save()
Location(city="Flensburg", name="B-Mensa", mensa_id=14).save()
context = { context = {
'types': [(TYPES[type], type) for type in TYPES], 'types': [(TYPES[type], type) for type in TYPES],
'checked_types': checked_types, 'checked_types': checked_types,
'status_values': STATUS_VALUES, 'status_values': STATUS_VALUES,
'status': status, 'status': status,
'locations': Location.objects.all(),
'menu_data': load_data(selected_locations, checked_types, status), 'menu_data': load_data(selected_locations, checked_types, status),
} }
response = render(request, "flensburg.html", context) response = render(request, "flensburg.html", context)

@ -9,6 +9,10 @@ body {
color: #EEEDFF; color: #EEEDFF;
} }
hr {
opacity: 0.2;
}
h1, h2, h3 { h1, h2, h3 {
margin: 0; margin: 0;
padding: 1em; padding: 1em;
@ -46,7 +50,6 @@ nav a:hover {
nav hr { nav hr {
width: 16em; width: 16em;
opacity: 0.1;
} }
a { a {
@ -149,6 +152,10 @@ td {
text-align: right; text-align: right;
} }
.filter-form hr {
width: 100%;
}
input[type="submit"], button { input[type="submit"], button {
cursor: pointer; cursor: pointer;
} }
@ -174,36 +181,46 @@ input[type="submit"]:active, button:active {
flex-flow: column; flex-flow: column;
} }
.menu { .related-items {
margin: 2em;
}
.comment {
border-radius: 0.2em;
border: 1px solid rgba(0, 0, 0, 0.3);
margin: 0.5em;
padding: 1em;
}
.menu, .news-article {
padding: 1em; padding: 1em;
margin: 0.2em; margin: 0.2em;
border-radius: 0.5em; margin-bottom: 0.8em;
border-radius: 0.2em;
border: 1px solid rgba(0, 0, 0, 0.3);
box-shadow: inset 0px 0px 1em rgba(0, 0, 0, 0.2); box-shadow: inset 0px 0px 1em rgba(0, 0, 0, 0.2);
background-color: rgba(0, 0, 0, 0.2); background-color: rgba(0, 0, 0, 0.2);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.menu * {
margin: 0;
}
.menu hr { .menu hr {
opacity: 0.2; width: 100%;
} }
.menu p { .menu p {
font-size: 12px; font-size: 12px;
margin: 0;
} }
.menu a { .menu a {
display: inline-block; display: inline;
} }
.a-mensa { .a-mensa {
background-color: rgba(16, 64, 16, 0.2); background-color: rgba(40, 29, 40, 0.7);
} }
.b-mensa { .b-mensa {
background-color: rgba(16, 16, 64, 0.2); background-color: rgba(29, 40, 40, 0.7);
} }

Loading…
Cancel
Save