diff --git a/fiches/static/fiches/css/annuaire.css b/fiches/static/fiches/css/annuaire.css index 4a315ae..c566ccb 100644 --- a/fiches/static/fiches/css/annuaire.css +++ b/fiches/static/fiches/css/annuaire.css @@ -48,7 +48,7 @@ a:focus, float: right; width: 320px; grid-template-columns: auto; - grid-template-rows: auto auto auto auto 120px; + grid-template-rows: auto auto auto auto auto 15px; grid-template-areas: "title" "language" "search" "menu" "account"; } #menu #hamburger { @@ -171,7 +171,7 @@ a:focus, #account-area { grid-area: account; display: block; - padding: 20px; + padding-top: 20px; text-align: center; } #account-area .clipper { @@ -229,7 +229,7 @@ a:focus, .content { max-width: 780px; - width: 50vw; + width: 70vw; margin: 20px; } .content h2 { @@ -365,7 +365,7 @@ a:focus, } #content-edit-profile form { - width: min(400px, 100%); + width: max(600px, 80%); margin: 0 auto; } #content-edit-profile form .form-entry { @@ -471,6 +471,7 @@ a:focus, } #content-edit-profile #free-text-edit-form textarea { width: 100%; + height: 100px; padding: 5px; resize: none; } diff --git a/fiches/static/fiches/css/annuaire.css.map b/fiches/static/fiches/css/annuaire.css.map index cce7171..b89b0de 100644 --- a/fiches/static/fiches/css/annuaire.css.map +++ b/fiches/static/fiches/css/annuaire.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../scss/_fonts.scss","../scss/_links.scss","../scss/_colors.scss","../scss/_header.scss","../scss/_buttons.scss","../scss/_errors.scss","../scss/_content.scss","../scss/_footer.scss","../scss/_common.scss"],"names":[],"mappings":";AASA;AACA;EACI;EACA;EACA;EACA;;AAKJ;AACA;EACI;EACA;EACA;EACA;;AAKJ;AACA;EACI;EACA;EACA;EACA;;AAUJ;AAUA;AACA;EACI;EACA;EACA;EACA;;ACzDJ;EACI;EACA,OCOQ;;;ADJZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGI,OCEc;;;ACJlB;EACI;EACA;EACA;EAEA;EACA;EACA,qBACI;;AAMJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIN;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IN;IACE;;;EAGF;AAAA;IAEE;IACA;IACA;;;EAGF;AAAA;AAAA;AAAA;IAIE;;;EAKE;IACE;;;EAKN;IACE;;;EAIA;IACE;;;EAIJ;AAAA;IAEE;;;EAGF;IACE;IACA;IACA;IACA,qBACE;;EAMF;IACE;;EAGF;AAAA;IAEE;;;EAIJ;IACE;IACA;IACA","file":"annuaire.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../scss/_fonts.scss","../scss/_links.scss","../scss/_colors.scss","../scss/_header.scss","../scss/_buttons.scss","../scss/_errors.scss","../scss/_content.scss","../scss/_footer.scss","../scss/_common.scss"],"names":[],"mappings":";AASA;AACA;EACI;EACA;EACA;EACA;;AAKJ;AACA;EACI;EACA;EACA;EACA;;AAKJ;AACA;EACI;EACA;EACA;EACA;;AAUJ;AAUA;AACA;EACI;EACA;EACA;EACA;;ACzDJ;EACI;EACA,OCOQ;;;ADJZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAGI,OCEc;;;ACJlB;EACI;EACA;EACA;EAEA;EACA;EACA,qBACI;;AAMJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIN;EACI;EAGA;EACA;EACA;EACA;;AAIA;EACI;;;AAIR;EACI;EACA;EACA;EACA,QAhDgB;EAiDhB;EACA;;AAGA;EACI;EACA;EACA;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGJ;EACI,kBDzEI;;;AC6EZ;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;EAEA,OD5Fc;;AC+FlB;EACI,OD7FI;EC8FJ;;AAGJ;AAAA;EAEI;EACA;EACA;EACA,ODzGc;;AC4GlB;EACI;;AAGJ;EACI;;;AAKJ;EAEI;EACA;EACA;EACA;EAEA,OD1HI;EC2HJ;;AAGJ;EAEI,OD/HU;;;ACmIlB;EAEI;EAEA;EACA,ODjIa;ECkIb;;AAEA;EAEI;EACA;EACA;EACA;EAEA,ODnJI;ECoJJ;;AAGJ;EAEI,ODxJU;;;AC4JlB;EACI;EACA;EACA;EACA;;AAIA;EACI,aH7GU;;;AIlElB;AAAA;AAAA;EACI;EACA,kBFUqB;EETrB;EACA;EACA,OFSe;EERf;EACA;EACA;;;AAGJ;AAAA;AAAA;EACI,kBFC2B;;;AGf/B;EACI;EACA;;;AAGJ;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAGJ;EACI;;;ACrBR;EACI,OJqBW;;;AIlBf;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;;AAWJ;EACI;EACA;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAMJ;EACI;;AAGJ;EACI;;AAGJ;EACI;EACA;;AAGJ;EACI;;AAIA;EACI;;;AAYhB;EACI;EACA;EACA;EACA,qBACI;EAGJ;;AAEA;EACI;EACA;EACA;EACA;EACA;;AAGJ;EACI;EACA;EACA;;AAEA;EACI;EACA,OJnGU;EIoGV;EACA;EACA;;AAIR;EACI;EACA;EACA;EACA;;AAGJ;EACI;EAEA;EACA,OJpHS;EIqHT;;AAGJ;EACI;;AAGJ;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA,kBJtHe;EIuHf;;AAEA;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA;;AAEA;EACI;EACA;EACA,OJvJF;EIwJE;EACA;;AAGJ;EACI;EACA;EACA;;AAGJ;EACE;;AASlB;EACI;EACA;;AAEA;EACI;;AAGJ;EACI;EACA;;;AAMR;EACI;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA,kBJpLe;EIqLf;;AAEA;EACI;;AAGJ;EACI;EACA,OJ7MC;EI8MD;EACA;EACA;;AAGJ;EACI;;AAGJ;EAGI;EACA;;AAIR;EACI;EACA;EACA;EACA,qBACI;EAEJ;EACA;EACA;;AAEA;EACI;;AAMJ;EACI;EACA;;AAEJ;EAAqB;;AACrB;EACI;EACA;EACA;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGJ;AAAA;EAEI;;AAGJ;EACI;;AAUA;EAAqB;;AACrB;EAAqB;;AAGrB;AAAA;EAEI;;AAIR;EAEI;;AAIR;EACI;;AAGJ;EACI;;AAIA;EACI;EACA;;AAIR;EACI;EACA;;AAIA;EACI;;AAGJ;EACI;EACA;EACA;;AAMR;EACI;EACA;EACA;EACA;;AAKJ;EACI;EACA;;AAEA;EACI;EACA;EACA;EACA;EACA;EACA;;AAKJ;EACI;;AAGJ;EACI;;AAGJ;EACI;EACA,OJ3WC;EI4WD;;AASJ;EACI;;;AC7XhB;EACI;EACA;EACA,OLGkB;EKFlB;;AAEA;EACI;EACA;;;ACNR;EACI;;;AAMJ;EACI;;;AAGJ;EACI;EACA,qBACI;EAEJ,kBNnBc;EMoBd,ONdQ;EMeR,aR6CY;EQ5CZ;EACA;;;AAGJ;EACI;EACA;EACA,kBN5Be;EM6Bf;EACA;;;AAGJ;EACI;EACA;EACA;EACA;EACA;EACA,kBNxCc;EMyCd;;;AAIJ;EACE;IACE;IACA,qBACI;;;EAIN;IACE;;;EAGF;AAAA;IAEE;IACA;IACA;;;EAGF;AAAA;AAAA;AAAA;IAIE;;;EAKE;IACE;;;EAKN;IACE;;;EAIA;IACE;;;EAIJ;AAAA;IAEE;;;EAGF;IACE;IACA;IACA;IACA,qBACE;;EAMF;IACE;;EAGF;AAAA;IAEE;;;EAIJ;IACE;IACA;IACA","file":"annuaire.css"} \ No newline at end of file diff --git a/fiches/static/fiches/scss/_content.scss b/fiches/static/fiches/scss/_content.scss index 5b17b8a..ba79f44 100644 --- a/fiches/static/fiches/scss/_content.scss +++ b/fiches/static/fiches/scss/_content.scss @@ -8,7 +8,7 @@ .content { max-width: 780px; - width: 50vw; + width: 70vw; margin: 20px; h2 { @@ -195,7 +195,7 @@ #content-edit-profile { form { - width: min(400px, 100%); + width: max(600px, 80%); margin: 0 auto; .form-entry { diff --git a/fiches/static/fiches/scss/_header.scss b/fiches/static/fiches/scss/_header.scss index e00864e..85bd58c 100644 --- a/fiches/static/fiches/scss/_header.scss +++ b/fiches/static/fiches/scss/_header.scss @@ -12,7 +12,7 @@ $account-area-height: 120px; width: 320px; // height: 100%; grid-template-columns: auto; - grid-template-rows: auto auto auto auto $account-area-height; + grid-template-rows: auto auto auto auto auto 15px; grid-template-areas: "title" "language" @@ -169,7 +169,7 @@ $account-area-height: 120px; #account-area { grid-area: account; display: block; - padding: 20px; + padding-top: 20px; text-align: center; @extend %menu-link; diff --git a/fiches/urls.py b/fiches/urls.py index c25c6ea..0f97223 100644 --- a/fiches/urls.py +++ b/fiches/urls.py @@ -1,10 +1,11 @@ from django.urls import path + from . import views urlpatterns = [ path("", views.HomeView.as_view(), name="home"), - path("fiche/edit", views.EditView.as_view(), name="fiche_modif"), - path("fiche/reset", views.ResetView.as_view(), name="fiche_reset"), - path("fiche/", views.FicheView.as_view(), name="fiche"), + path("fiche/_edit", views.EditView.as_view(), name="fiche_modif"), + path("fiche/_reset", views.ResetView.as_view(), name="fiche_reset"), + path("fiche/", views.FicheView.as_view(), name="fiche"), path("birthday", views.BirthdayView.as_view(), name="birthday"), ] diff --git a/fiches/views.py b/fiches/views.py index 6e061a6..eec7407 100644 --- a/fiches/views.py +++ b/fiches/views.py @@ -4,7 +4,6 @@ from django.contrib.auth.decorators import login_required from django.core.mail import send_mail from django.db.models import DateTimeField, Q, Value from django.http import HttpResponseRedirect -from django.shortcuts import get_object_or_404 from django.template.loader import render_to_string from django.urls import reverse, reverse_lazy from django.utils import timezone @@ -29,9 +28,7 @@ from fiches.utils import get_ldap_infos class FicheView(DetailView): model = Profile template_name = "fiches/fiche.html" - - def get_object(self): - return get_object_or_404(Profile, user__username=self.kwargs.get("user")) + slug_field = "user__username" @method_decorator(login_required, name="dispatch") @@ -131,10 +128,21 @@ class HomeView(FormView): form_class = SearchForm def form_valid(self, form): + name = form.cleaned_data["name"] + promotion = form.cleaned_data["year"] + depts = form.cleaned_data["department"] result = Profile.objects.filter( - Q(full_name__icontains=form.cleaned_data["name"]) - | Q(nickname__icontains=form.cleaned_data["name"]) + Q(full_name__icontains=name) + | Q(nickname__icontains=name) + | Q(user__username__icontains=name) ) + + if depts: + result = result.filter(department__in=depts) + + if promotion: + result = result.filter(promotion=promotion) + return self.render_to_response(self.get_context_data(result=result))