Merge branch 'thubrecht/multiline' into 'master'

Thubrecht/multiline

See merge request klub-dev-ens/annuaire!16
This commit is contained in:
Martin Pepin 2021-02-04 23:46:01 +01:00
commit 9d78764e06
9 changed files with 206 additions and 67 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.17 on 2021-01-28 00:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fiches', '0008_auto_20201113_1038'),
]
operations = [
migrations.AlterField(
model_name='address',
name='content',
field=models.TextField(verbose_name='adresse'),
),
]

View file

@ -0,0 +1,23 @@
# Generated by Django 2.2.17 on 2021-01-28 10:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fiches', '0009_multiline_address'),
]
operations = [
migrations.AddField(
model_name='profile',
name='experiences',
field=models.TextField(blank=True, verbose_name='expériences'),
),
migrations.AddField(
model_name='profile',
name='past_studies',
field=models.TextField(blank=True, verbose_name='études passées'),
),
]

View file

@ -26,6 +26,8 @@ class Profile(models.Model):
birth_date = models.DateField(
blank=True, null=True, verbose_name=_("date de naissance")
)
past_studies = models.TextField(blank=True, verbose_name=_("études passées"))
experiences = models.TextField(blank=True, verbose_name=_("expériences"))
thurne = models.CharField(blank=True, max_length=100, verbose_name=_("thurne"))
text_field = models.TextField(blank=True, verbose_name=_("champ libre"))
printing = models.BooleanField(
@ -89,7 +91,7 @@ class Address(models.Model):
Profile, on_delete=models.CASCADE, verbose_name=_("profil")
)
name = models.CharField(max_length=255, verbose_name=_("type"))
content = models.CharField(max_length=1023, verbose_name=_("adresse"))
content = models.TextField(verbose_name=_("adresse"))
def __str__(self):
return "{} : {}".format(self.name, self.content)

View file

@ -367,16 +367,23 @@ body {
}
#content-view-profile .infos > *.multi-entry ul.value li {
padding: 0;
display: grid;
grid-template-areas: "type value";
}
#content-view-profile .infos > *.multi-entry ul.value li .type {
display: inline-block;
margin: 0 1em 0 0;
color: #DFDFDF;
font-style: italic;
grid-area: type;
}
#content-view-profile .infos > *.multi-entry ul.value li .value {
display: inline-block;
float: right;
grid-area: value;
text-align: right;
}
#content-view-profile .infos > *.multi-entry ul.value li:not(:last-child) {
margin-bottom: 10px;
}
#content-view-profile .free-text {
grid-area: free-text;
@ -426,19 +433,27 @@ body {
grid-template-areas: "errors errors errors" "type-input value-input remove-button";
column-gap: 10px;
margin: 0 0 10px 0;
align-items: center;
}
#content-edit-profile form .form-sub-entry.hidden {
display: none;
}
#content-edit-profile form .form-sub-entry input:nth-child(1) {
grid-area: type-input;
max-height: 30px;
}
#content-edit-profile form .form-sub-entry input:nth-child(2) {
grid-area: value-input;
}
#content-edit-profile form .form-sub-entry textarea:nth-child(2) {
grid-area: value-input;
max-height: 35px;
resize: none;
}
#content-edit-profile form .form-sub-entry .remove-button {
grid-area: remove-button;
min-height: 30px;
max-height: 30px;
min-width: 30px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>');
background-size: 80%;
@ -490,6 +505,7 @@ body {
#content-edit-profile #free-text-edit-form textarea {
width: 100%;
padding: 5px;
resize: none;
}
#content-edit-profile #photo-edit-form .current-photo {
margin: 0 0 20px 0;

View file

@ -3,7 +3,7 @@
@use "errors";
#content-area {
color: colors.$content-text;
color: colors.$content-text;
}
.content {
@ -21,7 +21,7 @@
input {
min-height: 30px;
padding: 5px;
border: none;
border: none;
border-radius: 0;
}
@ -39,7 +39,7 @@
margin: 0 auto;
grid-template-columns: 150px 250px;
gap: 20px;
label {
grid-column: 1;
margin: 5px 0 0 0;
@ -74,7 +74,7 @@
// input[type="checkbox"] {
// display: inline;
// width: 1rem;
// float: right;
// float: right;
// }
}
}
@ -111,7 +111,7 @@
text-align: center;
}
}
.photo {
height: 150px;
margin: 0 20px 0 0;
@ -143,7 +143,7 @@
padding: 10px;
background-color: colors.$content-frame-background;
box-shadow: 2px 2px 0 colors.$shadow;
&.multi-entry ul.value {
margin: 0;
padding: 0;
@ -151,19 +151,29 @@
li {
padding: 0;
display: grid;
grid-template-areas: "type value";
.type {
display: inline-block;
margin: 0 1em 0 0;
color: colors.$page-text-secondary;
font-style: italic;
grid-area: type;
}
.value {
display: inline-block;
float: right;
grid-area: value;
text-align: right;
}
&:not(:last-child) {
margin-bottom: 10px;
}
}
}
}
}
@ -195,11 +205,11 @@
padding: 10px;
background-color: colors.$content-frame-background;
box-shadow: 2px 2px 0 colors.$shadow;
> * {
display: block;
}
label {
margin: 0 0 5px 0;
color: colors.$page-text-emph;
@ -207,7 +217,7 @@
font-style: italic;
text-align: left;
}
input, select {
width: 100%;
}
@ -229,6 +239,7 @@
"type-input value-input remove-button";
column-gap: 10px;
margin: 0 0 10px 0;
align-items: center;
&.hidden {
display: none;
@ -237,12 +248,21 @@
// Since the different labels and inputs are not obvious to identifiate using CSS selectors,
// they are selected one after the other using their natural order in the DOM
// TODO: make this more robust by giving proper class names to each sub-entry element
input:nth-child(1) { grid-area: type-input; }
input:nth-child(1) {
grid-area: type-input;
max-height: 30px;
}
input:nth-child(2) { grid-area: value-input; }
textarea:nth-child(2) {
grid-area: value-input;
max-height: 35px;
resize: none;
}
.remove-button {
grid-area: remove-button;
min-height: 30px;
max-height: 30px;
min-width: 30px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="18px" height="18px"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>');
background-size: 80%;
@ -261,14 +281,14 @@
&.erroneous {
@extend %error-list-container;
// TODO: this is not robust and should be replaced by better selectors
// In case of error, increment the child indices
// In case of error, increment the child indices
// to take the additional list of errors (.errorlist)
// prepended by Django to the sub-entry
input:nth-child(2) { grid-area: type-input; }
input:nth-child(3) { grid-area: value-input; }
// Use a darker red color when the sub-entry background is already red
.remove-button:hover,
.remove-button:active {
@ -281,7 +301,7 @@
grid-area: errors;
}
}
.form-sub-entry-template {
display: none;
}
@ -289,7 +309,7 @@
.add-sub-entry-button {
margin: 0 auto 0 auto;
}
.form-entry.checkbox {
> * {
display: inline;
@ -310,7 +330,7 @@
input[type="checkbox"] {
display: block;
width: auto;
float: right;
float: right;
}
}
}
@ -319,6 +339,7 @@
textarea {
width: 100%;
padding: 5px;
resize: none;
}
}
@ -355,7 +376,7 @@
// input[type="checkbox"] {
// display: inline-block;
// width: 1rem;
// float: right;
// float: right;
// }
input[type="file"] {
@ -363,4 +384,4 @@
}
}
}
}
}

View file

@ -27,6 +27,7 @@
<span class="value">{{ profile.pronoun }}</span>
</div>
{% endif %}
{% if profile.department.exists %}
<div class="department">
<span class="label">{% trans "Département" %}{{ profile.department.count|pluralize }}</span>
@ -34,6 +35,7 @@
<span class="value">{% for dep in profile.department.all %}{{ dep }}{% if not forloop.last %}, {% endif %}{% endfor %}</span>
</div>
{% endif %}
{% if profile.birth_date %}
<div class="birthdate">
<span class="label">{% trans "Date de naissance" %}</span>
@ -41,6 +43,7 @@
<span class="value">{{ profile.birth_date }}</span>
</div>
{% endif %}
{% if profile.thurne %}
<div class="room">
<span class="label">{% trans "Thurne" %}</span>
@ -48,50 +51,70 @@
<span class="value">{{ profile.thurne }}</span>
</div>
{% endif %}
{% if profile.phone_set.exists %}
<div class="phone multi-entry">
<span class="label">{% trans "Téléphone" %}{{ profile.phone_set.count|pluralize }}</span>
<span class="separator"></span>
<ul class="value">
{% for p in profile.phone_set.all %}
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.number }}</span></li>
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.number }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if profile.social_set.exists %}
<div class="social multi-entry">
<span class="label">{{ profile.social_set.count|pluralize:_("Réseau social,Réseaux sociaux") }}</span>
<span class="separator"></span>
<ul class="value">
{% for p in profile.social_set.all %}
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.content }}</span></li>
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.content }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if profile.mail_set.exists %}
<div class="mail multi-entry">
<span class="label">{{ profile.mail_set.count|pluralize:_("Mail,Mails") }}</span>
<span class="separator"></span>
<ul class="value">
{% for p in profile.mail_set.all %}
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.mail }}</span></li>
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.mail }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if profile.address_set.exists %}
<div class="address multi-entry">
<span class="label">{{ profile.address_set.count|pluralize:_("Adresse,Adresses") }}</span>
<span class="separator"></span>
<ul class="value">
{% for p in profile.address_set.all %}
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.content }}</span></li>
<li><span class="type">{{ p.name }}</span><span class="value">{{ p.content|linebreaksbr }}</span></li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if profile.past_studies %}
<div class="studies">
<span class="label">{% trans "Études passées" %}</span>
<span class="separator"></span>
<span class="value">{{ profile.past_studies }}</span>
</div>
{% endif %}
{% if profile.experiences %}
<div class="studies">
<span class="label">{% trans "Expériences passées" %}</span>
<span class="separator"></span>
<span class="value">{{ profile.experiences }}</span>
</div>
{% endif %}
</div>
{% if profile.text_field %}

View file

@ -55,6 +55,18 @@
<label for="id_promotion">{% trans "Promotion :" %}</label>
{{ form.promotion }}
</div>
<div class="form-entry">
<label for="id_past_studies">{% trans "Études passées :" %}</label>
<div id="free-text-edit-form" class="wide-form-entry">
{{ form.past_studies }}
</div>
</div>
<div class="form-entry">
<label for="id_experiences">{% trans "Expériences :" %}</label>
<div id="free-text-edit-form" class="wide-form-entry">
{{ form.experiences }}
</div>
</div>
<div class="form-entry">
<label for="id_birth_date">{% trans "Date de naissance :" %}</label>
{{ form.birth_date }}

Binary file not shown.

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-28 00:03+0000\n"
"PO-Revision-Date: 2021-02-04 21:15+0100\n"
"PO-Revision-Date: 2021-02-04 21:28+0100\n"
"Last-Translator: Tom Hubrecht <tom.hubrecht@ens.fr>\n"
"Language-Team: \n"
"Language: en\n"
@ -63,48 +63,56 @@ msgid "date de naissance"
msgstr "birth date"
#: fiches/models.py:29
msgid "études passées"
msgstr "past studies"
#: fiches/models.py:30
msgid "expériences"
msgstr "experiences"
#: fiches/models.py:31
msgid "thurne"
msgstr "room"
#: fiches/models.py:30
#: fiches/models.py:32
msgid "champ libre"
msgstr "free space"
#: fiches/models.py:32
#: fiches/models.py:34
msgid "apparaître sur l'annuaire papier ?"
msgstr "appear on the paper directory?"
#: fiches/models.py:35
#: fiches/models.py:37
msgid "conserver la fiche annuaire ?"
msgstr "keep the directory record?"
#: fiches/models.py:47
#: fiches/models.py:49
msgid "nom du département"
msgstr "department name"
#: fiches/models.py:56 fiches/models.py:67 fiches/models.py:78
#: fiches/models.py:89
#: fiches/models.py:58 fiches/models.py:69 fiches/models.py:80
#: fiches/models.py:91
msgid "profil"
msgstr "profile"
#: fiches/models.py:58 fiches/models.py:69 fiches/models.py:80
#: fiches/models.py:91
#: fiches/models.py:60 fiches/models.py:71 fiches/models.py:82
#: fiches/models.py:93
msgid "type"
msgstr "type"
#: fiches/models.py:59
#: fiches/models.py:61
msgid "numéro"
msgstr "number"
#: fiches/models.py:70
#: fiches/models.py:72
msgid "contenu"
msgstr "content"
#: fiches/models.py:81
#: fiches/models.py:83
msgid "adresse mail"
msgstr "e-mail"
#: fiches/models.py:92
#: fiches/models.py:94
msgid "adresse"
msgstr "address"
@ -173,35 +181,43 @@ msgstr "years"
msgid "Pronom(s) utilisé(s)"
msgstr "Pronoun(s)"
#: fiches/templates/fiches/fiche.html:32
#: fiches/templates/fiches/fiche.html:33
msgid "Département"
msgstr "Department"
#: fiches/templates/fiches/fiche.html:39
#: fiches/templates/fiches/fiche.html:41
msgid "Date de naissance"
msgstr "Birth date"
#: fiches/templates/fiches/fiche.html:46
#: fiches/templates/fiches/fiche.html:49
msgid "Thurne"
msgstr "Room"
#: fiches/templates/fiches/fiche.html:53
#: fiches/templates/fiches/fiche.html:57
msgid "Téléphone"
msgstr "Phone number"
#: fiches/templates/fiches/fiche.html:64
#: fiches/templates/fiches/fiche.html:69
msgid "Réseau social,Réseaux sociaux"
msgstr "Social network,Social networks"
#: fiches/templates/fiches/fiche.html:75
#: fiches/templates/fiches/fiche.html:81
msgid "Mail,Mails"
msgstr "E-mail,E-mails"
#: fiches/templates/fiches/fiche.html:86
#: fiches/templates/fiches/fiche.html:93
msgid "Adresse,Adresses"
msgstr "Address,Addresses"
#: fiches/templates/fiches/fiche.html:99
#: fiches/templates/fiches/fiche.html:105
msgid "Études passées"
msgstr "Past studies"
#: fiches/templates/fiches/fiche.html:113
msgid "Expériences passées"
msgstr "Experiences"
#: fiches/templates/fiches/fiche.html:122
msgid "Champ libre"
msgstr "Free space"
@ -243,90 +259,98 @@ msgid "Promotion :"
msgstr "Entry year:"
#: fiches/templates/fiches/fiches_modif.html:59
msgid "Études passées :"
msgstr "Past studies:"
#: fiches/templates/fiches/fiches_modif.html:65
msgid "Expériences :"
msgstr "Experiences:"
#: fiches/templates/fiches/fiches_modif.html:71
msgid "Date de naissance :"
msgstr "Birth date:"
#: fiches/templates/fiches/fiches_modif.html:63
#: fiches/templates/fiches/fiches_modif.html:75
msgid "Thurne :"
msgstr "Room :"
#: fiches/templates/fiches/fiches_modif.html:66
#: fiches/templates/fiches/fiches_modif.html:78
msgid "Personnel"
msgstr "Private"
#: fiches/templates/fiches/fiches_modif.html:66
#: fiches/templates/fiches/fiches_modif.html:78
msgid "0612345678"
msgstr "0612345678"
#: fiches/templates/fiches/fiches_modif.html:67
#: fiches/templates/fiches/fiches_modif.html:79
msgid "Numéro(s) de téléphone :"
msgstr "Phone number(s):"
#: fiches/templates/fiches/fiches_modif.html:68
#: fiches/templates/fiches/fiches_modif.html:80
msgid "Ajouter un numéro"
msgstr "Add a phone number"
#: fiches/templates/fiches/fiches_modif.html:71
#: fiches/templates/fiches/fiches_modif.html:83
msgid "InstaTok"
msgstr "InstaTok"
#: fiches/templates/fiches/fiches_modif.html:71
#: fiches/templates/fiches/fiches_modif.html:83
msgid "mon_profil_instatok"
msgstr "my_instatok_profile"
#: fiches/templates/fiches/fiches_modif.html:72
#: fiches/templates/fiches/fiches_modif.html:84
msgid "Réseaux sociaux :"
msgstr "Social networks:"
#: fiches/templates/fiches/fiches_modif.html:73
#: fiches/templates/fiches/fiches_modif.html:85
msgid "Ajouter un réseau social"
msgstr "Add a social network"
#: fiches/templates/fiches/fiches_modif.html:76
#: fiches/templates/fiches/fiches_modif.html:88
msgid "Professionelle"
msgstr "Professional"
#: fiches/templates/fiches/fiches_modif.html:76
#: fiches/templates/fiches/fiches_modif.html:88
msgid "moi@ens.fr"
msgstr "me@ens.fr"
#: fiches/templates/fiches/fiches_modif.html:77
#: fiches/templates/fiches/fiches_modif.html:89
msgid "Mail(s) :"
msgstr "E-mail(s):"
#: fiches/templates/fiches/fiches_modif.html:78
#: fiches/templates/fiches/fiches_modif.html:90
msgid "Ajouter un email"
msgstr "Add an e-mail"
#: fiches/templates/fiches/fiches_modif.html:81
#: fiches/templates/fiches/fiches_modif.html:93
msgid "Bureau"
msgstr "Office"
#: fiches/templates/fiches/fiches_modif.html:81
#: fiches/templates/fiches/fiches_modif.html:93
msgid "45 rue d'Ulm"
msgstr "45 rue d'Ulm"
#: fiches/templates/fiches/fiches_modif.html:82
#: fiches/templates/fiches/fiches_modif.html:94
msgid "Adresse(s) :"
msgstr "Address(es):"
#: fiches/templates/fiches/fiches_modif.html:83
#: fiches/templates/fiches/fiches_modif.html:95
msgid "Ajouter une adresse"
msgstr "Add an address"
#: fiches/templates/fiches/fiches_modif.html:87
#: fiches/templates/fiches/fiches_modif.html:99
msgid "Champ libre :"
msgstr "Free space:"
#: fiches/templates/fiches/fiches_modif.html:93
#: fiches/templates/fiches/fiches_modif.html:105
msgid "Apparaître sur l'annuaire papier ?"
msgstr "Appear on the paper directory?"
#: fiches/templates/fiches/fiches_modif.html:97
#: fiches/templates/fiches/fiches_modif.html:109
msgid "Conserver la fiche annuaire ?"
msgstr "Keep the directory record?"
#: fiches/templates/fiches/fiches_modif.html:100
#: fiches/templates/fiches/fiches_modif.html:112
msgid "Enregistrer"
msgstr "Save"