From 4b07f346a01f6ef661f19c8e03f7042651bdcf44 Mon Sep 17 00:00:00 2001 From: Jannes Hikmat Date: Sun, 8 Jan 2023 21:16:45 +0100 Subject: [PATCH] =?UTF-8?q?templates,=20css=20&=20views=20nochmal=20=C3=BC?= =?UTF-8?q?berarbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mensaviewer/templates/comment/delete.html | 5 ++ mensaviewer/templates/comment/detail.html | 12 +++- mensaviewer/templates/comment/edit.html | 5 ++ mensaviewer/templates/comment/list.html | 11 +++- mensaviewer/templates/custom.html | 20 ++++-- mensaviewer/templates/flensburg.html | 14 ++-- mensaviewer/templates/location/delete.html | 5 ++ mensaviewer/templates/location/detail.html | 66 ++++++++++++++----- mensaviewer/templates/location/edit.html | 5 ++ mensaviewer/templates/location/list.html | 7 +- mensaviewer/templates/menu/delete.html | 5 ++ mensaviewer/templates/menu/detail.html | 77 +++++++++++++++++----- mensaviewer/templates/menu/edit.html | 5 ++ mensaviewer/templates/menu/list.html | 7 +- mensaviewer/templates/news/delete.html | 5 ++ mensaviewer/templates/news/detail.html | 19 ++++-- mensaviewer/templates/news/edit.html | 5 ++ mensaviewer/templates/news/list.html | 7 +- mensaviewer/views.py | 6 +- static/base.css | 39 +++++++---- 20 files changed, 251 insertions(+), 74 deletions(-) diff --git a/mensaviewer/templates/comment/delete.html b/mensaviewer/templates/comment/delete.html index ac3307c..d259171 100644 --- a/mensaviewer/templates/comment/delete.html +++ b/mensaviewer/templates/comment/delete.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} + +{% block title %}Delete Comment{% endblock %} + +{% block header %}

Delete comment by {{ object.author }}

{% endblock %} + {% block content %}
diff --git a/mensaviewer/templates/comment/detail.html b/mensaviewer/templates/comment/detail.html index 103231e..7928c0b 100644 --- a/mensaviewer/templates/comment/detail.html +++ b/mensaviewer/templates/comment/detail.html @@ -1,12 +1,18 @@ {% extends 'base.html' %} + +{% block title %}Comment{% endblock %} + +{% block header %}

Comment by {{ comment.author }}

{% endblock %} + {% block content %}
-

By {{ comment.author }}

-

Timestamp: {{ comment.timestamp }}

Menu: {{ comment.menu.name }}

-

Text: {{ comment.text }}

+

Timestamp: {{ comment.timestamp }}

+
+

Text:

+

{{ comment.text }}

{% endblock %} diff --git a/mensaviewer/templates/comment/edit.html b/mensaviewer/templates/comment/edit.html index f56eaaf..52d062c 100644 --- a/mensaviewer/templates/comment/edit.html +++ b/mensaviewer/templates/comment/edit.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} + +{% block title %}Edit Comment{% endblock %} + +{% block header %}

Edit Comment

{% endblock %} + {% block content %} diff --git a/mensaviewer/templates/comment/list.html b/mensaviewer/templates/comment/list.html index d1857bd..5b6a516 100644 --- a/mensaviewer/templates/comment/list.html +++ b/mensaviewer/templates/comment/list.html @@ -1,8 +1,11 @@ {% extends 'base.html' %} -{% block content %} -

Comments

+{% block title %}Comments{% endblock %} + +{% block header %}

Comments

{% endblock %} + +{% block content %} @@ -11,6 +14,7 @@ + @@ -19,8 +23,9 @@ {% for comment in object_list %} + - + diff --git a/mensaviewer/templates/custom.html b/mensaviewer/templates/custom.html index ce1808e..d187c56 100644 --- a/mensaviewer/templates/custom.html +++ b/mensaviewer/templates/custom.html @@ -16,6 +16,7 @@ {% endfor %} +
{% for status_value in status_values %} {% endfor %}
+
{% for location in locations %}
Text Author Timestamp Menu
{{ comment.text }} {{ comment.author }}{{ comment.timestamp }}{{ comment.timestamp }} {{ comment.menu }} Edit Delete
+ + + + + + + + + {% for newsarticle in location.news_articles %} + + + + + + + + + {% endfor %} +
TitleAuthorTimestampMenu
{{ newsarticle.title }}{{ newsarticle.author }}{{ newsarticle.timestamp }}{{ newsarticle.location.city }} - {{ newsarticle.location.name }}EditDelete
diff --git a/mensaviewer/templates/location/edit.html b/mensaviewer/templates/location/edit.html index f56eaaf..0f9517c 100644 --- a/mensaviewer/templates/location/edit.html +++ b/mensaviewer/templates/location/edit.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} + +{% block title %}Edit Location{% endblock %} + +{% block header %}

Edit location {{ object.name }}

{% endblock %} + {% block content %} diff --git a/mensaviewer/templates/location/list.html b/mensaviewer/templates/location/list.html index f074165..2527cd0 100644 --- a/mensaviewer/templates/location/list.html +++ b/mensaviewer/templates/location/list.html @@ -1,8 +1,11 @@ {% extends 'base.html' %} -{% block content %} -

Locations

+{% block title %}Locations{% endblock %} + +{% block header %}

Locations

{% endblock %} + +{% block content %} diff --git a/mensaviewer/templates/menu/delete.html b/mensaviewer/templates/menu/delete.html index ac3307c..6436971 100644 --- a/mensaviewer/templates/menu/delete.html +++ b/mensaviewer/templates/menu/delete.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} + +{% block title %}Delete Menu{% endblock %} + +{% block header %}

Delete menu {{ object.name }}

{% endblock %} + {% block content %} diff --git a/mensaviewer/templates/menu/detail.html b/mensaviewer/templates/menu/detail.html index 729c4f5..3c6e5f9 100644 --- a/mensaviewer/templates/menu/detail.html +++ b/mensaviewer/templates/menu/detail.html @@ -1,27 +1,68 @@ {% extends 'base.html' %} + +{% block title %}{{ menu.name }}{% endblock %} + +{% block header %}

{{ menu.name }}

{% endblock %} + {% block content %}
-

{{ menu.name }}

-

Art: {{ menu.art }}

-

Price for Students: {{ menu.get_price.Student }}

-

Price for Employees: {{ menu.get_price.Employee }}

-

Price for Guests: {{ menu.get_price.Guest }}

-

Allergens: {{ menu.get_allergens }}

-

Types: {{ menu.get_types }}

-

Rating: {{ menu.likes }}

-

Location and Date: {{ menu.location.city }} {{ menu.location.name }} | {{ menu.day }}

- Like - Dislike - Comment +

+ Like + Dislike + Comment +

+

Prices

+
+ + + + + + + + + + +
StudentsEmployeesGuests
{{ menu.get_price.Student }}{{ menu.get_price.Employee }}{{ menu.get_price.Guest }}
+

Art

+

{{ menu.art }}

+
+

Allergens

+

{{ menu.get_allergens }}

+
+

Types

+

{{ menu.get_types }}

+
+

Rating

+

{{ menu.likes }}

+
+

Location and Date

+

{{ menu.location.city }} {{ menu.location.name }} | {{ menu.day }}

+
diff --git a/mensaviewer/templates/menu/edit.html b/mensaviewer/templates/menu/edit.html index f56eaaf..a396609 100644 --- a/mensaviewer/templates/menu/edit.html +++ b/mensaviewer/templates/menu/edit.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} + +{% block title %}Edit Menu{% endblock %} + +{% block header %}

Edit Menu {{ object.name }}

{% endblock %} + {% block content %} diff --git a/mensaviewer/templates/menu/list.html b/mensaviewer/templates/menu/list.html index aeb8579..86a3441 100644 --- a/mensaviewer/templates/menu/list.html +++ b/mensaviewer/templates/menu/list.html @@ -1,8 +1,11 @@ {% extends 'base.html' %} -{% block content %} -

Menus

+{% block title %}Menus{% endblock %} + +{% block header %}

Menus

{% endblock %} + +{% block content %} diff --git a/mensaviewer/templates/news/delete.html b/mensaviewer/templates/news/delete.html index ac3307c..54f4d5e 100644 --- a/mensaviewer/templates/news/delete.html +++ b/mensaviewer/templates/news/delete.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} + +{% block title %}Delete News{% endblock %} + +{% block header %}

Delete news article {{ object.title }}

{% endblock %} + {% block content %} diff --git a/mensaviewer/templates/news/detail.html b/mensaviewer/templates/news/detail.html index 73b2198..fab0bb5 100644 --- a/mensaviewer/templates/news/detail.html +++ b/mensaviewer/templates/news/detail.html @@ -1,12 +1,23 @@ {% extends 'base.html' %} + +{% block title %}{{ newsarticle.title }}{% endblock %} + +{% block header %}

{{ newsarticle.title }}

{% endblock %} + {% block content %}
-

By {{ newsarticle.author }}

-

Timestamp: {{ newsarticle.timestamp }}

-

Location: {{ newsarticle.location.name }}

-

Text: {{ newsarticle.text }}

+

Written by {{ newsarticle.author }}

+
+

Timestamp

+

{{ newsarticle.timestamp }}

+
+

Location

+

{{ newsarticle.location.name }}

+
+

Text

+

{{ newsarticle.text }}

{% endblock %} diff --git a/mensaviewer/templates/news/edit.html b/mensaviewer/templates/news/edit.html index f56eaaf..e91b47d 100644 --- a/mensaviewer/templates/news/edit.html +++ b/mensaviewer/templates/news/edit.html @@ -1,5 +1,10 @@ {% extends 'base.html' %} + +{% block title %}Edit News Article{% endblock %} + +{% block header %}

Edit news article {{ object.title }}

{% endblock %} + {% block content %} diff --git a/mensaviewer/templates/news/list.html b/mensaviewer/templates/news/list.html index 725ffdb..90fbd2d 100644 --- a/mensaviewer/templates/news/list.html +++ b/mensaviewer/templates/news/list.html @@ -1,8 +1,11 @@ {% extends 'base.html' %} -{% block content %} -

News Articles

+{% block title %}News Articles{% endblock %} + +{% block header %}

News Articles

{% endblock %} + +{% block content %} diff --git a/mensaviewer/views.py b/mensaviewer/views.py index 683ef11..e4a1ec5 100644 --- a/mensaviewer/views.py +++ b/mensaviewer/views.py @@ -16,13 +16,15 @@ def flensburg(request): checked_types = request.GET.getlist('type') 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 = { 'types': [(TYPES[type], type) for type in TYPES], 'checked_types': checked_types, 'status_values': STATUS_VALUES, 'status': status, - 'locations': Location.objects.all(), 'menu_data': load_data(selected_locations, checked_types, status), } response = render(request, "flensburg.html", context) diff --git a/static/base.css b/static/base.css index baa8f88..a153387 100644 --- a/static/base.css +++ b/static/base.css @@ -9,6 +9,10 @@ body { color: #EEEDFF; } +hr { + opacity: 0.2; +} + h1, h2, h3 { margin: 0; padding: 1em; @@ -46,7 +50,6 @@ nav a:hover { nav hr { width: 16em; - opacity: 0.1; } a { @@ -149,6 +152,10 @@ td { text-align: right; } +.filter-form hr { + width: 100%; +} + input[type="submit"], button { cursor: pointer; } @@ -174,36 +181,46 @@ input[type="submit"]:active, button:active { 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; 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); background-color: rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; } -.menu * { - margin: 0; -} - .menu hr { - opacity: 0.2; + width: 100%; } .menu p { font-size: 12px; + margin: 0; } .menu a { - display: inline-block; + display: inline; } .a-mensa { - background-color: rgba(16, 64, 16, 0.2); + background-color: rgba(40, 29, 40, 0.7); } .b-mensa { - background-color: rgba(16, 16, 64, 0.2); + background-color: rgba(29, 40, 40, 0.7); }