first commit
This commit is contained in:
22
manifeste_velo/manage.py
Executable file
22
manifeste_velo/manage.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'signatures.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
0
manifeste_velo/questionnaire/__init__.py
Normal file
0
manifeste_velo/questionnaire/__init__.py
Normal file
12
manifeste_velo/questionnaire/admin.py
Normal file
12
manifeste_velo/questionnaire/admin.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from questionnaire import models
|
||||
|
||||
# Register your models here.
|
||||
|
||||
admin.site.register(models.Ville)
|
||||
admin.site.register(models.PointManifeste)
|
||||
admin.site.register(models.Liste)
|
||||
admin.site.register(models.Candidat)
|
||||
admin.site.register(models.ReponseListe)
|
||||
admin.site.register(models.ReponseListeItem)
|
||||
5
manifeste_velo/questionnaire/apps.py
Normal file
5
manifeste_velo/questionnaire/apps.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class QuestionnaireConfig(AppConfig):
|
||||
name = 'questionnaire'
|
||||
107
manifeste_velo/questionnaire/migrations/0001_initial.py
Normal file
107
manifeste_velo/questionnaire/migrations/0001_initial.py
Normal file
@@ -0,0 +1,107 @@
|
||||
# Generated by Django 6.0.1 on 2026-01-23 07:26
|
||||
|
||||
import django.db.models.deletion
|
||||
import django_extensions.db.fields
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Candidat',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
|
||||
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
|
||||
('nom', models.CharField(max_length=255)),
|
||||
('prenom', models.CharField(max_length=255, verbose_name='Prénom')),
|
||||
],
|
||||
options={
|
||||
'get_latest_by': 'modified',
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PointManifeste',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('titre', models.CharField(max_length=255)),
|
||||
('texte', models.TextField()),
|
||||
('exemple', models.TextField(blank=True, null=True)),
|
||||
('ordre', models.PositiveSmallIntegerField()),
|
||||
('est_commun', models.BooleanField(verbose_name="Item commun à l'agglo")),
|
||||
],
|
||||
options={
|
||||
'ordering': ['ordre'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Ville',
|
||||
fields=[
|
||||
('nom', models.CharField(max_length=255, unique=True)),
|
||||
('slug', django_extensions.db.fields.AutoSlugField(blank=True, editable=False, populate_from=['nom'])),
|
||||
('code_insee', models.PositiveSmallIntegerField(primary_key=True, serialize=False, verbose_name='Code INSEE')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Liste',
|
||||
fields=[
|
||||
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
|
||||
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
|
||||
('uuid', models.UUIDField(primary_key=True, serialize=False)),
|
||||
('nom', models.CharField(max_length=255)),
|
||||
('email', models.CharField(max_length=255, verbose_name='Adresse E-Mail')),
|
||||
('telephone', models.CharField(blank=True, max_length=255, null=True, verbose_name='Numéro de Téléphone')),
|
||||
('site_internet', models.CharField(max_length=255, verbose_name='Site internet')),
|
||||
('email_ouvert', models.DateTimeField(blank=True, null=True, verbose_name="L'e-mail au candidat a été ouvert")),
|
||||
('responsable_mobilites', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='questionnaire.candidat', verbose_name='Responsable mobilités de la liste')),
|
||||
('tete_liste', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, related_name='liste_menee', to='questionnaire.candidat', verbose_name='Tete de liste')),
|
||||
('ville', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='questionnaire.ville')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['ville', 'nom'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ReponseListe',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
|
||||
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
|
||||
('expression_libre', models.TextField(verbose_name='Expression libre')),
|
||||
('email_confirmation', models.BooleanField(verbose_name='E-mail de confirmation envoyé')),
|
||||
('finalise', models.BooleanField(verbose_name='Réponse finalisée')),
|
||||
('liste', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, to='questionnaire.liste')),
|
||||
],
|
||||
options={
|
||||
'get_latest_by': 'modified',
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ReponseListeItem',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
|
||||
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
|
||||
('engagement', models.CharField(choices=[('oui', 'oui'), ('en partie', 'en partie'), ('non', 'non')], max_length=9)),
|
||||
('explication', models.TextField()),
|
||||
('point', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='questionnaire.pointmanifeste')),
|
||||
],
|
||||
options={
|
||||
'get_latest_by': 'modified',
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='pointmanifeste',
|
||||
name='ville',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='questionnaire.ville'),
|
||||
),
|
||||
]
|
||||
0
manifeste_velo/questionnaire/migrations/__init__.py
Normal file
0
manifeste_velo/questionnaire/migrations/__init__.py
Normal file
78
manifeste_velo/questionnaire/models.py
Normal file
78
manifeste_velo/questionnaire/models.py
Normal file
@@ -0,0 +1,78 @@
|
||||
from django.db import models
|
||||
from django_extensions.db.fields import AutoSlugField
|
||||
from django_extensions.db.models import TimeStampedModel
|
||||
|
||||
# Create your models here.
|
||||
|
||||
|
||||
class Ville(models.Model):
|
||||
nom = models.CharField(max_length=255, unique=True)
|
||||
slug = AutoSlugField(populate_from=["nom"])
|
||||
code_insee = models.PositiveSmallIntegerField(verbose_name="Code INSEE", primary_key=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.nom} ({self.code_insee})"
|
||||
|
||||
|
||||
class PointManifeste(models.Model):
|
||||
titre = models.CharField(max_length=255)
|
||||
texte = models.TextField()
|
||||
exemple = models.TextField(null=True, blank=True)
|
||||
ordre = models.PositiveSmallIntegerField()
|
||||
est_commun = models.BooleanField(verbose_name="Item commun à l'agglo")
|
||||
ville = models.ForeignKey(Ville, on_delete=models.PROTECT, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.ordre}. {self.titre}" + (f" (pour {self.ville.nom})" if self.ville is not None else "")
|
||||
|
||||
class Meta:
|
||||
ordering = ["ordre"]
|
||||
|
||||
|
||||
class Candidat(TimeStampedModel, models.Model):
|
||||
nom = models.CharField(max_length=255)
|
||||
prenom = models.CharField(max_length=255, verbose_name="Prénom")
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.prenom} {self.nom} - {self.ville.nom}"
|
||||
|
||||
|
||||
class Liste(TimeStampedModel, models.Model):
|
||||
uuid = models.UUIDField(primary_key=True)
|
||||
nom = models.CharField(max_length=255)
|
||||
email = models.CharField(max_length=255, verbose_name="Adresse E-Mail")
|
||||
telephone = models.CharField(max_length=255, verbose_name="Numéro de Téléphone", blank=True, null=True)
|
||||
site_internet = models.CharField(max_length=255, verbose_name="Site internet")
|
||||
ville = models.ForeignKey(Ville, on_delete=models.PROTECT)
|
||||
tete_liste = models.OneToOneField(
|
||||
Candidat, on_delete=models.PROTECT, related_name="liste_menee", verbose_name="Tete de liste"
|
||||
)
|
||||
responsable_mobilites = models.OneToOneField(
|
||||
Candidat, on_delete=models.PROTECT, verbose_name="Responsable mobilités de la liste"
|
||||
)
|
||||
email_ouvert = models.DateTimeField(blank=True, null=True, verbose_name="L'e-mail au candidat a été ouvert")
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.nom} - {self.ville.nom} - {self.tete_liste.prenom} {self.tete_liste.nom}"
|
||||
|
||||
class Meta:
|
||||
ordering = ["ville", "nom"]
|
||||
|
||||
|
||||
class ReponseListe(TimeStampedModel, models.Model):
|
||||
liste = models.OneToOneField(Liste, on_delete=models.PROTECT)
|
||||
expression_libre = models.TextField(verbose_name="Expression libre")
|
||||
email_confirmation = models.BooleanField(verbose_name="E-mail de confirmation envoyé")
|
||||
finalise = models.BooleanField(verbose_name="Réponse finalisée")
|
||||
|
||||
|
||||
class EngagementChoices(models.TextChoices):
|
||||
OUI = "oui", "oui"
|
||||
EN_PARTIE = "en partie", "en partie"
|
||||
NON = "non", "non"
|
||||
|
||||
|
||||
class ReponseListeItem(TimeStampedModel, models.Model):
|
||||
point = models.ForeignKey(PointManifeste, on_delete=models.PROTECT)
|
||||
engagement = models.CharField(max_length=9, choices=EngagementChoices.choices)
|
||||
explication = models.TextField()
|
||||
BIN
manifeste_velo/questionnaire/static/questionnaire/logo.png
Normal file
BIN
manifeste_velo/questionnaire/static/questionnaire/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
3
manifeste_velo/questionnaire/tests.py
Normal file
3
manifeste_velo/questionnaire/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
9
manifeste_velo/questionnaire/urls.py
Normal file
9
manifeste_velo/questionnaire/urls.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.contrib.auth.views import LoginView, LogoutView
|
||||
from django.urls import path
|
||||
|
||||
app_name = "questionnaire"
|
||||
|
||||
urlpatterns = [
|
||||
path("login", LoginView.as_view(template_name="questionnaire/login.html"), name="login"),
|
||||
path("logout", LogoutView.as_view(template_name="questionnaire/logout.html"), name="logout"),
|
||||
]
|
||||
3
manifeste_velo/questionnaire/views.py
Normal file
3
manifeste_velo/questionnaire/views.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
0
manifeste_velo/signatures/__init__.py
Normal file
0
manifeste_velo/signatures/__init__.py
Normal file
16
manifeste_velo/signatures/asgi.py
Normal file
16
manifeste_velo/signatures/asgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for signatures project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'signatures.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
131
manifeste_velo/signatures/settings.py
Normal file
131
manifeste_velo/signatures/settings.py
Normal file
@@ -0,0 +1,131 @@
|
||||
"""
|
||||
Django settings for signatures project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 6.0.1.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/6.0/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-se*^9ys917tep!txqkoa8(2kfigkya9nh2tynmoxn8^+s8c@9j'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django_node_assets',
|
||||
'django_extensions',
|
||||
'questionnaire'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'signatures.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [ BASE_DIR / 'templates'],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'signatures.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/6.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = False
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/6.0/howto/static-files/
|
||||
|
||||
STATIC_URL = 'static/'
|
||||
STATIC_ROOT = BASE_DIR / "static"
|
||||
STATICFILES_FINDERS = [
|
||||
"django.contrib.staticfiles.finders.FileSystemFinder",
|
||||
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
|
||||
"django_node_assets.finders.NodeModulesFinder",
|
||||
]
|
||||
MEDIA_URL = "media/"
|
||||
MEDIA_ROOT = BASE_DIR / "media"
|
||||
|
||||
NODE_PACKAGE_JSON = BASE_DIR / "package.json"
|
||||
NODE_MODULES_ROOT = BASE_DIR / "node_modules"
|
||||
23
manifeste_velo/signatures/urls.py
Normal file
23
manifeste_velo/signatures/urls.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
URL configuration for signatures project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/6.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('', include('questionnaire.urls')),
|
||||
path('django-admin/', admin.site.urls),
|
||||
]
|
||||
16
manifeste_velo/signatures/wsgi.py
Normal file
16
manifeste_velo/signatures/wsgi.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for signatures project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'signatures.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
88
manifeste_velo/templates/admin_base.html
Normal file
88
manifeste_velo/templates/admin_base.html
Normal file
@@ -0,0 +1,88 @@
|
||||
{% extends 'base.html' %}{% load static %}{% load simple_menu %}
|
||||
{% block body %}{% generate_menu %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<a class="d-flex align-items-center mt-2 pb-3 mb-3 link-body-emphasis text-decoration-none border-bottom" href="{% url 'admin_benevolat:index' %}">
|
||||
<img src="{% get_media_prefix %}{{ config.LOGO_ASSO }}" height="100px" class="me-3">
|
||||
<span class="fs-4 fw-semibold">{{ config.NOM_ASSO }}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3 p-3 border-end" role="navigation">
|
||||
<!--<div class="flex-shrink-0 p-3">-->
|
||||
<ul class="list-unstyled ps-0">
|
||||
{% for item in menus.admin %}
|
||||
<li class="mb-1">
|
||||
<button
|
||||
class="btn btn-toggle d-inline-flex align-items-center rounded border-0"
|
||||
data-bs-toggle="collapse" data-bs-target="#{{ item.title|slugify }}-collapse" aria-expanded="false">
|
||||
<i class="bi bi-chevron-right me-1" id="{{ item.title|slugify }}-icon"></i>
|
||||
{% if item.icon != "" %}<i class="bi bi-{{ item.icon }} me-1"></i>{% endif %}{{ item.title }}
|
||||
</button>
|
||||
<div id="{{ item.title|slugify}}-collapse" class="collapse">
|
||||
<ul class="btn-toggle-nav list-unstyled fw-normal ms-3 small">
|
||||
{% for subitem in item.children %}
|
||||
<li>
|
||||
|
||||
<a hx-get="{{ subitem.url }}" hx-target="#admin_body" hx-push-url="true" class="link-body-emphasis d-inline-flex text-decoration-none rounded">
|
||||
{% if subitem.icon %}<i class="bi bi-{{ subitem.icon }} me-1"></i>{% endif %}{{ subitem.title }}
|
||||
</a>
|
||||
{% if subitem.children %}
|
||||
<ul class="nav nav-pills flex-column mb-auto ms-4 smaller">
|
||||
{% for child in subitem.children %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link{% if child.selected %} active{% endif %}" hx-get="{{ child.url }}" hx-target="#admin_body" hx-push-url="true">
|
||||
{% if child.icon %}<i class="bi bi-{{ child.icon }} me-1"></i>{% endif %}{{ child.title }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<div class="col-9" id="admin_body">
|
||||
{% block admin_body %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block javascripts_footer %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript">
|
||||
document.querySelectorAll('[id$=-collapse]').forEach(elt => {
|
||||
elt.addEventListener('show.bs.collapse', event => {
|
||||
var title = '#'+event.target.id.split('-collapse')[0] + '-icon';
|
||||
console.log(title);
|
||||
document.querySelector(title).classList.remove('bi-chevron-right');
|
||||
document.querySelector(title).classList.add('bi-chevron-down');
|
||||
});
|
||||
});
|
||||
document.querySelectorAll('[id$=-collapse]').forEach(elt => {
|
||||
elt.addEventListener('hide.bs.collapse', event => {
|
||||
var title = '#'+event.target.id.split('-collapse')[0] + '-icon';
|
||||
console.log(title);
|
||||
document.querySelector(title).classList.remove('bi-chevron-down');
|
||||
document.querySelector(title).classList.add('bi-chevron-right');
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll("div[role=navigation] a").forEach( elt => {
|
||||
elt.addEventListener('htmx:afterRequest', event => {
|
||||
console.log("so triggered")
|
||||
document.querySelectorAll("div[role=navigation] a").forEach(subelt => { subelt.classList.remove("active"); });
|
||||
event.target.classList.add("active");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
28
manifeste_velo/templates/base.html
Normal file
28
manifeste_velo/templates/base.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<!doctype html>{% load static %}
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<title>{% block title %}Place au Vélo Angers{% endblock %}</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{% block css %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap/dist/css/bootstrap.min.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'bootstrap-icons/font/bootstrap-icons.css' %}">
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: rgba(16,99,50,0.1);
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block javascripts_header %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}
|
||||
|
||||
{% endblock %}
|
||||
{% block javascripts_footer %}
|
||||
<script src="{% static '@popperjs/core/dist/umd/popper.min.js' %}"></script>
|
||||
<script src="{% static 'bootstrap/dist/js/bootstrap.min.js' %}"></script>
|
||||
<script src="{% static 'htmx.org/dist/htmx.min.js' %}"></script>
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user