Plus lisible

This commit is contained in:
Evarin 2017-05-16 23:37:10 +02:00
parent bcb5d35dd1
commit 0255158352
8 changed files with 604 additions and 337 deletions

View file

@ -15,7 +15,7 @@ from taggit_autosuggest.managers import TaggableManager
from tinymce.models import HTMLField as RichTextField from tinymce.models import HTMLField as RichTextField
from .utils import choices_length from .utils import choices_length
from .statics import DEPARTEMENTS_DEFAUT, PAYS_OPTIONS, TYPE_LIEU_OPTIONS, TYPE_STAGE_OPTIONS, TYPE_LIEU_DICT, TYPE_STAGE_DICT, NIVEAU_SCOL_OPTIONS from .statics import DEPARTEMENTS_DEFAUT, PAYS_OPTIONS, TYPE_LIEU_OPTIONS, TYPE_STAGE_OPTIONS, TYPE_LIEU_DICT, TYPE_STAGE_DICT, NIVEAU_SCOL_OPTIONS, NIVEAU_SCOL_DICT
import ldap import ldap
@ -125,10 +125,11 @@ class Lieu(models.Model):
@property @property
def type_lieu_fancy(self): def type_lieu_fancy(self):
return TYPE_LIEU_DICT.get(self.type_lieu, ("lieu", False))[0] return TYPE_LIEU_DICT.get(self.type_lieu, ("lieu", False))[0]
@property @property
def type_lieu_fem(self): def type_lieu_fem(self):
return TYPE_LIEU_DICT.get(self.type_lieu, ("lieu", False))[1] return TYPE_LIEU_DICT.get(self.type_lieu, ("lieu", False))[1]
def __unicode__(self): def __unicode__(self):
return u"%s (%s)" % (self.nom, self.ville) return u"%s (%s)" % (self.nom, self.ville)
@ -207,7 +208,13 @@ class Stage(models.Model):
@property @property
def type_stage_fem(self): def type_stage_fem(self):
return TYPE_STAGE_DICT.get(self.type_stage, ("stage", False))[1] return TYPE_STAGE_DICT.get(self.type_stage, ("stage", False))[1]
# Niveau scolaire en plus joli
@property
def niveau_scol_fancy(self):
return NIVEAU_SCOL_DICT.get(self.niveau_scol, "")
def get_absolute_url(self): def get_absolute_url(self):
return reverse('avisstage:stage', self) return reverse('avisstage:stage', self)

View file

@ -10,4 +10,5 @@ $rouge: #f70978;
$textfont: 'Dosis', sans-serif; $textfont: 'Dosis', sans-serif;
$textfontsize: 19px; $textfontsize: 19px;
$headfont: Podkova, serif; $paragraphfont: 'Lato', sans-serif;
$headfont: Alegreya, serif;

View file

@ -1,6 +1,6 @@
@import "compass/reset"; @import "compass/reset";
@import "_definitions.scss"; @import "_definitions.scss";
@import url('https://fonts.googleapis.com/css?family=Dosis:300,500,700|Podkova:700'); @import url('https://fonts.googleapis.com/css?family=Dosis:300,500,700|Alegreya:700|Lato:300,300i,700');
// Général // Général
@ -19,6 +19,7 @@ body {
h1, h2, h3, h4 { h1, h2, h3, h4 {
font-family: $headfont; font-family: $headfont;
line-height: 1.2; line-height: 1.2;
font-weight: bold;
} }
h1 { h1 {
@ -190,7 +191,7 @@ header {
li { li {
display: block; display: block;
&.date-maj { &.date-maj {
font-weight: bold; font-weight: 300;
font-size: 0.9em; font-size: 0.9em;
padding: 3px 0; padding: 3px 0;
} }
@ -201,42 +202,64 @@ header {
h3 { h3 {
font-size: 1.4em; font-size: 1.4em;
padding-left: 5px;
& > a {
color: darken($vert, 20);
}
.auteur { .auteur {
font-family: $textfont;
font-weight: bold;
font-size: 0.8em; font-size: 0.8em;
&, a {
font-family: $textfont;
font-weight: normal;
}
} }
} }
ul.infos { ul.infos {
display:inline; display:inline;
} }
} }
.misc-hdr {
margin-bottom: 10px;
.dates {
& > span {
display: table-cell;
vertical-align: middle;
}
.year {
padding-left: 8px;
}
}
}
} }
} }
ul.infos { ul.infos {
margin: 0 -3px; margin: 0 -3px;
padding: 0;
li { li {
display: inline-block; display: inline-block;
padding: 5px; padding: 5px;
margin: 3px; margin: 3px;
font-weight: normal; font-weight: bold;
font-size: 0.9em; font-size: 0.9em;
border-radius: 4px; border-radius: 4px;
&.thematique { &.thematique {
background-color: $vert; color: darken($vert, 20);
color: #fff; background-color: lighten($vert, 20);
} }
&.matiere { &.matiere {
color: #fff; color: darken($fond, 20);
background-color: $fond; background-color: lighten($fond, 20);
} }
&.lieu { &.lieu {
color: #fff; color: darken($rouge, 20);
background-color: $compl; background-color: lighten($rouge, 20);
} }
} }
} }
@ -245,39 +268,44 @@ ul.infos {
// //
// Détail d'un stage // Détail d'un stage
article.stage .avis, div.tinymce {
ul, ol {
list-style: unset;
padding-left: 20px;
}
}
article.stage { article.stage {
font-weight: normal; font-weight: normal;
font-family: $paragraphfont;
h2 { h2 {
background: desaturate(lighten($jaune, 15%), 40%); background: desaturate(lighten($jaune, 15%), 40%);
color: #000; color: #000;
padding: 10px 20px; padding: 10px 20px;
margin: -20px; margin: -20px;
margin-bottom: 25px; margin-bottom: 5px;
text-shadow: -3px 3px 0 rgba(#fff, 0.3); text-shadow: -3px 3px 0 rgba(#fff, 0.3);
} }
h3 { h3 {
border-bottom: 2px solid desaturate($compl, 40%); //border-bottom: 2px solid desaturate($compl, 40%);
margin-left: -25px;
margin-top: 30px; margin-top: 30px;
padding: 5px; padding: 5px;
padding-left: 20px; padding-left: 0px;
color: #000; color: darken($vert, 20);
text-shadow: -3px 3px 0 rgba(#000, 0.1); text-shadow: -3px 3px 0 rgba($vert, 0.1);
//margin-right: 25px; //margin-right: 25px;
} }
#stage-map {
height: 300px;
width: 100%;
}
section { section {
background: #eee;
padding: 14px;
max-width: 600px;
margin: 30px auto;
&.avis section {
max-width: 700px;
background: #fff;
padding: 14px;
margin: 30px auto;
}
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
h3 { h3 {
@ -285,28 +313,61 @@ article.stage {
} }
} }
#stage-map {
height: 300px;
width: 100%;
}
&.misc { &.misc {
padding-top: 0; padding-top: 0;
margin-bottom: 30px;
.misc-content {
&.withmap {
display:table;
width: 100%;
& > div {
display:table-cell;
vertical-align: top;
}
.map {
min-width: 250px;
width: 30%;
min-height: 300px;
}
.desc {
padding: 5px;
padding-left: 15px;
}
}
}
} }
.chapo, .avis-texte { .chapo, .avis-texte {
margin-bottom: 15px; margin-bottom: 15px;
background: #fff; background: #fff;
padding: 20px; padding: 0 20px;
}
.chapo {
font-size: 1.1em;
font-weight: 500;
font-variant: small-caps;
} }
.avis-texte { .avis-texte {
border-left: 1px solid #ccc; font-size: $textfontsize - 1px;
}
.chapo {
font-size: 1.1em;
font-family: $textfont;
font-weight: 500;
padding-left: 0px;
}
.avis-texte {
//border-left: 1px solid #ccc;
padding-left: 15px; padding-left: 15px;
} }
.plusmoins { .plusmoins {
max-width: 600px; max-width: 600px;
margin: 15px auto; margin: 15px auto;
margin-top: 40px;
& > div { & > div {
display: table; display: table;
@ -314,7 +375,7 @@ article.stage {
&:before { &:before {
content: "&nbsp"; content: "&nbsp";
width: 100px; width: 90px;
font-size: 1.8em; font-size: 1.8em;
font-weight: bold; font-weight: bold;
text-align: right; text-align: right;
@ -356,59 +417,103 @@ article.stage {
background: darken($rouge, 5%); background: darken($rouge, 5%);
} }
&:before { &:before {
content: "Les -"; content: "Les ";
vertical-align: top; vertical-align: top;
color: darken($rouge, 10%); color: darken($rouge, 10%);
} }
} }
} }
} }
}
// Sommaire sur le côté // Sommaire sur le côté
.article-wrapper { .section-wrapper {
display: table; display: table;
margin-left: -15px; margin-left: -15px;
width: 100%;
.toc-wrapper, article {
display: table-cell;
vertical-align: top;
}
.toc-wrapper {
max-width: 250px;
width: 25%;
background: #f6f6f6;
padding: 5px;
}
.toc {
position: -webkit-sticky;
position: sticky;
top: 12px;
a { .toc-wrapper, & > section {
display: block; display: table-cell;
color: inherit; vertical-align: top;
font-weight: normal; }
border-radius: 7px; .toc-wrapper {
padding: 7px; max-width: 230px;
line-height: 1; width: 25%;
padding: 5px;
padding-right: 25px;
}
.toc {
font-family: $textfont;
position: -webkit-sticky;
position: sticky;
top: 12px;
margin-left: -40px;
background: #fff;
padding: 5px;
box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.2);
ul {
list-style: none;
padding: 0;
}
&:hover { a {
background-color: $fond; display: block;
color: inherit;
font-weight: normal;
border-radius: 7px;
padding: 5px;
line-height: 1;
&:hover {
color: $fond;
}
}
.toc-h1 a {
font-weight: 900;
}
.toc-h2 {
margin-top: 10px;
font-weight: 400;
}
.toc-h3 a {
font-weight: 300;
}
.toc-active a {
color: darken($vert, 20);
} }
} }
.toc-h1 a { }
font-weight: 900; }
.misc-hdr {
display:table;
width: 100%;
border-bottom: 1px solid #ccc;
& > * {
display: table-cell;
vertical-align: bottom;
}
h1 {
width: 100%;
}
.dates {
width: 50px;
background-color: darken($rouge, 20);
color: #fff;
padding: 3px 10px;
border-radius: 5px 5px 0 0;
font-family: $textfont;
font-size: 0.8em;
text-align: center;
span {
display:block;
} }
.toc-h2 { .year {
margin-top: 15px; font-size: 1.8em;
}
.toc-h3 a {
font-weight: 300;
}
.toc-active a {
background-color: lighten($fond, 30%);
} }
} }
} }
@ -520,6 +625,7 @@ h1 .btn {
} }
textarea, div.tinymce { textarea, div.tinymce {
font-family: $paragraphfont;
border:none; border:none;
border-left: 1px solid $fond; border-left: 1px solid $fond;
height: auto; height: auto;
@ -848,6 +954,7 @@ article.promo {
// FAQ // FAQ
.faq-toc { .faq-toc {
font-family: $paragraphfont;
display: block; display: block;
max-width: 700px; max-width: 700px;
margin: 0 auto; margin: 0 auto;
@ -876,8 +983,8 @@ article.promo {
} }
a:hover { a:hover {
color: #fff; color: darken($fond, 30);
background: $compl !important; background: lighten($fond, 20) !important;
} }
} }
} }
@ -888,14 +995,15 @@ article.promo {
background: #fff; background: #fff;
padding: 15px; padding: 15px;
h2 { h2 {
background: lighten($compl, 20%); background-color: lighten($compl, 20%);
color: darken($compl, 20%);
margin: -15px; margin: -15px;
padding: 15px; padding: 15px;
} }
h3 { h3 {
background: $vert; color: darken($vert, 20%);
color: #fff; background-color: lighten($vert, 30%);
margin: 0 -15px; margin: 0 -15px;
margin-top: 30px; margin-top: 30px;
padding: 10px 15px; padding: 10px 15px;
@ -912,8 +1020,12 @@ article.promo {
} }
} }
p { p, ul {
font-family: $paragraphfont;
font-size: $textfontsize - 1px;
max-width: 700px;
margin-left: auto;
margin-right: 5%;
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -64,6 +64,18 @@ NIVEAU_SCOL_OPTIONS = (
('', u"Autre"), ('', u"Autre"),
) )
NIVEAU_SCOL_DICT = {
"L3": u"pendant sa troisième année de Licence",
"M1": u"pendant sa première année de Master",
"M2": u"pendant sa deuxième année de Master",
"DOC": u"pendant son année de pré-doctorat",
"CST": u"pendant une année de césure",
"BLA": u"pendant une année blanche",
"VAC": u"pendant des vacances scolaires",
"MIT": u"à mi-temps en parallèle des études",
}
# Dictionnaire des noms de lieux (et de leur genre, True=féminin) # Dictionnaire des noms de lieux (et de leur genre, True=féminin)
TYPE_LIEU_DICT = { TYPE_LIEU_DICT = {
'universite': (u"université", True), 'universite': (u"université", True),

View file

@ -23,10 +23,13 @@
<ul class="stage-liste"> <ul class="stage-liste">
{% for stage in object.stages_publics %} {% for stage in object.stages_publics %}
{% ifchanged stage.date_maj.date %}<li class="date-maj">Mis à jour le {{ stage.date_maj.date }}</li>{% endifchanged %} {% ifchanged stage.date_maj.date %}<li class="date-maj">Mis à jour le {{ stage.date_maj.date }}</li>{% endifchanged %}
<li class="stage"><h3><a href="{% url "avisstage:stage" stage.id %}">{{ stage.sujet }}</a></h3> <li class="stage">
<div class="misc-hdr">
<h3><a href="{% url "avisstage:stage" stage.id %}">{{ stage.sujet }}</a><span class="auteur"></a></span></h3>
<p class="dates"><span class="detail"><span class="debut">{{ stage.date_debut|date:"d/m" }}</span><span class="fin">{{ stage.date_fin|date:"d/m" }}</span></span><span class="year">{{ stage.date_debut|date:"Y" }}</span></p>
</div>
<div> <div>
<ul class="infos"> <ul class="infos">
<li class="dates">Du {{ stage.date_debut }} au {{ stage.date_fin }}</li>
<li class="type">{{ stage.get_type_stage_display }}</li> <li class="type">{{ stage.get_type_stage_display }}</li>
<li class="structure">{{ stage.structure }}</li> <li class="structure">{{ stage.structure }}</li>
{% for lieu in stage.lieux.all %}<li class="lieu">{{ lieu.nom }}</li>{% endfor %} {% for lieu in stage.lieux.all %}<li class="lieu">{{ lieu.nom }}</li>{% endfor %}

View file

@ -39,65 +39,83 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>{{ object.sujet }}</h1>
{% if object.auteur == user.profil %} {% if object.auteur == user.profil %}
<div class="edit-box {{ object.public|yesno:"public,prive" }}"> <div class="edit-box {{ object.public|yesno:"public,prive" }}">
<p><a href="{% url "avisstage:stage_edit" object.id %}" class="edit-btn btn">Modifier cette expérience</a></p> <p><a href="{% url "avisstage:stage_edit" object.id %}" class="edit-btn btn">Modifier cette expérience</a></p>
<form action="{% url "avisstage:stage_publication" object.id %}" method="POST"> <form action="{% url "avisstage:stage_publication" object.id %}" method="POST">
{% csrf_token %} {% csrf_token %}
{% if object.public %} {% if object.public %}
<p>Cette page est visible publiquement. <input type="submit" value="Masquer ce stage" name="depublier" /></p> <p>Cette page est visible par les autres utilisateurs. <input type="submit" value="Masquer ce stage" name="depublier" /></p>
{% else %} {% else %}
<p>Cette page n'est qu'un brouillon, vous seul pouvez le voir. <input type="submit" value="Publier ce stage" name="publier" /></p> <p>Cette page n'est qu'un brouillon, vous seul pouvez le voir. <input type="submit" value="Publier ce stage" name="publier" /></p>
{% endif %} {% endif %}
</form> </form>
</div> </div>
{% endif %} {% endif %}
<div class="article-wrapper"> <article class="stage">
<div class="toc-wrapper"> <section class="misc">
<div class="toc"> <div class="misc-content {% if object.lieux.all %}withmap{% endif %}">
</div>
</div>
<article class="stage">
<section class="misc">
<h3>À propos de cette expérience</h3>
{% if object.lieux.all %} {% if object.lieux.all %}
<div id="stage-map"></div> <div class="map">
<script type="text/javascript"> <div id="stage-map"></div>
var lieux = [ <script type="text/javascript">
{% for lieu in object.lieux.all %} var lieux = [
{ {% for lieu in object.lieux.all %}
coord: {lat: "{{ lieu.coord.y|escapejs }}", lon: "{{ lieu.coord.x|escapejs }}" }, {
popup: "<h3>{{ lieu.nom|escapejs }}</h3>" + coord: {lat: "{{ lieu.coord.y|escapejs }}", lon: "{{ lieu.coord.x|escapejs }}" },
"<p>{{ lieu.get_type_lieu_display|escapejs }}</p>" + popup: "<h3>{{ lieu.nom|escapejs }}</h3>" +
"<p>{{ lieu.ville|escapejs }}, {{ lieu.get_pays_display|escapejs }}</p>" "<p>{{ lieu.get_type_lieu_display|escapejs }}</p>" +
}{% if not forloop.last %},{% endif %} "<p>{{ lieu.ville|escapejs }}, {{ lieu.get_pays_display|escapejs }}</p>"
{% endfor %} }{% if not forloop.last %},{% endif %}
]; {% endfor %}
$(function(){ ];
initStageMap(lieux); $(function(){
}); initStageMap(lieux);
</script> });
</script>
</div>
{% endif %} {% endif %}
<p><a href="{% url "avisstage:profil" object.auteur.user.username %}">{{ object.auteur.nom }}</a> <div class="desc">
<div class="misc-hdr">
<h1>{{ object.sujet }}</h1>
<p class="dates"><span class="year">{{ object.date_debut|date:"Y" }}</span><span class="debut">{{ object.date_debut|date:"d/m" }}</span><span class="fin">{{ object.date_fin|date:"d/m" }}</span></p>
</div>
<p><a href="{% url "avisstage:profil" object.auteur.user.username %}">{{ object.auteur.nom }}</a>
a fait {{ object.type_stage_fem|yesno:"cette,ce" }} <b>{{ object.type_stage_fancy }}</b> a fait {{ object.type_stage_fem|yesno:"cette,ce" }} <b>{{ object.type_stage_fancy }}</b>
{% if object.niveau_scol %} pendant son année de {{ object.get_niveau_scol_display }}, {% endif %} {% if object.niveau_scol %}{{ object.niveau_scol_fancy }},{% endif %}
du {{ object.date_debut }} au {{ object.date_fin }}{% if object.structure %}, au sein de {{ object.structure }}{% endif %}{% if object.encadrants %}, supervisé par {{ object.encadrants }}{% endif %}.</p> {% if object.structure %}au sein de {{ object.structure }}{% endif %}{% if object.encadrants %}, supervisé par {{ object.encadrants }}{% endif %}.</p>
<ul class="infos"> {% if object.lieux.all %}<p>Cela s'est passé à :
{% for matiere in object.matieres.all %} {% for lieu in object.lieux.all %}{{ lieu.nom }} ({{ lieu.ville }}){% if not forloop.last %}, {% endif %}{% endfor %}.</p>
<li class="matiere">{{ matiere.nom }}</li> {% endif %}
{% endfor %}
{% for thematique in object.thematiques.all %} <ul class="infos">
<li class="thematique">{{ thematique.name }}</li> {% for matiere in object.matieres.all %}
{% endfor %} <li class="matiere">{{ matiere.nom }}</li>
</ul> {% endfor %}
{% for thematique in object.thematiques.all %}
<li class="thematique">{{ thematique.name }}</li>
{% endfor %}
</ul>
</div>
</div>
</section>
<div class="section-wrapper">
<div class="toc-wrapper">
<div class="toc">
</div>
</div>
<section class="avis">
{% include "avisstage/detail/avis.html" with avis=object.avis_stage titre="Avis sur le travail" %}
{% for avis in object.avislieu_set.all %}
{% include "avisstage/detail/avis.html" with avis=avis titre=avis.lieu %}
{% endfor %}
</section> </section>
</div>
{% include "avisstage/detail/avis.html" with avis=object.avis_stage titre="Avis sur le travail" %} </article>
{% for avis in object.avislieu_set.all %}
{% include "avisstage/detail/avis.html" with avis=avis titre=avis.lieu %}
{% endfor %}
</article>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -9,10 +9,13 @@
<ul class="stage-liste"> <ul class="stage-liste">
{% for stage in object_list %} {% for stage in object_list %}
{% ifchanged stage.date_maj.date %}<li class="date-maj">Mis à jour le {{ stage.date_maj.date }}</li>{% endifchanged %} {% ifchanged stage.date_maj.date %}<li class="date-maj">Mis à jour le {{ stage.date_maj.date }}</li>{% endifchanged %}
<li class="stage"><h3><a href="{% url "avisstage:stage" stage.id %}">{{ stage.sujet }}</a><span class="auteur"> par <a href="{% url "avisstage:profil" stage.auteur.user.username %}">{{ stage.auteur.nom }}</a></h3> <li class="stage">
<div class="misc-hdr">
<h3><a href="{% url "avisstage:stage" stage.id %}">{{ stage.sujet }}</a><span class="auteur"> par <a href="{% url "avisstage:profil" stage.auteur.user.username %}">{{ stage.auteur.nom }}</a></span></h3>
<p class="dates"><span class="detail"><span class="debut">{{ stage.date_debut|date:"d/m" }}</span><span class="fin">{{ stage.date_fin|date:"d/m" }}</span></span><span class="year">{{ stage.date_debut|date:"Y" }}</span></p>
</div>
<div> <div>
<ul class="infos"> <ul class="infos">
<li class="dates">Du {{ stage.date_debut }} au {{ stage.date_fin }}</li>
<li class="type">{{ stage.get_type_stage_display }}</li> <li class="type">{{ stage.get_type_stage_display }}</li>
<li class="structure">{{ stage.structure }}</li> <li class="structure">{{ stage.structure }}</li>
{% for lieu in stage.lieux.all %}<li class="lieu">{{ lieu.nom }}</li>{% endfor %} {% for lieu in stage.lieux.all %}<li class="lieu">{{ lieu.nom }}</li>{% endfor %}