Derniers réglages avant production
This commit is contained in:
parent
be57b976d2
commit
b77a45a56a
5 changed files with 164 additions and 51 deletions
|
@ -8,6 +8,8 @@ from tastypie.authentication import SessionAuthentication
|
||||||
from django.contrib.gis import geos
|
from django.contrib.gis import geos
|
||||||
from tastypie import fields, utils
|
from tastypie import fields, utils
|
||||||
|
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
class LieuResource(ModelResource):
|
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)
|
||||||
|
|
||||||
|
@ -76,6 +78,7 @@ class StageResource(ModelResource):
|
||||||
bundle.data['auteur'] = obj.auteur.nom
|
bundle.data['auteur'] = obj.auteur.nom
|
||||||
bundle.data['thematiques'] = list(obj.thematiques.all().values_list("name", flat=True))
|
bundle.data['thematiques'] = list(obj.thematiques.all().values_list("name", flat=True))
|
||||||
bundle.data['matieres'] = list(obj.matieres.all().values_list("nom", flat=True))
|
bundle.data['matieres'] = list(obj.matieres.all().values_list("nom", flat=True))
|
||||||
|
bundle.data['url'] = reverse("avisstage:stage", kwargs={"pk": obj.id});
|
||||||
return bundle
|
return bundle
|
||||||
|
|
||||||
class AuteurResource(ModelResource):
|
class AuteurResource(ModelResource):
|
||||||
|
|
|
@ -381,7 +381,8 @@ input[type='text'], input[type='password'], input[type='email'], textarea, selec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="submit"] {
|
input[type="submit"],
|
||||||
|
.btn {
|
||||||
background-color: $fond;
|
background-color: $fond;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border: 1px solid $fond * 0.7;
|
border: 1px solid $fond * 0.7;
|
||||||
|
@ -392,7 +393,8 @@ input[type="submit"] {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p input[type="submit"] {
|
p input[type="submit"],
|
||||||
|
p .btn {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,3 +629,37 @@ a.lieu-change {
|
||||||
transform: rotateZ(90deg);
|
transform: rotateZ(90deg);
|
||||||
transform-origin: bottom left;
|
transform-origin: bottom left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.betacadre {
|
||||||
|
background: lighten($rouge, 20%);
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entrer {
|
||||||
|
background: #fff;
|
||||||
|
max-width: 500px;
|
||||||
|
padding: 15px;
|
||||||
|
text-align: center;
|
||||||
|
margin: 15px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
article.promo {
|
||||||
|
display:block;
|
||||||
|
font-size: 1.1em;
|
||||||
|
|
||||||
|
.explications {
|
||||||
|
display:table;
|
||||||
|
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
display:table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 15px 15px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -448,7 +448,8 @@ input[type='text']:focus, input[type='password']:focus, input[type='email']:focu
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 384, ../../sass/screen.scss */
|
/* line 384, ../../sass/screen.scss */
|
||||||
input[type="submit"] {
|
input[type="submit"],
|
||||||
|
.btn {
|
||||||
background-color: #8fcc33;
|
background-color: #8fcc33;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border: 1px solid #648f24;
|
border: 1px solid #648f24;
|
||||||
|
@ -459,12 +460,13 @@ input[type="submit"] {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 395, ../../sass/screen.scss */
|
/* line 396, ../../sass/screen.scss */
|
||||||
p input[type="submit"] {
|
p input[type="submit"],
|
||||||
|
p .btn {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 400, ../../sass/screen.scss */
|
/* line 402, ../../sass/screen.scss */
|
||||||
select {
|
select {
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
|
@ -473,7 +475,7 @@ select {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 408, ../../sass/screen.scss */
|
/* line 410, ../../sass/screen.scss */
|
||||||
textarea, div.tinymce {
|
textarea, div.tinymce {
|
||||||
border: none;
|
border: none;
|
||||||
border-left: 1px solid #8fcc33;
|
border-left: 1px solid #8fcc33;
|
||||||
|
@ -482,26 +484,26 @@ textarea, div.tinymce {
|
||||||
transition: border 1s ease-out, background 1s ease-out;
|
transition: border 1s ease-out, background 1s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 416, ../../sass/screen.scss */
|
/* line 418, ../../sass/screen.scss */
|
||||||
div.tinymce.mce-edit-focus {
|
div.tinymce.mce-edit-focus {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 421, ../../sass/screen.scss */
|
/* line 423, ../../sass/screen.scss */
|
||||||
textarea {
|
textarea {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
resize: vertical;
|
resize: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 427, ../../sass/screen.scss */
|
/* line 429, ../../sass/screen.scss */
|
||||||
form .field {
|
form .field {
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
/* line 433, ../../sass/screen.scss */
|
/* line 435, ../../sass/screen.scss */
|
||||||
form .field label, form .field .label {
|
form .field label, form .field .label {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 250px;
|
width: 250px;
|
||||||
|
@ -510,33 +512,33 @@ form .field label, form .field .label {
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
/* line 441, ../../sass/screen.scss */
|
/* line 443, ../../sass/screen.scss */
|
||||||
form .field label {
|
form .field label {
|
||||||
font-family: Podkova, serif;
|
font-family: Podkova, serif;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
/* line 445, ../../sass/screen.scss */
|
/* line 447, ../../sass/screen.scss */
|
||||||
form .field .help_text {
|
form .field .help_text {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
/* line 449, ../../sass/screen.scss */
|
/* line 451, ../../sass/screen.scss */
|
||||||
form .field .input {
|
form .field .input {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 458, ../../sass/screen.scss */
|
/* line 460, ../../sass/screen.scss */
|
||||||
ul.as-selections {
|
ul.as-selections {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
/* line 462, ../../sass/screen.scss */
|
/* line 464, ../../sass/screen.scss */
|
||||||
ul.as-selections li {
|
ul.as-selections li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
/* line 466, ../../sass/screen.scss */
|
/* line 468, ../../sass/screen.scss */
|
||||||
ul.as-selections .as-selection-item {
|
ul.as-selections .as-selection-item {
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
background: #f99b20;
|
background: #f99b20;
|
||||||
|
@ -545,57 +547,57 @@ ul.as-selections .as-selection-item {
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
/* line 474, ../../sass/screen.scss */
|
/* line 476, ../../sass/screen.scss */
|
||||||
ul.as-selections .as-selection-item a.as-close {
|
ul.as-selections .as-selection-item a.as-close {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
-webkit-cursor: pointer;
|
-webkit-cursor: pointer;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
/* line 481, ../../sass/screen.scss */
|
/* line 483, ../../sass/screen.scss */
|
||||||
ul.as-selections .as-selection-item.selected {
|
ul.as-selections .as-selection-item.selected {
|
||||||
background: #8fcc33;
|
background: #8fcc33;
|
||||||
}
|
}
|
||||||
/* line 486, ../../sass/screen.scss */
|
/* line 488, ../../sass/screen.scss */
|
||||||
ul.as-selections .as-original {
|
ul.as-selections .as-original {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
/* line 490, ../../sass/screen.scss */
|
/* line 492, ../../sass/screen.scss */
|
||||||
ul.as-selections .as-original input {
|
ul.as-selections .as-original input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 496, ../../sass/screen.scss */
|
/* line 498, ../../sass/screen.scss */
|
||||||
div.as-results {
|
div.as-results {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
/* line 498, ../../sass/screen.scss */
|
/* line 500, ../../sass/screen.scss */
|
||||||
div.as-results ul {
|
div.as-results ul {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid #d2ebad;
|
border: 1px solid #d2ebad;
|
||||||
}
|
}
|
||||||
/* line 505, ../../sass/screen.scss */
|
/* line 507, ../../sass/screen.scss */
|
||||||
div.as-results ul li {
|
div.as-results ul li {
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
}
|
}
|
||||||
/* line 511, ../../sass/screen.scss */
|
/* line 513, ../../sass/screen.scss */
|
||||||
div.as-results ul li.as-result-item.active {
|
div.as-results ul li.as-result-item.active {
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
/* line 516, ../../sass/screen.scss */
|
/* line 518, ../../sass/screen.scss */
|
||||||
div.as-results ul li.as-message {
|
div.as-results ul li.as-message {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 523, ../../sass/screen.scss */
|
/* line 525, ../../sass/screen.scss */
|
||||||
#map_addlieu {
|
#map_addlieu {
|
||||||
height: 500px;
|
height: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 527, ../../sass/screen.scss */
|
/* line 529, ../../sass/screen.scss */
|
||||||
.window {
|
.window {
|
||||||
display: none;
|
display: none;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -606,11 +608,11 @@ div.as-results ul li.as-message {
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
/* line 537, ../../sass/screen.scss */
|
/* line 539, ../../sass/screen.scss */
|
||||||
.window.visible {
|
.window.visible {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
/* line 541, ../../sass/screen.scss */
|
/* line 543, ../../sass/screen.scss */
|
||||||
.window .window-bg {
|
.window .window-bg {
|
||||||
background: #000;
|
background: #000;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
|
@ -621,7 +623,7 @@ div.as-results ul li.as-message {
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
/* line 552, ../../sass/screen.scss */
|
/* line 554, ../../sass/screen.scss */
|
||||||
.window .window-content {
|
.window .window-content {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -635,7 +637,7 @@ div.as-results ul li.as-message {
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
/* line 567, ../../sass/screen.scss */
|
/* line 569, ../../sass/screen.scss */
|
||||||
.window .window-closer {
|
.window .window-closer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -643,31 +645,31 @@ div.as-results ul li.as-message {
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
/* line 573, ../../sass/screen.scss */
|
/* line 575, ../../sass/screen.scss */
|
||||||
.window .window-closer:after {
|
.window .window-closer:after {
|
||||||
content: "×";
|
content: "×";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 580, ../../sass/screen.scss */
|
/* line 582, ../../sass/screen.scss */
|
||||||
.lieu-ui .map {
|
.lieu-ui .map {
|
||||||
height: 400px;
|
height: 400px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
/* line 584, ../../sass/screen.scss */
|
/* line 586, ../../sass/screen.scss */
|
||||||
.lieu-ui .hidden {
|
.lieu-ui .hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
/* line 587, ../../sass/screen.scss */
|
/* line 589, ../../sass/screen.scss */
|
||||||
.lieu-ui .masked {
|
.lieu-ui .masked {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 592, ../../sass/screen.scss */
|
/* line 594, ../../sass/screen.scss */
|
||||||
#avis_lieu_vide {
|
#avis_lieu_vide {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 596, ../../sass/screen.scss */
|
/* line 598, ../../sass/screen.scss */
|
||||||
a.lieu-change {
|
a.lieu-change {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #f99b20;
|
background: #f99b20;
|
||||||
|
@ -680,19 +682,19 @@ a.lieu-change {
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin-right: 7px;
|
margin-right: 7px;
|
||||||
}
|
}
|
||||||
/* line 608, ../../sass/screen.scss */
|
/* line 610, ../../sass/screen.scss */
|
||||||
a.lieu-change.ajout:before {
|
a.lieu-change.ajout:before {
|
||||||
content: "+";
|
content: "+";
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 614, ../../sass/screen.scss */
|
/* line 616, ../../sass/screen.scss */
|
||||||
#stages-map {
|
#stages-map {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 600px;
|
height: 600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* line 619, ../../sass/screen.scss */
|
/* line 621, ../../sass/screen.scss */
|
||||||
#feedback-button {
|
#feedback-button {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
@ -704,3 +706,38 @@ a.lieu-change.ajout:before {
|
||||||
transform: rotateZ(90deg);
|
transform: rotateZ(90deg);
|
||||||
transform-origin: bottom left;
|
transform-origin: bottom left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* line 634, ../../sass/screen.scss */
|
||||||
|
.betacadre {
|
||||||
|
background: #fa6cae;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* line 639, ../../sass/screen.scss */
|
||||||
|
.entrer {
|
||||||
|
background: #fff;
|
||||||
|
max-width: 500px;
|
||||||
|
padding: 15px;
|
||||||
|
text-align: center;
|
||||||
|
margin: 15px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* line 647, ../../sass/screen.scss */
|
||||||
|
article.promo {
|
||||||
|
display: block;
|
||||||
|
font-size: 1.1em;
|
||||||
|
}
|
||||||
|
/* line 651, ../../sass/screen.scss */
|
||||||
|
article.promo .explications {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
/* line 655, ../../sass/screen.scss */
|
||||||
|
article.promo .explications > div {
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
/* line 660, ../../sass/screen.scss */
|
||||||
|
article.promo .explications > div p {
|
||||||
|
margin: 15px 15px;
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
Ce site est en cours de développement, et fait l'objet de mises à jours régulières. N'hésitez pas cependant à remplir une fiche pour vos stages, utiliser la recherche, et donner votre avis en utilisant le bouton "feedback".
|
Ce site est en cours de développement, et fait l'objet de mises à jours régulières. N'hésitez pas cependant à remplir une fiche pour vos stages, utiliser la recherche, et donner votre avis en utilisant le bouton "feedback".
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not request.user.is_authenticated %}
|
{% if not user.is_authenticated %}
|
||||||
<div class="entrer">
|
<div class="entrer">
|
||||||
<p><a href="{% url 'login' %}">Connexion</a></p>
|
<p><a href="{% url 'login' %}">Connexion</a></p>
|
||||||
<p class="helptext">Connexion via le serveur central d'authentification ENS (identifiants clipper)</p>
|
<p class="helptext">Connexion via le serveur central d'authentification ENS (identifiants clipper)</p>
|
||||||
|
@ -22,14 +22,22 @@
|
||||||
|
|
||||||
<article class="promo">
|
<article class="promo">
|
||||||
<div class="explications">
|
<div class="explications">
|
||||||
<p>Ne partez plus en stage en terre inconnue : nourrissez-vous de l'expérience de {{ stats.num_stages }} stages effectués par la communauté normalienne, repérez les bons plans, et ne faites pas les mêmes erreurs !
|
<div>
|
||||||
{% if request.user.is_authenticated %}<br /><a href="{% url 'avisstage:search' %}" class="btn">Rechercher des stages</a>{% endif %}</p>
|
<p>Ne partez plus en stage en terre inconnue : nourrissez-vous de l'expérience des stages effectués par la communauté normalienne, repérez les bons plans, et ne faites pas les mêmes erreurs !</p>
|
||||||
<img src="{% static 'home2.jpg' %}" width="350"/>
|
{% if user.is_authenticated %}<p><a href="{% url 'avisstage:recherche' %}" class="btn">Rechercher des stages</a></p>{% endif %}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<img src="{% static 'images/home2.jpg' %}" width="350"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="explications">
|
<div class="explications">
|
||||||
<img src="{% static 'home1.jpg' %}" width="350"/>
|
<div>
|
||||||
<p>Vous revenez du bout du monde (ou de la rue d'à côté) ? N'attendez plus, rédigez un avis sur votre stage pour que votre expérience profite à d'autres !
|
<img src="{% static 'images/home1.jpg' %}" width="350"/>
|
||||||
{% if request.user.is_authenticated %}<br /><a href="{% url 'monstage:home' %}" class="btn">Partager ses stages</a>{% endif %}</p>
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>Vous revenez du bout du monde (ou de la rue d'à côté) ? N'attendez plus, rédigez un avis sur votre stage pour que votre expérience profite à d'autres !</p>
|
||||||
|
{% if user.is_authenticated %}<p><a href="{% url 'avisstage:perso' %}" class="btn">Partager ses stages</a></p>{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var STATIC_ROOT = "{{ STATIC_URL|escapejs }}";
|
var STATIC_ROOT = "{{ STATIC_URL|escapejs }}";
|
||||||
|
var API_LIEU = "{% url 'avisstage:api_dispatch_list' resource_name="lieu" api_name="v1" %}";
|
||||||
var map = L.map("stages-map").panTo([30, 0]).setZoom(2);
|
var map = L.map("stages-map").panTo([30, 0]).setZoom(2);
|
||||||
var layer = new L.StamenTileLayer("terrain");
|
var layer = new L.StamenTileLayer("terrain");
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
@ -28,9 +29,10 @@
|
||||||
}
|
}
|
||||||
var greenIcon = makeIcon('red');
|
var greenIcon = makeIcon('red');
|
||||||
|
|
||||||
$.getJSON("{% url 'avisstage:api_dispatch_list' resource_name="lieu" api_name="v1" %}?format=json&has_stage&limit=10000", onLoadLieux);
|
$.getJSON(API_LIEU + "?format=json&has_stage&limit=10000", onLoadLieux);
|
||||||
|
|
||||||
var marqueurs = L.markerClusterGroup();
|
var marqueurs = L.markerClusterGroup();
|
||||||
|
var marqueurs_db = {};
|
||||||
|
|
||||||
function onLoadLieux(data){
|
function onLoadLieux(data){
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
@ -38,13 +40,40 @@
|
||||||
$.each(lieux, function(i, item) {
|
$.each(lieux, function(i, item) {
|
||||||
var marqueur = L.marker(item.coord, {icon: greenIcon});
|
var marqueur = L.marker(item.coord, {icon: greenIcon});
|
||||||
var txt = item.num_stages > 1 ? item.num_stages+" stages ici": "1 stage ici";
|
var txt = item.num_stages > 1 ? item.num_stages+" stages ici": "1 stage ici";
|
||||||
marqueur.bindPopup("<h3>"+item.nom+"</h3>"+
|
txt = "<h3>"+item.nom+"</h3>"+
|
||||||
"<p>"+txt+"</p>");
|
"<p>"+txt+"</p>";
|
||||||
|
marqueur.bindPopup(txt + "<p>Chargement...</p>");
|
||||||
marqueurs.addLayer(marqueur);
|
marqueurs.addLayer(marqueur);
|
||||||
|
marqueur.on("popupopen", loadDetailLieu);
|
||||||
|
marqueur._lieu_data = item;
|
||||||
|
marqueur._popup_header = txt;
|
||||||
|
marqueur._lieu_data_loading = false;
|
||||||
|
marqueurs_db[item.id] = marqueur;
|
||||||
});
|
});
|
||||||
map.addLayer(marqueurs);
|
map.addLayer(marqueurs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadDetailLieu(){
|
||||||
|
if(this._lieu_data_loading) return;
|
||||||
|
var id = this._lieu_data.id;
|
||||||
|
$.getJSON(API_LIEU + id + "/?format=json", detailLieu);
|
||||||
|
}
|
||||||
|
|
||||||
|
function detailLieu(data){
|
||||||
|
var marqueur = marqueurs_db[data.id];
|
||||||
|
marqueur._lieu_data = data;
|
||||||
|
var html = $("<div>").html(marqueur._popup_header);
|
||||||
|
var stageliste = $("<ul>");
|
||||||
|
$.each(data.stages, function(i, item) {
|
||||||
|
var stage = $("<li>")
|
||||||
|
.append($("<a>", {href: item.url}).text(item.sujet))
|
||||||
|
.append($("<span>").text(" par "+item.auteur));
|
||||||
|
stageliste.append(stage);
|
||||||
|
});
|
||||||
|
html.append(stageliste);
|
||||||
|
marqueur.setPopupContent(html[0]);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue