From a5651da3e84bb4996260e43dd899356b7a515007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Mogu=C3=A9rou?= Date: Mon, 6 May 2024 19:50:31 +0200 Subject: [PATCH] Add CSS --- colloscope/models.py | 4 +- colloscope/templates/dashboard.html | 61 ++++++++++++++------------- colloscope/templates/marketplace.html | 38 ++++++++++------- colloscope/templatetags/extras.py | 11 +++++ static/main.css | 60 ++++++++++++++++++++++++++ templates/base.html | 1 + 6 files changed, 128 insertions(+), 47 deletions(-) diff --git a/colloscope/models.py b/colloscope/models.py index dfa58b2..d59492e 100644 --- a/colloscope/models.py +++ b/colloscope/models.py @@ -149,7 +149,7 @@ class Term(models.Model): .annotate(swap_plus=Count("swap", filter=Q(swap__enroll=1), distinct=True)) .annotate(swap_minus=Count("swap", filter=Q(swap__enroll=0), distinct=True)) .annotate(volume=F("base_vol") + F("swap_plus") - F("swap_minus")) - .order_by()) + .order_by("date", "slot__time")) def query_colles_of_student(self, student) -> QuerySet: has_student = ((Q(groups__student=student) @@ -224,7 +224,7 @@ class Group(models.Model): return [ (sem, lundi, - colles_flat.filter(date__gte=lundi, date__lt=lundi + timedelta(weeks=1))) + colles_fla.filter(date__gte=lundi, date__lt=lundi + timedelta(weeks=1))) for sem, lundi in semaines ]""" diff --git a/colloscope/templates/dashboard.html b/colloscope/templates/dashboard.html index 8b6c39b..0a0a61b 100644 --- a/colloscope/templates/dashboard.html +++ b/colloscope/templates/dashboard.html @@ -1,5 +1,8 @@ {% extends "base.html" %} +{% load static %} +{% load extras %} + {% block title %}Tableau de bord{% endblock title %} {% block main %} @@ -14,38 +17,38 @@ Bienvenue {{ student }}. Votre lycée est {{ term.cls.school.description }}, et

Mes colles

-

Exporter en .ics (ceci est un permalien public)

+

Exporter en .ics (ceci est un permalien public)

Accéder au marketplace

- {% endblock main %} diff --git a/colloscope/templates/marketplace.html b/colloscope/templates/marketplace.html index e65e8e6..82446f9 100644 --- a/colloscope/templates/marketplace.html +++ b/colloscope/templates/marketplace.html @@ -1,5 +1,8 @@ {% extends "base.html" %} +{% load static %} +{% load extras %} + {% block title %}Marketplace{% endblock title %} {% block main %} @@ -10,25 +13,28 @@ Bienvenue sur le marketplace. {% if colles %} - + {% else %} Aucune colle n'est disponible {% endif %} diff --git a/colloscope/templatetags/extras.py b/colloscope/templatetags/extras.py index 6a32f20..de6ff3e 100644 --- a/colloscope/templatetags/extras.py +++ b/colloscope/templatetags/extras.py @@ -4,14 +4,25 @@ from colloscope.models import * register = template.Library() + @register.filter(name="strftime") def strftime(value, arg): return value.strftime(arg) + @register.filter(name="getitem") def getitem(indexable, i): return indexable[i] + +@register.filter(name="print_manager") +def print_manager(value): + if value.exists(): + return "+".join(str(v) for v in value) + else: + return "∅" + + """ @register.filter(name="exists") def exists(queryset): diff --git a/static/main.css b/static/main.css index dba5bf7..e0a11d4 100644 --- a/static/main.css +++ b/static/main.css @@ -75,3 +75,63 @@ p.programme { footer { text-align: center; } + + +.week { + background-color: dodgerblue; + color: white; + padding: 5px; +} + +.week.empty { + background-color: gray; +} + +.colle-wrapper { + display: grid; + gap: 10px; +} + +@media screen and (min-width: 400px) +{ + .colle-wrapper { + grid-template-columns: repeat(3, minmax(100px, 1fr)); + } +} + +.colle { + border: 1px solid black; + padding: 10px; +} + +.colle span { + text-align: center; +} + +.colle ul { + padding: 0; +} + +.colle li { + list-style-type: none; +} + +.colle form { + display: inline; +} + +.colle button { + padding: 5px; + border: none; + background-color: #c0392b; + color: white; + border-radius: 5px; +} + +.colle button:hover { + background-color: #a93226; +} + +.colle button:active { + background-color: #922b21; +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index cb737e2..7a5df84 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,6 +6,7 @@ {% block title %}{% endblock title %} + {% block head %}{% endblock head %}