Débugs et structures d'accueil

This commit is contained in:
Evarin 2017-04-27 03:06:51 +02:00
parent 1dbe2aeb0e
commit d36652d16a
4 changed files with 34 additions and 21 deletions

View file

@ -16,7 +16,7 @@ class LieuResource(ModelResource):
class Meta:
queryset = Lieu.objects.all()
resource_name = "lieu"
fields = ["nom", "pays", "coord", "type_lieu", "id"]
fields = ["nom", "ville", "pays", "coord", "type_lieu", "id"]
authentication = SessionAuthentication()
def build_filters(self, filters=None, **kwargs):

View file

@ -124,6 +124,7 @@ function SelectLieuWidget(STATIC_ROOT, API_LIEU, target, callback) {
break;
case "country":
data.pays = obj.short_name;
data.pays_nom = obj.long_name;
break;
}
}
@ -180,7 +181,7 @@ function SelectLieuWidget(STATIC_ROOT, API_LIEU, target, callback) {
data.marqueur = marqueur;
var desc = $("<div>").append($("<h3>").text(data.nom))
.append($("<p>").text(data.ville+", "+data.pays));
.append($("<p>").text(data.ville+", "+data.pays_nom));
var activeBtn = $("<a>", {href:"javascript:void(0);"})
.prop("_lieustage_data", data)
.on("click", choixLieuStage);

View file

@ -79,7 +79,8 @@
});
</script>
{% endif %}
<p><a href="{% url "avisstage:profil" object.auteur.user.username %}">{{ object.auteur.nom }}</a> a fait ce {{ object.get_type_stage_display|lower }} du {{ object.date_debut }} au {{ object.date_fin }}, supervisé par {{ object.encadrants }}</p>
<p><a href="{% url "avisstage:profil" object.auteur.user.username %}">{{ object.auteur.nom }}</a> a fait ce {{ object.get_type_stage_display|lower }}
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>
<ul class="infos">
{% for matiere in object.matieres.all %}
<li class="matiere">{{ matiere.nom }}</li>

View file

@ -5,9 +5,9 @@
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyDd4innPShfHcW8KDJB833vZHZSsqt-ACw"></script>
<script type="text/javascript" src="{% static "js/leaflet.js" %}"></script>
<script type="text/javascript" src="{% static "js/leaflet-gplaces-autocomplete.js" %}"></script>
<script type="text/javascript" src="//maps.stamen.com/js/tile.stamen.js?v1.3.0"></script>
<script type="text/javascript" src="{% static "jquery-autosuggest/js/jquery.autoSuggest.minified.js" %}"> </script>
<link rel="stylesheet" type="text/css" href="{% static "css/leaflet.css" %}" />
<script type="text/javascript" src="{% static "js/tile.stamen.js" %}"></script>
<script type="text/javascript" src="{% static "js/tinymce/tinymce.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/select_lieu.js" %}"></script>
<script type="text/javascript">
@ -17,21 +17,26 @@
$(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' });
// RICH TEXT FIELDS
var txtr = $("textarea.tinymce");
$.each(txtr, function(i, item) {
var newitem = $("<div>", {"class":"tinymce"}).html(item.value)
item.fakeinput = newitem;
item.style.display = "none";
$(item).parent().append(newitem);
});
tinyMCE.init({
selector: "div.tinymce",
menubar: false,
plugins: "paste,searchreplace,lists,autolink,link",
toolbar: 'undo redo | bold italic underline strikethrough | bullist numlist outdent indent | link',
inline: true,
language: "fr_FR",
});
var rich_texts = [];
function initRichTexts(selector) {
var txtr = $(selector+" textarea.tinymce");
$.each(txtr, function(i, item) {
var newitem = $("<div>", {"class":"tinymce"}).html(item.value)
item.fakeinput = newitem;
item.style.display = "none";
$(item).parent().append(newitem);
rich_texts.push(item);
});
tinyMCE.init({
selector: selector+" div.tinymce",
menubar: false,
plugins: "paste,searchreplace,lists,autolink,link",
toolbar: 'undo redo | bold italic underline strikethrough | bullist numlist outdent indent | link',
inline: true,
language: "fr_FR",
});
};
// SELECT MULTIPLE FIELDS
var slts = $("select[multiple]");
@ -103,7 +108,9 @@
// Créer un nouveau lieu
var cnt = $("#id_lieux-TOTAL_FORMS");
var i_form = cnt.val()*1;
dest_form = $("<div>").html(avis_lieu_template.replace(/__prefix__/g, i_form));
var idform = "avis-lieux-"+i_form;
dest_form = $("<div>", {id: idform, class:"avis_lieu"})
.html(avis_lieu_template.replace(/__prefix__/g, i_form));
dest_btn = $("<a>", {href:"javascript:void(0);",
class:"lieu-change",
id:"change-lieux-"+i_form})
@ -112,6 +119,7 @@
cnt.val(i_form+1);
$("#avis_lieu_container").append(dest_form);
initRichTexts("#"+idform);
} else {
// Changer un lieu existant
dest_form = $("#avis-lieux-"+lieu_focus);
@ -126,9 +134,12 @@
}
// TODO gérer le cas de l'actualisation du formulaire où le lieu affiché n'est plus le vrai lieu
initRichTexts("");
// CLEANUP ON SENDING
$("#stageform").submit(function() {
$.each(txtr, function(i, item) {
$.each(rich_texts, function(i, item) {
item.value = tinyMCE.get(item.fakeinput.attr("id")).getContent();
});
$.each(slts, function(i, item) {