Derniers réglages avant production

This commit is contained in:
Evarin 2017-04-25 22:02:23 +02:00
parent be57b976d2
commit b77a45a56a
5 changed files with 164 additions and 51 deletions

View file

@ -8,6 +8,8 @@ from tastypie.authentication import SessionAuthentication
from django.contrib.gis import geos
from tastypie import fields, utils
from django.urls import reverse
class LieuResource(ModelResource):
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['thematiques'] = list(obj.thematiques.all().values_list("name", 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
class AuteurResource(ModelResource):

View file

@ -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;
color: #fff;
border: 1px solid $fond * 0.7;
@ -392,7 +393,8 @@ input[type="submit"] {
margin-right: 0;
}
p input[type="submit"] {
p input[type="submit"],
p .btn {
display:inline-block;
}
@ -627,3 +629,37 @@ a.lieu-change {
transform: rotateZ(90deg);
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;
}
}
}
}

View file

@ -448,7 +448,8 @@ input[type='text']:focus, input[type='password']:focus, input[type='email']:focu
}
/* line 384, ../../sass/screen.scss */
input[type="submit"] {
input[type="submit"],
.btn {
background-color: #8fcc33;
color: #fff;
border: 1px solid #648f24;
@ -459,12 +460,13 @@ input[type="submit"] {
margin-right: 0;
}
/* line 395, ../../sass/screen.scss */
p input[type="submit"] {
/* line 396, ../../sass/screen.scss */
p input[type="submit"],
p .btn {
display: inline-block;
}
/* line 400, ../../sass/screen.scss */
/* line 402, ../../sass/screen.scss */
select {
-moz-appearance: none;
appearance: none;
@ -473,7 +475,7 @@ select {
cursor: pointer;
}
/* line 408, ../../sass/screen.scss */
/* line 410, ../../sass/screen.scss */
textarea, div.tinymce {
border: none;
border-left: 1px solid #8fcc33;
@ -482,26 +484,26 @@ textarea, div.tinymce {
transition: border 1s ease-out, background 1s ease-out;
}
/* line 416, ../../sass/screen.scss */
/* line 418, ../../sass/screen.scss */
div.tinymce.mce-edit-focus {
background-color: white;
outline: none;
}
/* line 421, ../../sass/screen.scss */
/* line 423, ../../sass/screen.scss */
textarea {
height: 200px;
resize: vertical;
}
/* line 427, ../../sass/screen.scss */
/* line 429, ../../sass/screen.scss */
form .field {
margin: 5px 0;
display: flex;
background: #fff;
padding: 10px;
}
/* line 433, ../../sass/screen.scss */
/* line 435, ../../sass/screen.scss */
form .field label, form .field .label {
display: inline-block;
width: 250px;
@ -510,33 +512,33 @@ form .field label, form .field .label {
padding-top: 5px;
flex-shrink: 0;
}
/* line 441, ../../sass/screen.scss */
/* line 443, ../../sass/screen.scss */
form .field label {
font-family: Podkova, serif;
font-weight: bold;
}
/* line 445, ../../sass/screen.scss */
/* line 447, ../../sass/screen.scss */
form .field .help_text {
font-style: italic;
font-size: 0.9em;
}
/* line 449, ../../sass/screen.scss */
/* line 451, ../../sass/screen.scss */
form .field .input {
display: inline-block;
flex-grow: 1;
margin-right: 10px;
}
/* line 458, ../../sass/screen.scss */
/* line 460, ../../sass/screen.scss */
ul.as-selections {
display: flex;
flex-wrap: wrap;
}
/* line 462, ../../sass/screen.scss */
/* line 464, ../../sass/screen.scss */
ul.as-selections li {
display: inline-block;
}
/* line 466, ../../sass/screen.scss */
/* line 468, ../../sass/screen.scss */
ul.as-selections .as-selection-item {
padding: 0 5px;
background: #f99b20;
@ -545,57 +547,57 @@ ul.as-selections .as-selection-item {
border-radius: 2px;
font-weight: 500;
}
/* line 474, ../../sass/screen.scss */
/* line 476, ../../sass/screen.scss */
ul.as-selections .as-selection-item a.as-close {
color: #fff;
-webkit-cursor: pointer;
cursor: pointer;
margin-right: 5px;
}
/* line 481, ../../sass/screen.scss */
/* line 483, ../../sass/screen.scss */
ul.as-selections .as-selection-item.selected {
background: #8fcc33;
}
/* line 486, ../../sass/screen.scss */
/* line 488, ../../sass/screen.scss */
ul.as-selections .as-original {
flex-grow: 1;
min-width: 200px;
}
/* line 490, ../../sass/screen.scss */
/* line 492, ../../sass/screen.scss */
ul.as-selections .as-original input {
width: 100%;
}
/* line 496, ../../sass/screen.scss */
/* line 498, ../../sass/screen.scss */
div.as-results {
position: relative;
}
/* line 498, ../../sass/screen.scss */
/* line 500, ../../sass/screen.scss */
div.as-results ul {
position: absolute;
width: 100%;
background: #fff;
border: 1px solid #d2ebad;
}
/* line 505, ../../sass/screen.scss */
/* line 507, ../../sass/screen.scss */
div.as-results ul li {
padding: 3px 5px;
}
/* line 511, ../../sass/screen.scss */
/* line 513, ../../sass/screen.scss */
div.as-results ul li.as-result-item.active {
background: white;
}
/* line 516, ../../sass/screen.scss */
/* line 518, ../../sass/screen.scss */
div.as-results ul li.as-message {
font-style: italic;
}
/* line 523, ../../sass/screen.scss */
/* line 525, ../../sass/screen.scss */
#map_addlieu {
height: 500px;
}
/* line 527, ../../sass/screen.scss */
/* line 529, ../../sass/screen.scss */
.window {
display: none;
position: fixed;
@ -606,11 +608,11 @@ div.as-results ul li.as-message {
left: 0;
z-index: 10;
}
/* line 537, ../../sass/screen.scss */
/* line 539, ../../sass/screen.scss */
.window.visible {
display: block;
}
/* line 541, ../../sass/screen.scss */
/* line 543, ../../sass/screen.scss */
.window .window-bg {
background: #000;
opacity: 0.7;
@ -621,7 +623,7 @@ div.as-results ul li.as-message {
top: 0;
z-index: -1;
}
/* line 552, ../../sass/screen.scss */
/* line 554, ../../sass/screen.scss */
.window .window-content {
position: relative;
margin: 0 auto;
@ -635,7 +637,7 @@ div.as-results ul li.as-message {
max-height: 100%;
overflow: auto;
}
/* line 567, ../../sass/screen.scss */
/* line 569, ../../sass/screen.scss */
.window .window-closer {
position: absolute;
top: 0;
@ -643,31 +645,31 @@ div.as-results ul li.as-message {
padding: 12px;
z-index: 3;
}
/* line 573, ../../sass/screen.scss */
/* line 575, ../../sass/screen.scss */
.window .window-closer:after {
content: "×";
}
/* line 580, ../../sass/screen.scss */
/* line 582, ../../sass/screen.scss */
.lieu-ui .map {
height: 400px;
width: 100%;
}
/* line 584, ../../sass/screen.scss */
/* line 586, ../../sass/screen.scss */
.lieu-ui .hidden {
display: none;
}
/* line 587, ../../sass/screen.scss */
/* line 589, ../../sass/screen.scss */
.lieu-ui .masked {
visibility: hidden;
}
/* line 592, ../../sass/screen.scss */
/* line 594, ../../sass/screen.scss */
#avis_lieu_vide {
display: none;
}
/* line 596, ../../sass/screen.scss */
/* line 598, ../../sass/screen.scss */
a.lieu-change {
color: #fff;
background: #f99b20;
@ -680,19 +682,19 @@ a.lieu-change {
border-radius: 5px;
margin-right: 7px;
}
/* line 608, ../../sass/screen.scss */
/* line 610, ../../sass/screen.scss */
a.lieu-change.ajout:before {
content: "+";
margin-right: 5px;
}
/* line 614, ../../sass/screen.scss */
/* line 616, ../../sass/screen.scss */
#stages-map {
width: 100%;
height: 600px;
}
/* line 619, ../../sass/screen.scss */
/* line 621, ../../sass/screen.scss */
#feedback-button {
position: fixed;
left: 0;
@ -704,3 +706,38 @@ a.lieu-change.ajout:before {
transform: rotateZ(90deg);
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;
}

View file

@ -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".
</div>
{% if not request.user.is_authenticated %}
{% if not user.is_authenticated %}
<div class="entrer">
<p><a href="{% url 'login' %}">Connexion</a></p>
<p class="helptext">Connexion via le serveur central d'authentification ENS (identifiants clipper)</p>
@ -22,14 +22,22 @@
<article class="promo">
<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&nbsp;!
{% if request.user.is_authenticated %}<br /><a href="{% url 'avisstage:search' %}" class="btn">Rechercher des stages</a>{% endif %}</p>
<img src="{% static 'home2.jpg' %}" width="350"/>
<div>
<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&nbsp;!</p>
{% 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 class="explications">
<img src="{% static 'home1.jpg' %}" width="350"/>
<p>Vous revenez du bout du monde (ou de la rue d'à côté)&nbsp;? N'attendez plus, rédigez un avis sur votre stage pour que votre expérience profite à d'autres&nbsp;!
{% if request.user.is_authenticated %}<br /><a href="{% url 'monstage:home' %}" class="btn">Partager ses stages</a>{% endif %}</p>
<div>
<img src="{% static 'images/home1.jpg' %}" width="350"/>
</div>
<div>
<p>Vous revenez du bout du monde (ou de la rue d'à côté)&nbsp;? N'attendez plus, rédigez un avis sur votre stage pour que votre expérience profite à d'autres&nbsp;!</p>
{% if user.is_authenticated %}<p><a href="{% url 'avisstage:perso' %}" class="btn">Partager ses stages</a></p>{% endif %}
</div>
</div>
</article>
{% endblock %}

View file

@ -14,6 +14,7 @@
<script type="text/javascript">
$(function () {
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 layer = new L.StamenTileLayer("terrain");
map.addLayer(layer);
@ -28,9 +29,10 @@
}
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_db = {};
function onLoadLieux(data){
console.log(data);
@ -38,13 +40,40 @@
$.each(lieux, function(i, item) {
var marqueur = L.marker(item.coord, {icon: greenIcon});
var txt = item.num_stages > 1 ? item.num_stages+" stages ici": "1 stage ici";
marqueur.bindPopup("<h3>"+item.nom+"</h3>"+
"<p>"+txt+"</p>");
txt = "<h3>"+item.nom+"</h3>"+
"<p>"+txt+"</p>";
marqueur.bindPopup(txt + "<p>Chargement...</p>");
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);
}
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>
{% endblock %}