diff --git a/avisstage/allauth_adapter.py b/avisstage/allauth_adapter.py new file mode 100644 index 0000000..130b71d --- /dev/null +++ b/avisstage/allauth_adapter.py @@ -0,0 +1,20 @@ +from allauth.account.adapter import DefaultAccountAdapter +from allauth_ens.adapter import LongTermClipperAccountAdapter + +class AccountAdapter(DefaultAccountAdapter): + def is_open_for_signup(self, request): + return False + + +class SocialAccountAdapter(LongTermClipperAccountAdapter): + def is_open_for_signup(self, request, sociallogin): + # sociallogin.account is a SocialAccount instance. + # See https://github.com/pennersr/django-allauth/blob/master/allauth/socialaccount/models.py + + if sociallogin.account.provider == 'clipper': + return True + + # It returns AccountAdapter.is_open_for_signup(). + # See https://github.com/pennersr/django-allauth/blob/master/allauth/socialaccount/adapter.py + return super().is_open_for_signup(request, sociallogin) + diff --git a/avisstage/api.py b/avisstage/api.py index c3e4020..9738ce2 100644 --- a/avisstage/api.py +++ b/avisstage/api.py @@ -9,10 +9,16 @@ from django.urls import reverse from .models import Lieu, Stage, Normalien, StageMatiere +class EnScolariteAuthentication(SessionAuthentication): + def is_authenticated(self, request, **kwargs): + if super().is_authenticated(request, **kwargs): + return request.user.profil.en_scolarite + return False + # API principale pour les lieux class LieuResource(ModelResource): - stages = fields.ToManyField("avisstage.api.StageResource", - "stages", use_in="detail", full=True) + #stages = fields.ToManyField("avisstage.api.StageResource", + # "stages", use_in="detail", full=True) class Meta: queryset = Lieu.objects.all() @@ -74,7 +80,7 @@ class StageResource(ModelResource): fields = ["sujet", "date_debut", "date_fin", "matieres", "id"] #login_required - authentication = SessionAuthentication() + authentication = EnScolariteAuthentication() # Filtres personnalisés def build_filters(self, filters=None, **kwargs): @@ -114,4 +120,4 @@ class AuteurResource(ModelResource): fields = ["id", "nom", "stages"] #login_required - authentication = SessionAuthentication() + authentication = EnScolariteAuthentication() diff --git a/avisstage/decorators.py b/avisstage/decorators.py new file mode 100644 index 0000000..d5f7dd6 --- /dev/null +++ b/avisstage/decorators.py @@ -0,0 +1,12 @@ +from functools import wraps + +from django.urls import reverse +from django.shortcuts import redirect + +def en_scolarite_required(view_func): + @wraps(view_func) + def _wrapped_view(request, *args, **kwargs): + if request.user.profil.en_scolarite: + return view_func(request, *args, **kwargs) + return redirect(reverse("avisstage:403-archicubes")) + return _wrapped_view diff --git a/avisstage/models.py b/avisstage/models.py index e15ddba..dfc06f1 100644 --- a/avisstage/models.py +++ b/avisstage/models.py @@ -2,6 +2,9 @@ from __future__ import unicode_literals +from allauth.account.models import EmailAddress +from allauth.socialaccount.models import SocialAccount + from django.db import models from django.db.models.signals import post_save from django.contrib.auth.models import User @@ -9,7 +12,9 @@ from django.contrib.gis.db import models as geomodels from django.template.defaultfilters import slugify from django.forms.widgets import DateInput from django.urls import reverse + from django.utils import timezone +from django.utils.functional import cached_property from django.utils.html import strip_tags from taggit_autosuggest.managers import TaggableManager @@ -47,54 +52,52 @@ class Normalien(models.Model): def stages_publics(self): return self.stages.filter(public=True).order_by('-date_debut') + @cached_property + def en_scolarite(self): + return SocialAccount.objects.filter(user_id=self.user_id, + provider="clipper").exists() + + def has_nonENS_email(self): + a = EmailAddress.objects.filter(user_id=self.user_id, + verified=True) \ + .exclude(email__endswith="ens.fr") + return a.exists() + + @property + def preferred_email(self): + a = EmailAddress.objects.filter(user_id=self.user_id, + verified=True) \ + .exclude(email__endswith="ens.fr")\ + .order_by('-primary') + if len(a) == 0: + a = EmailAddress.objects.filter(user_id=self.user_id, + verified=True) \ + .order_by('-primary') + if len(a) == 0: + return "" + else: + return a[0].email + # Hook à la création d'un nouvel utilisateur : récupération de ses infos par LDAP def create_user_profile(sender, instance, created, **kwargs): if created: profil, created = Normalien.objects.get_or_create(user=instance) try: - ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) - l = ldap.initialize("ldaps://ldap.spi.ens.fr:636") - l.set_option(ldap.OPT_REFERRALS, 0) - l.set_option(ldap.OPT_PROTOCOL_VERSION, 3) - l.set_option(ldap.OPT_X_TLS,ldap.OPT_X_TLS_DEMAND) - l.set_option(ldap.OPT_X_TLS_DEMAND, True) - l.set_option(ldap.OPT_DEBUG_LEVEL, 255) - l.set_option(ldap.OPT_NETWORK_TIMEOUT, 10) - l.set_option(ldap.OPT_TIMEOUT, 10) - - info = l.search_s('dc=spi,dc=ens,dc=fr', - ldap.SCOPE_SUBTREE, - ('(uid=%s)' % (instance.username,)), - [str("cn"), - str("mailRoutingAddress"), - str("homeDirectory")]) - - # Si des informations sont disponibles - if len(info) > 0: - infos = info[0][1] - - # Nom - profil.nom = infos.get('cn', [''])[0] - - # Parsing du homeDirectory pour la promotion - if 'homeDirectory' in infos: - dirs = infos['homeDirectory'][0].split('/') - if dirs[1] == 'users': - annee = dirs[2] - dep = dirs[3] - dep = dict(DEPARTEMENTS_DEFAUT).get(dep.lower(), '') - profil.promotion = u'%s %s' % (dep, annee) - - # Mail - pmail = infos.get('mailRoutingAddress', - ['%s@clipper.ens.fr'%instance.username]) - if len(pmail) > 0: - profil.mail = pmail[0] - - profil.save() - except ldap.LDAPError: - pass -#post_save.connect(create_user_profile, sender=User) + saccount = SocialAccount.objects.get(user=instance, + provider="clipper") + except SocialAccount.DoesNotExist: + return + edata = saccount.extra_data.get("ldap", {}) + dep = "" + if "department_code" in edata: + dep = dict(DEPARTEMENTS_DEFAUT).get( + edata["department_code"].lower(), '') + + profil.promotion = "%s %s" % (dep, edata["entrance_year"]) + profil.nom = edata.get("name", "") + profil.save() + +post_save.connect(create_user_profile, sender=User) # # Lieu de stage @@ -216,7 +219,11 @@ class Stage(models.Model): @property def niveau_scol_fancy(self): return NIVEAU_SCOL_DICT.get(self.niveau_scol, "") - + + # Optimisation de requêtes + @cached_property + def all_lieux(self): + return self.lieux.all() def get_absolute_url(self): return reverse('avisstage:stage', self) diff --git a/avisstage/sass/screen.scss b/avisstage/sass/screen.scss index 3a493b3..d5b4f0f 100644 --- a/avisstage/sass/screen.scss +++ b/avisstage/sass/screen.scss @@ -161,6 +161,19 @@ header { } } +p.warning { + background-color: #c20; + font-weight: bold; + color: #fff; + padding: 3px; +} + +.footer { + margin-top: 15px; + font-size: 0.8em; + text-align: right; +} + // Liste des stages condensée sur le profil .condensed-stages { @@ -753,6 +766,13 @@ a.lieu-change { padding: 15px; text-align: center; margin: 15px auto; + + .archicubes { + border-top: 2px solid $vert; + margin-top: 5px; + padding-top: 5px; + font-size: 0.9em; + } } article.promo { diff --git a/avisstage/static/css/screen.css b/avisstage/static/css/screen.css index 152af32..44a26c9 100644 --- a/avisstage/static/css/screen.css +++ b/avisstage/static/css/screen.css @@ -229,29 +229,44 @@ header h1 { color: #fff; } -/* line 167, ../../sass/screen.scss */ +/* line 164, ../../sass/screen.scss */ +p.warning { + background-color: #c20; + font-weight: bold; + color: #fff; + padding: 3px; +} + +/* line 171, ../../sass/screen.scss */ +.footer { + margin-top: 15px; + font-size: 0.8em; + text-align: right; +} + +/* line 180, ../../sass/screen.scss */ .condensed-stages li { display: table; width: 100%; background: #fff; margin: 12px; } -/* line 174, ../../sass/screen.scss */ +/* line 187, ../../sass/screen.scss */ .condensed-stages li > *, .condensed-stages li:before { display: table-cell; vertical-align: middle; padding: 15px; } -/* line 179, ../../sass/screen.scss */ +/* line 192, ../../sass/screen.scss */ .condensed-stages li a { width: auto; } -/* line 181, ../../sass/screen.scss */ +/* line 194, ../../sass/screen.scss */ .condensed-stages li a:hover { background: #e08206; color: #fff; } -/* line 186, ../../sass/screen.scss */ +/* line 199, ../../sass/screen.scss */ .condensed-stages li:before { content: ""; text-align: right; @@ -259,77 +274,77 @@ header h1 { opacity: 0.8; color: #000; } -/* line 193, ../../sass/screen.scss */ +/* line 206, ../../sass/screen.scss */ .condensed-stages li.stage-brouillon:before { content: "Brouillon"; background: #f93a93; } -/* line 197, ../../sass/screen.scss */ +/* line 210, ../../sass/screen.scss */ .condensed-stages li.stage-publie:before { content: "Publié"; background: #419be9; } -/* line 201, ../../sass/screen.scss */ +/* line 214, ../../sass/screen.scss */ .condensed-stages li.stage-ajout:before { content: "+"; color: #000; } -/* line 209, ../../sass/screen.scss */ +/* line 222, ../../sass/screen.scss */ .stage-liste li { display: block; position: relative; } -/* line 213, ../../sass/screen.scss */ +/* line 226, ../../sass/screen.scss */ .stage-liste li.date-maj { font-weight: 300; font-size: 0.9em; padding: 3px 0; font-style: italic; } -/* line 219, ../../sass/screen.scss */ +/* line 232, ../../sass/screen.scss */ .stage-liste li.stage { padding: 10px; background: #fff; margin: 10px; border-left: 5px solid #f99b20; } -/* line 225, ../../sass/screen.scss */ +/* line 238, ../../sass/screen.scss */ .stage-liste li.stage h3 { font-size: 1.4em; padding-left: 5px; } -/* line 229, ../../sass/screen.scss */ +/* line 242, ../../sass/screen.scss */ .stage-liste li.stage h3 > a { color: #0f4c82; } -/* line 233, ../../sass/screen.scss */ +/* line 246, ../../sass/screen.scss */ .stage-liste li.stage h3 .auteur { font-size: 0.8em; } -/* line 236, ../../sass/screen.scss */ +/* line 249, ../../sass/screen.scss */ .stage-liste li.stage h3 .auteur, .stage-liste li.stage h3 .auteur a { font-family: "Dosis", sans-serif; font-weight: normal; } -/* line 243, ../../sass/screen.scss */ +/* line 256, ../../sass/screen.scss */ .stage-liste li .misc-hdr { margin-bottom: 10px; } -/* line 247, ../../sass/screen.scss */ +/* line 260, ../../sass/screen.scss */ .stage-liste li .misc-hdr .dates > span { display: table-cell; vertical-align: middle; } -/* line 251, ../../sass/screen.scss */ +/* line 264, ../../sass/screen.scss */ .stage-liste li .misc-hdr .dates .year { padding-left: 8px; } -/* line 254, ../../sass/screen.scss */ +/* line 267, ../../sass/screen.scss */ .stage-liste li .misc-hdr .dates svg text { font-size: 0.8; } -/* line 260, ../../sass/screen.scss */ +/* line 273, ../../sass/screen.scss */ .stage-liste li a.hoverlink { position: absolute; display: block; @@ -340,7 +355,7 @@ header h1 { z-index: 2; } -/* line 272, ../../sass/screen.scss */ +/* line 285, ../../sass/screen.scss */ ul.infos { margin: 0 -3px; padding: 0; @@ -349,7 +364,7 @@ ul.infos { justify-content: space-between; width: 100; } -/* line 280, ../../sass/screen.scss */ +/* line 293, ../../sass/screen.scss */ ul.infos li { display: inline-block; padding: 5px; @@ -361,28 +376,28 @@ ul.infos li { text-align: center; background-color: #ddd; } -/* line 291, ../../sass/screen.scss */ +/* line 304, ../../sass/screen.scss */ ul.infos li.thematique { color: #0d3f6b; background-color: #86bff1; } -/* line 295, ../../sass/screen.scss */ +/* line 308, ../../sass/screen.scss */ ul.infos li.matiere { color: #395214; background-color: #c7e699; } -/* line 299, ../../sass/screen.scss */ +/* line 312, ../../sass/screen.scss */ ul.infos li.lieu { color: #7c043c; background-color: #fb84bc; } -/* line 303, ../../sass/screen.scss */ +/* line 316, ../../sass/screen.scss */ ul.infos li.year { background-color: #950548; color: #fff; display: none; } -/* line 308, ../../sass/screen.scss */ +/* line 321, ../../sass/screen.scss */ ul.infos li.avis-len { background-color: transparent; border: 1px solid #eee; @@ -390,29 +405,29 @@ ul.infos li.avis-len { padding: 4px; padding-bottom: 2px; } -/* line 315, ../../sass/screen.scss */ +/* line 328, ../../sass/screen.scss */ ul.infos li.avis-len.avis-vide { border-bottom-color: #ddd; } -/* line 318, ../../sass/screen.scss */ +/* line 331, ../../sass/screen.scss */ ul.infos li.avis-len.avis-court { border-bottom-color: #ffff66; } -/* line 321, ../../sass/screen.scss */ +/* line 334, ../../sass/screen.scss */ ul.infos li.avis-len.avis-moyen { border-bottom-color: #86bff1; } -/* line 324, ../../sass/screen.scss */ +/* line 337, ../../sass/screen.scss */ ul.infos li.avis-len.avis-long { border-bottom-color: #a5d65c; } -/* line 330, ../../sass/screen.scss */ +/* line 343, ../../sass/screen.scss */ ul.infos:after { content: ""; flex: 1000; } -/* line 336, ../../sass/screen.scss */ +/* line 349, ../../sass/screen.scss */ section.profil { background: #fff; max-width: 600px; @@ -420,7 +435,7 @@ section.profil { margin: 5px auto; margin-bottom: 15px; } -/* line 343, ../../sass/screen.scss */ +/* line 356, ../../sass/screen.scss */ section.profil div.infos { border-bottom: 3px solid #1a82dd; display: flex; @@ -712,7 +727,7 @@ article.stage .section-wrapper .toc .toc-active a { border: 1px solid #ad0654; } -/* line 364, ../../sass/screen.scss */ +/* line 377, ../../sass/screen.scss */ input, textarea, select, div.tinymce, option, optgroup:before { background: #fff; font-size: 1em; @@ -722,13 +737,13 @@ input, textarea, select, div.tinymce, option, optgroup:before { padding: 5px; text-align: left; } -/* line 373, ../../sass/screen.scss */ +/* line 386, ../../sass/screen.scss */ input:focus, input.mce-edit-focus, textarea:focus, textarea.mce-edit-focus, select:focus, select.mce-edit-focus, div.tinymce:focus, div.tinymce.mce-edit-focus, option:focus, option.mce-edit-focus, optgroup:before:focus, optgroup:before.mce-edit-focus { background-color: #e9f5d6; outline: none; } -/* line 380, ../../sass/screen.scss */ +/* line 393, ../../sass/screen.scss */ input[type='text'], input[type='password'], input[type='email'], input[type='number'], textarea, select { border: none; @@ -738,7 +753,7 @@ input[type='email'], input[type='number'], textarea, select { transition: border 1s ease-out, background 1s ease-out; } -/* line 389, ../../sass/screen.scss */ +/* line 402, ../../sass/screen.scss */ select { -moz-appearance: none; appearance: none; @@ -752,21 +767,21 @@ select { background-color: #fff; background-size: contain; } -/* line 402, ../../sass/screen.scss */ +/* line 415, ../../sass/screen.scss */ select option { padding: 3px; white-space: pre-wrap; } -/* line 408, ../../sass/screen.scss */ +/* line 421, ../../sass/screen.scss */ select optgroup option { padding-left: 10px; } -/* line 411, ../../sass/screen.scss */ +/* line 424, ../../sass/screen.scss */ select optgroup:before { font-weight: bold; } -/* line 417, ../../sass/screen.scss */ +/* line 430, ../../sass/screen.scss */ input[type="submit"], .btn { font: 19px "Dosis", sans-serif; background-color: #8fcc33; @@ -777,17 +792,17 @@ input[type="submit"], .btn { display: inline-block; } -/* line 427, ../../sass/screen.scss */ +/* line 440, ../../sass/screen.scss */ p.submits { text-align: right; } -/* line 431, ../../sass/screen.scss */ +/* line 444, ../../sass/screen.scss */ form .commentaire { font-style: italic; } -/* line 435, ../../sass/screen.scss */ +/* line 448, ../../sass/screen.scss */ .edit-btn { border-color: #706c00; color: #000; @@ -796,14 +811,14 @@ form .commentaire { background-origin: content-box; background-size: contain; } -/* line 443, ../../sass/screen.scss */ +/* line 456, ../../sass/screen.scss */ .edit-btn:after { content: ""; width: 30px; display: inline-block; } -/* line 450, ../../sass/screen.scss */ +/* line 463, ../../sass/screen.scss */ textarea, div.tinymce { font-family: "Lato", sans-serif; border: none; @@ -813,20 +828,20 @@ textarea, div.tinymce { transition: border 1s ease-out, background 1s ease-out; } -/* line 459, ../../sass/screen.scss */ +/* line 472, ../../sass/screen.scss */ textarea { height: 200px; resize: vertical; } -/* line 467, ../../sass/screen.scss */ +/* line 480, ../../sass/screen.scss */ form .field { margin: 5px 0; display: flex; background: #fff; padding: 10px; } -/* line 473, ../../sass/screen.scss */ +/* line 486, ../../sass/screen.scss */ form .field label, form .field .label { display: inline-block; width: 250px; @@ -835,39 +850,39 @@ form .field label, form .field .label { padding-top: 5px; flex-shrink: 0; } -/* line 481, ../../sass/screen.scss */ +/* line 494, ../../sass/screen.scss */ form .field label.required:before, form .field .label.required:before { margin-right: 5px; content: "*"; color: #f70978; } -/* line 487, ../../sass/screen.scss */ +/* line 500, ../../sass/screen.scss */ form .field label { font-family: Alegreya, serif; font-weight: bold; } -/* line 491, ../../sass/screen.scss */ +/* line 504, ../../sass/screen.scss */ form .field .help_text { font-style: italic; font-size: 0.9em; } -/* line 495, ../../sass/screen.scss */ +/* line 508, ../../sass/screen.scss */ form .field .input { display: inline-block; flex-grow: 1; margin-right: 10px; } -/* line 505, ../../sass/screen.scss */ +/* line 518, ../../sass/screen.scss */ ul.as-selections { display: flex; flex-wrap: wrap; } -/* line 509, ../../sass/screen.scss */ +/* line 522, ../../sass/screen.scss */ ul.as-selections li { display: inline-block; } -/* line 513, ../../sass/screen.scss */ +/* line 526, ../../sass/screen.scss */ ul.as-selections .as-selection-item { padding: 0 5px; background: #f99b20; @@ -876,53 +891,53 @@ ul.as-selections .as-selection-item { border-radius: 2px; font-weight: 500; } -/* line 521, ../../sass/screen.scss */ +/* line 534, ../../sass/screen.scss */ ul.as-selections .as-selection-item a.as-close { color: #fff; -webkit-cursor: pointer; cursor: pointer; margin-right: 5px; } -/* line 528, ../../sass/screen.scss */ +/* line 541, ../../sass/screen.scss */ ul.as-selections .as-selection-item.selected { background: #8fcc33; } -/* line 533, ../../sass/screen.scss */ +/* line 546, ../../sass/screen.scss */ ul.as-selections .as-original { flex-grow: 1; min-width: 200px; } -/* line 537, ../../sass/screen.scss */ +/* line 550, ../../sass/screen.scss */ ul.as-selections .as-original input { width: 100%; } -/* line 543, ../../sass/screen.scss */ +/* line 556, ../../sass/screen.scss */ div.as-results { position: relative; z-index: 2; } -/* line 547, ../../sass/screen.scss */ +/* line 560, ../../sass/screen.scss */ div.as-results ul { position: absolute; width: 100%; background: #fff; border: 1px solid #d2ebad; } -/* line 554, ../../sass/screen.scss */ +/* line 567, ../../sass/screen.scss */ div.as-results ul li { padding: 3px 5px; } -/* line 560, ../../sass/screen.scss */ +/* line 573, ../../sass/screen.scss */ div.as-results ul li.as-result-item.active { background: #fddeb5; } -/* line 565, ../../sass/screen.scss */ +/* line 578, ../../sass/screen.scss */ div.as-results ul li.as-message { font-style: italic; } -/* line 575, ../../sass/screen.scss */ +/* line 588, ../../sass/screen.scss */ .window { display: none; position: fixed; @@ -933,11 +948,11 @@ div.as-results ul li.as-message { left: 0; z-index: 50; } -/* line 585, ../../sass/screen.scss */ +/* line 598, ../../sass/screen.scss */ .window.visible { display: block; } -/* line 589, ../../sass/screen.scss */ +/* line 602, ../../sass/screen.scss */ .window .window-bg { background: #000; opacity: 0.7; @@ -948,7 +963,7 @@ div.as-results ul li.as-message { top: 0; z-index: -1; } -/* line 600, ../../sass/screen.scss */ +/* line 613, ../../sass/screen.scss */ .window .window-content { position: relative; margin: 0 auto; @@ -962,11 +977,11 @@ div.as-results ul li.as-message { max-height: 100%; overflow: auto; } -/* line 614, ../../sass/screen.scss */ +/* line 627, ../../sass/screen.scss */ .window .window-content form label, .window .window-content form .label { width: 150px; } -/* line 620, ../../sass/screen.scss */ +/* line 633, ../../sass/screen.scss */ .window .window-closer { position: absolute; top: 0; @@ -974,65 +989,65 @@ div.as-results ul li.as-message { padding: 12px; z-index: 3; } -/* line 626, ../../sass/screen.scss */ +/* line 639, ../../sass/screen.scss */ .window .window-closer:after { content: "×"; } -/* line 637, ../../sass/screen.scss */ +/* line 650, ../../sass/screen.scss */ #lieu_widget .lieu-ui { position: relative; } -/* line 639, ../../sass/screen.scss */ +/* line 652, ../../sass/screen.scss */ #lieu_widget .lieu-ui .map { height: 400px; width: 100%; } -/* line 643, ../../sass/screen.scss */ +/* line 656, ../../sass/screen.scss */ #lieu_widget .lieu-ui.hidden { display: none; } -/* line 646, ../../sass/screen.scss */ +/* line 659, ../../sass/screen.scss */ #lieu_widget .lieu-ui .masked { visibility: hidden; } -/* line 651, ../../sass/screen.scss */ +/* line 664, ../../sass/screen.scss */ #lieu_widget .lieu-choixmodif { display: none; } -/* line 656, ../../sass/screen.scss */ +/* line 669, ../../sass/screen.scss */ #lieu_widget.modif .lieu-choixmodif { display: unset; } -/* line 661, ../../sass/screen.scss */ +/* line 674, ../../sass/screen.scss */ #lieu_widget.modif .lieu-ui, #lieu_widget.attente .lieu-ui { display: none; } -/* line 668, ../../sass/screen.scss */ +/* line 681, ../../sass/screen.scss */ #lieu_widget.edit .lieu-ui .lieu-acinput { display: none; } -/* line 671, ../../sass/screen.scss */ +/* line 684, ../../sass/screen.scss */ #lieu_widget.edit .lieu-ui .map { height: 200px; } -/* line 677, ../../sass/screen.scss */ +/* line 690, ../../sass/screen.scss */ #lieu_widget #avis_lieu_vide { display: none; } -/* line 681, ../../sass/screen.scss */ +/* line 694, ../../sass/screen.scss */ #lieu_widget .message { background: #fddeb5; padding: 5px; font-style: italic; font-size: 0.9em; } -/* line 687, ../../sass/screen.scss */ +/* line 700, ../../sass/screen.scss */ #lieu_widget .message.hidden { display: none; } -/* line 693, ../../sass/screen.scss */ +/* line 706, ../../sass/screen.scss */ a.lieu-change { color: #fff; background: #f99b20; @@ -1045,25 +1060,25 @@ a.lieu-change { border-radius: 5px; margin-right: 7px; } -/* line 705, ../../sass/screen.scss */ +/* line 718, ../../sass/screen.scss */ a.lieu-change.ajout:before { content: "+"; margin-right: 5px; } -/* line 711, ../../sass/screen.scss */ +/* line 724, ../../sass/screen.scss */ #stages-map { width: 100%; height: 600px; max-height: 90vh; } -/* line 718, ../../sass/screen.scss */ +/* line 731, ../../sass/screen.scss */ #id_stage-thematiques { display: none; } -/* line 724, ../../sass/screen.scss */ +/* line 737, ../../sass/screen.scss */ .homeh1 { display: flex; justify-content: space-between; @@ -1073,26 +1088,26 @@ a.lieu-change.ajout:before { border-bottom: 3px solid #000; margin-bottom: 15px; } -/* line 733, ../../sass/screen.scss */ +/* line 746, ../../sass/screen.scss */ .homeh1 h1 { margin-bottom: 3px; } -/* line 737, ../../sass/screen.scss */ +/* line 750, ../../sass/screen.scss */ .homeh1 > * { display: inline-block; } -/* line 740, ../../sass/screen.scss */ +/* line 753, ../../sass/screen.scss */ .homeh1 p { text-align: right; } -/* line 745, ../../sass/screen.scss */ +/* line 758, ../../sass/screen.scss */ .betacadre { background: #fa6cae; padding: 10px; } -/* line 750, ../../sass/screen.scss */ +/* line 763, ../../sass/screen.scss */ .entrer { background: #fff; max-width: 500px; @@ -1100,85 +1115,92 @@ a.lieu-change.ajout:before { text-align: center; margin: 15px auto; } +/* line 770, ../../sass/screen.scss */ +.entrer .archicubes { + border-top: 2px solid #1a82dd; + margin-top: 5px; + padding-top: 5px; + font-size: 0.9em; +} -/* line 758, ../../sass/screen.scss */ +/* line 778, ../../sass/screen.scss */ article.promo { display: block; font-size: 1.1em; } -/* line 762, ../../sass/screen.scss */ +/* line 782, ../../sass/screen.scss */ article.promo .explications { display: table; } -/* line 765, ../../sass/screen.scss */ +/* line 785, ../../sass/screen.scss */ article.promo .explications:first-child { direction: rtl; } -/* line 767, ../../sass/screen.scss */ +/* line 787, ../../sass/screen.scss */ article.promo .explications:first-child > * { direction: ltr; } -/* line 772, ../../sass/screen.scss */ +/* line 792, ../../sass/screen.scss */ article.promo .explications > div { display: table-cell; vertical-align: middle; text-align: center; } -/* line 777, ../../sass/screen.scss */ +/* line 797, ../../sass/screen.scss */ article.promo .explications > div p { margin: 15px 15px; } -/* line 785, ../../sass/screen.scss */ +/* line 805, ../../sass/screen.scss */ .faq-toc { font-family: "Lato", sans-serif; display: block; max-width: 700px; margin: 0 auto; } -/* line 790, ../../sass/screen.scss */ +/* line 810, ../../sass/screen.scss */ .faq-toc ul { margin: 20px; } -/* line 794, ../../sass/screen.scss */ +/* line 814, ../../sass/screen.scss */ .faq-toc ul li a { color: #000; display: block; padding: 5px; } -/* line 800, ../../sass/screen.scss */ +/* line 820, ../../sass/screen.scss */ .faq-toc ul li.toc-h1 { display: none; } -/* line 804, ../../sass/screen.scss */ +/* line 824, ../../sass/screen.scss */ .faq-toc ul li.toc-h2 a { background: #fcc883; } -/* line 808, ../../sass/screen.scss */ +/* line 828, ../../sass/screen.scss */ .faq-toc ul li.toc-h3 a { padding-left: 10px; background: #fff; font-weight: normal; } -/* line 814, ../../sass/screen.scss */ +/* line 834, ../../sass/screen.scss */ .faq-toc ul li a:hover { color: #395214; background: #bce085 !important; } -/* line 823, ../../sass/screen.scss */ +/* line 843, ../../sass/screen.scss */ .faq article { background: #fff; padding: 15px; } -/* line 826, ../../sass/screen.scss */ +/* line 846, ../../sass/screen.scss */ .faq article h2 { background-color: #fcc883; color: #ae6505; margin: -15px; padding: 15px; } -/* line 833, ../../sass/screen.scss */ +/* line 853, ../../sass/screen.scss */ .faq article h3 { color: #0f4c82; background-color: #9dcbf3; @@ -1186,19 +1208,19 @@ article.promo .explications > div p { margin-top: 30px; padding: 10px 15px; } -/* line 840, ../../sass/screen.scss */ +/* line 860, ../../sass/screen.scss */ .faq article h3:nth-child(2) { margin-top: 0; } -/* line 845, ../../sass/screen.scss */ +/* line 865, ../../sass/screen.scss */ .faq article ul { padding-left: 20px; } -/* line 847, ../../sass/screen.scss */ +/* line 867, ../../sass/screen.scss */ .faq article ul li { list-style: initial; } -/* line 852, ../../sass/screen.scss */ +/* line 872, ../../sass/screen.scss */ .faq article p, .faq article ul { font-family: "Lato", sans-serif; font-size: 18px; @@ -1207,20 +1229,20 @@ article.promo .explications > div p { margin-right: 5%; } -/* line 866, ../../sass/screen.scss */ +/* line 886, ../../sass/screen.scss */ table.stats { width: 100%; background: #fff; margin: 20px 0; cellspacing: 1px; } -/* line 871, ../../sass/screen.scss */ +/* line 891, ../../sass/screen.scss */ table.stats th { font-weight: bold; border-top: 1px solid #000; border-bottom: 1px solid #999; } -/* line 876, ../../sass/screen.scss */ +/* line 896, ../../sass/screen.scss */ table.stats td, table.stats th { padding: 5px 3px; text-align: center; diff --git a/avisstage/templates/404.html b/avisstage/templates/404.html new file mode 100644 index 0000000..fe2ca19 --- /dev/null +++ b/avisstage/templates/404.html @@ -0,0 +1,13 @@ +{% extends "avisstage/base.html" %} +{% load staticfiles %} + +{% block title %}Page non trouvée{% endblock %} + +{% block content %} +
+
+

Page non trouvée

+

Cette page n'existe pas, ou peut-être que vous n'y avez pas accès.

+
+
+{% endblock %} diff --git a/avisstage/templates/avisstage/403-archicubes.html b/avisstage/templates/avisstage/403-archicubes.html new file mode 100644 index 0000000..23f4e26 --- /dev/null +++ b/avisstage/templates/avisstage/403-archicubes.html @@ -0,0 +1,14 @@ +{% extends "avisstage/base.html" %} +{% load staticfiles %} + +{% block title %}Accès interdit{% endblock %} + +{% block content %} +
+
+

Accès réservé aux personnes en scolarité

+

Vous pouvez pas consulter cette page : après la fin de votre scolarité, vous ne pouvez accéder qu'à votre profil et vos fiches de stages pour les tenir à jour.

+

Aller à mon tableau de bord

+
+
+{% endblock %} diff --git a/avisstage/templates/avisstage/base.html b/avisstage/templates/avisstage/base.html index 0755536..9d14082 100644 --- a/avisstage/templates/avisstage/base.html +++ b/avisstage/templates/avisstage/base.html @@ -27,16 +27,18 @@ diff --git a/avisstage/templates/avisstage/detail/profil.html b/avisstage/templates/avisstage/detail/profil.html index 01c959e..68281d9 100644 --- a/avisstage/templates/avisstage/detail/profil.html +++ b/avisstage/templates/avisstage/detail/profil.html @@ -18,7 +18,7 @@

Promotion : {{ object.promotion }}

{% if object.contactez_moi %} - Contact : {{ object.mail }} + Contact : {{ object.preferred_email }} {% endif %}

diff --git a/avisstage/templates/avisstage/detail/stage.html b/avisstage/templates/avisstage/detail/stage.html index 4ef3c9d..bbe07e1 100644 --- a/avisstage/templates/avisstage/detail/stage.html +++ b/avisstage/templates/avisstage/detail/stage.html @@ -55,7 +55,7 @@ {% endif %}
-
+

{{ object.sujet }}

@@ -65,8 +65,8 @@ a fait {{ object.type_stage_fem|yesno:"cette,ce" }} {{ object.type_stage_fancy }} {% if object.niveau_scol %}{{ object.niveau_scol_fancy }},{% endif %} {% if object.structure %}au sein de {{ object.structure }}{% endif %}{% if object.encadrants %}, supervisé par {{ object.encadrants }}{% endif %}.

- {% if object.lieux.all %}

Cela s'est passé à : - {% for lieu in object.lieux.all %}{{ lieu.nom }} ({{ lieu.ville }}){% if not forloop.last %}, {% endif %}{% endfor %}.

+ {% if object.all_lieux %}

Cela s'est passé à : + {% for lieu in object.all_lieux %}{{ lieu.nom }} ({{ lieu.ville }}){% if not forloop.last %}, {% endif %}{% endfor %}.

{% endif %}
    @@ -79,12 +79,12 @@
- {% if object.lieux.all %} + {% if object.all_lieux %}