Merge branch 'thubrecht/css-forms' into 'master'
Thubrecht/css forms See merge request klub-dev-ens/annuaire!8
This commit is contained in:
commit
6a9a47fcea
6 changed files with 261 additions and 159 deletions
|
@ -13,7 +13,9 @@ class Profile(models.Model):
|
|||
)
|
||||
full_name = models.CharField(max_length=1023, verbose_name=_("nom"))
|
||||
nickname = models.CharField(blank=True, max_length=1023, verbose_name=_("surnom"))
|
||||
pronoun = models.CharField(blank=True, max_length = 1023, verbose_name=_("pronom(s) utilisé(s)"))
|
||||
pronoun = models.CharField(
|
||||
blank=True, max_length=1023, verbose_name=_("pronom(s) utilisé(s)")
|
||||
)
|
||||
picture = models.ImageField(
|
||||
blank=True, upload_to="picture", verbose_name=_("photo")
|
||||
)
|
||||
|
@ -31,12 +33,10 @@ class Profile(models.Model):
|
|||
default=False, verbose_name=_("conserver la fiche annuaire ?")
|
||||
)
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return self.full_name
|
||||
|
||||
def birthday():
|
||||
def birthday(self):
|
||||
return self.birth_date.strftime("%d%m")
|
||||
|
||||
|
||||
|
|
|
@ -2,73 +2,77 @@
|
|||
{% load staticfiles %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<title>
|
||||
{% block title_onglet %}{% trans "Annuaire des élèves de l'ENS" %}{% endblock %}
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="view_fiche_files/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="{% static "fiches/css/normalize.css" %}" />
|
||||
<link rel="stylesheet" type="text/css" href="{% static "fiches/css/annuaire.css" %}" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="aside">
|
||||
<div id="menu">
|
||||
<div id="language_switch">
|
||||
<a class="language french current-language" href="/">Français</a><a class="language english" href="/">English</a><a class="language esperanto" href="/">Esperanto</a>
|
||||
</div>
|
||||
|
||||
<form id="search-area">
|
||||
<input type="search" placeholder="Marc Mézard">
|
||||
<button type="submit">Rechercher</button>
|
||||
</form>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<title>
|
||||
{% block title_onglet %}{% trans "Annuaire des élèves de l'ENS" %}{% endblock %}
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="view_fiche_files/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="{% static "fiches/css/normalize.css" %}" />
|
||||
<link rel="stylesheet" type="text/css" href="{% static "fiches/css/annuaire.css" %}" />
|
||||
</head>
|
||||
|
||||
<h1 id="title">
|
||||
{% block title %} <a href='{% url "home" %}'>{% trans "Annuaire des élèves de l'ENS" %}</a>{% endblock %}
|
||||
</h1>
|
||||
|
||||
<body>
|
||||
<div id="aside">
|
||||
<div id="menu">
|
||||
<div id="language_switch">
|
||||
<a class="language french {% if get_current_language == "fr" %}current-language{% endif %}" href="/fr{{ request.get_full_path|slice:'3:' }}">Français</a>
|
||||
<a class="language english {% if get_current_language == "en" %}current-language{% endif %}" href="/en{{ request.get_full_path|slice:'3:' }}">English</a>
|
||||
</div>
|
||||
|
||||
<div id="main-menu">
|
||||
<nav>
|
||||
<a href='{% url "home" %}'> Accueil </a>
|
||||
<a href='{% url "fiche_modif" %}'> Modifier sa fiche d'annuaire </a>
|
||||
<a href='{% url "fiche" request.user.profile.user %}'> Consulter sa fiche d'annuaire </a>
|
||||
<a href='{% url "birthday" %}'> Anniversaires à venir </a>
|
||||
{% if user.is_authenticated %}
|
||||
<a href='{% url "cas_ng_logout" %}'> Se déconnecter</a>
|
||||
{% else %}
|
||||
<a href='{% url "cas_ng_login" %}'> Se connecter</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
<form id="search-area">
|
||||
<input type="search" placeholder="Marc Mézard">
|
||||
<button type="submit">{% trans "Rechercher" %}</button>
|
||||
</form>
|
||||
|
||||
<div id="account-area">
|
||||
{% if user.is_authenticated %}
|
||||
{% blocktrans %}Connecté en tant que <tt>{{ user }}</tt>{% endblocktrans %}<br />
|
||||
{% endif %}
|
||||
</div>
|
||||
<h1 id="title">
|
||||
{% block title %} <a href='{% url "home" %}'>{% trans "Annuaire des élèves de l'ENS" %}</a>{% endblock %}
|
||||
</h1>
|
||||
|
||||
|
||||
<div id="main-menu">
|
||||
<nav>
|
||||
<a href='{% url "home" %}'>{% trans "Accueil" %}</a>
|
||||
<a href='{% url "fiche_modif" %}'>{% trans "Modifier sa fiche d'annuaire" %}</a>
|
||||
{% if user.is_authenticated %}
|
||||
<a href='{% url "fiche" request.user.profile.user %}'>{% trans "Consulter sa fiche d'annuaire" %}</a>
|
||||
{% endif %}
|
||||
<a href='{% url "birthday" %}'>{% trans "Anniversaires à venir" %}</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div id="account-area">
|
||||
{% if user.is_authenticated %}
|
||||
{% blocktrans %}Connecté en tant que <tt>{{ user }}</tt>{% endblocktrans %}<br />
|
||||
<a href='{% url "cas_ng_logout" %}'>{% trans "Se déconnecter" %}</a>
|
||||
{% else %}
|
||||
<a href='{% url "cas_ng_login" %}'>{% trans "Se connecter" %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<div id="content-area">
|
||||
<div id="main">
|
||||
<div id="content-area">
|
||||
|
||||
{% block contentspacer %}{% endblock %}
|
||||
{% block content %}{% endblock %}
|
||||
{% block contentspacer %}{% endblock %}
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
{% block footer %}
|
||||
<span class="thanks">
|
||||
Crée par KDENS · Propulsé par Django
|
||||
</span>
|
||||
|
||||
[<a href="http://www.ens.fr/">ENS</a>]
|
||||
[<a href="http://www.eleves.ens.fr/">{% trans "Page des élèves" %}</a>]
|
||||
[<a href="mailto:klub-dev@ens.fr">{% trans "Contacter l'équipe annuaire" %} </a>]
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<div id="footer">
|
||||
{% block footer %}
|
||||
<span class="thanks">
|
||||
{% trans "Crée par KDENS · Propulsé par Django" %}
|
||||
</span>
|
||||
|
||||
[<a href="http://www.ens.fr/">ENS</a>]
|
||||
[<a href="http://www.eleves.ens.fr/">{% trans "Page des élèves" %}</a>]
|
||||
[<a href="mailto:klub-dev@ens.fr">{% trans "Contacter l'équipe annuaire" %} </a>]
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
{% extends "fiches/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2> Anniversaires </h2>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
{% for profile in result %}
|
||||
<li><a href="{% url 'fiche' profile.user.username %}">{{profile.full_name}}
|
||||
</a> ({{ profile.department.all|join:", " }} {{profile.promotion}}) : {{ profile.birth_date|date:"j F" }} </li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content" id="content-birthdays">
|
||||
<h2>{% trans "Anniversaires" %}</h2>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
{% for profile in result %}
|
||||
<li>
|
||||
<a href="{% url 'fiche' profile.user.username %}"><span class="name">{{ profile.full_name }}</span></a> : {{ profile.birth_date|date:"j F" }}
|
||||
<span class="age">({{ profile.age }} {% trans "ans" %})</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,73 +1,77 @@
|
|||
{% extends "fiches/base.html" %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<div style="width:200px;height:200px;overflow:hidden;" >
|
||||
{% if profile.picture %}
|
||||
<img src="{{ profile.picture.url }}" width="200px" height="auto"/>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<h3>{{ profile.full_name }}
|
||||
({{ profile.promotion }})
|
||||
{% if profile.nickname %}
|
||||
(<em>alias:</em>{{ profile.nickname }})</h3>
|
||||
{% endif %}
|
||||
<p>
|
||||
{% if profile.pronoun %}
|
||||
<em>Pronom(s) utilisé(s) :</em>{{ profile.pronoun }}
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
{% if profile.department.exists %}
|
||||
<em>Département{{ profile.department.count|pluralize}} :</em>
|
||||
{% endif %}
|
||||
{% for dep in profile.department.all %}
|
||||
{{ dep }}
|
||||
{% if not forloop.last %}
|
||||
,
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if profile.birth_date %}
|
||||
</p>
|
||||
<p>
|
||||
{% if profile.phone_set.exists %}
|
||||
<em>Téléphone{{ profile.phone_set.count|pluralize}} :</em>
|
||||
{% endif %}
|
||||
{% for ph in profile.phone_set.all %}
|
||||
{{ ph }}
|
||||
{% if not forloop.last %}
|
||||
,<br/>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
{% if profile.social_set.exists %}
|
||||
<em>{{ profile.social_set.count|pluralize:"Réseau social,Réseaux sociaux"}} :</em>
|
||||
{% endif %}
|
||||
{% for ph in profile.social_set.all %}
|
||||
{{ ph }}
|
||||
{% if not forloop.last %}
|
||||
,<br/>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
<p>
|
||||
<em>Date de naissance :</em> {{ profile.birth_date }}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% load i18n %}
|
||||
|
||||
{% if profile.thurne %}
|
||||
<p>
|
||||
<em>Thurne :</em> {{ profile.thurne }}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="content" id="content-view-profile">
|
||||
<div class="content-header">
|
||||
{% if profile.picture %}
|
||||
<a href="{{ profile.picture.url }}">
|
||||
<img class="photo" src="{{ profile.picture.url }}">
|
||||
</a>
|
||||
{% endif %}
|
||||
<h2 class="name">
|
||||
{{ profile.full_name }} ({{ profile.promotion }})
|
||||
{% if profile.nickname %}
|
||||
<span class="alias">(<em>alias :</em> {{ profile.nickname }})</span>
|
||||
{% endif %}
|
||||
</h2>
|
||||
</div>
|
||||
<div>
|
||||
{% if profile.text_field %}
|
||||
<p>
|
||||
<b>Champ libre :</b> {{ profile.text_field }}
|
||||
|
||||
<div class="infos">
|
||||
{% if profile.pronoun %}
|
||||
<p class="pronouns">
|
||||
<span class="label">{% trans "Pronom(s) utilisé(s)" %}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="value">{{ profile.pronoun }}</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if profile.department.exists %}
|
||||
<p class="department">
|
||||
<span class="label">{% trans "Département" %}{{ profile.department.count|pluralize }}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="value">{% for dep in profile.department.all %}{{ dep }}{% if not forloop.last %}, {% endif %}{% endfor %}</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if profile.birth_date %}
|
||||
<p class="birthdate">
|
||||
<span class="label">{% trans "Date de naissance" %}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="value">{{ profile.birth_date }}</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if profile.thurne %}
|
||||
<p class="room">
|
||||
<span class="label">{% trans "Thurne" %}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="value">{{ profile.thurne }}</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if profile.phone_set.exists %}
|
||||
<p class="phone">
|
||||
<span class="label">{% trans "Téléphone" %}{{ profile.phone_set.count|pluralize }}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="value">{% for p in profile.phone_set.all %}{{ p }}{% if not forloop.last %},<br>{% endif %}{% endfor %}</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if profile.social_set.exists %}
|
||||
<p class="phone">
|
||||
<span class="label">{{ profile.social_set.count|pluralize:_("Réseau social,Réseaux sociaux") }}</span>
|
||||
<span class="separator"></span>
|
||||
<span class="value">{% for p in profile.social_set.all %}{{ p }}{% if not forloop.last %},<br>{% endif %}{% endfor %}</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if profile.text_field %}
|
||||
<div class="free-text">
|
||||
<span class="label">{% trans "Champ libre" %}</span>
|
||||
<p class="value">{{ profile.text_field }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,11 +1,84 @@
|
|||
{% extends "fiches/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Modifier ma page d'annuaire</h2>
|
||||
<form enctype="multipart/form-data" method="post" action="">
|
||||
|
||||
|
||||
<div id="content-edit-profile" class="content">
|
||||
<h2>{% trans "Modifier ma page d'annuaire" %}</h2>
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Enregistrer">
|
||||
<div class="form-entry">
|
||||
<label for="id_full_name">{% trans "Nom :" %}</label>
|
||||
{{ form.full_name }}
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_nickname">{% trans "Surnom :" %}</label>
|
||||
{{ form.nickname }}
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_pronoun">{% trans "Pronom(s) utilisé(s) :" %}</label>
|
||||
{{ form.pronoun }}
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_picture">{% trans "Photo :" %}</label>
|
||||
<div id="photo-edit-form" class="wide-form-entry">
|
||||
<div class="current-photo">
|
||||
{% if form.instance.picture %}
|
||||
<a href="{{ form.instance.picture.url }}">
|
||||
<img src="{{ form.instance.picture.url }}">
|
||||
</a>
|
||||
{% else %}
|
||||
<img>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="photo-edit-controls">
|
||||
{% if form.instance.picture %}
|
||||
<div class="control checkbox">
|
||||
<label for="picture-clear_id">{% trans "Effacer (cochez la case) :" %}</label>
|
||||
<input type="checkbox" name="picture-clear" id="picture-clear_id">
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="control">
|
||||
<label for="id_picture">{% trans "Nouvelle photo :" %}</label>
|
||||
<input type="file" name="picture" accept="image/*" id="id_picture">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_department">{% trans "Département :" %}</label>
|
||||
{{ form.department }}
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_promotion">{% trans "Promotion :" %}</label>
|
||||
{{ form.promotion }}
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_birth_date">{% trans "Date de naissance :" %}</label>
|
||||
{{ form.birth_date }}
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_thurne">{% trans "Thurne :" %}</label>
|
||||
{{ form.thurne }}
|
||||
</div>
|
||||
<div class="form-entry">
|
||||
<label for="id_text_field">{% trans "Champ libre :" %}</label>
|
||||
<div id="free-text-edit-form" class="wide-form-entry">
|
||||
{{ form.text_field }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-entry checkbox">
|
||||
<label for="id_printing">{% trans "Apparaître sur l'annuaire papier ?" %}</label>
|
||||
{{ form.printing }}
|
||||
</div>
|
||||
<div class="form-entry checkbox">
|
||||
<label for="id_keep_me">{% trans "Conserver la fiche annuaire ?" %}</label>
|
||||
{{ form.keep_me }}
|
||||
</div>
|
||||
<input type="submit" value="{% trans "Enregistrer" %}">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,20 +1,34 @@
|
|||
{% extends "fiches/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2> Chercher quelqu'un·e dans l'annuaire </h2>
|
||||
<form method='post' action="">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="submit" value="Recherche">
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
{% for profile in result %}
|
||||
<li><a href="{% url 'fiche' profile.user.username %}">{{profile.full_name}} ({{ profile.department.all|join:", " }} {{profile.promotion}})
|
||||
</a> </li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content" id="content-home">
|
||||
<h2>{% trans "Chercher quelqu'un·e dans l'annuaire" %}</h2>
|
||||
<form method='post' action="">
|
||||
{% csrf_token %}
|
||||
<label for="id_name">{% trans "Nom/Surnom :" %}</label>
|
||||
{{ form.name }}
|
||||
|
||||
{% endblock %}
|
||||
<label for="id_year">{% trans "Promotion :" %}</label>
|
||||
{{ form.year }}
|
||||
|
||||
<label for="id_department">{% trans "Department :" %}</label>
|
||||
{{ form.department }}
|
||||
<input type="submit" value="{% trans "Recherche" %}">
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
{% for profile in result %}
|
||||
<li>
|
||||
<a href="{% url 'fiche' profile.user.username %}">{{profile.full_name}} ({{ profile.department.all|join:", " }} {{profile.promotion}})</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Reference in a new issue