Commit 4759551c authored by tleb's avatar tleb

Autofull UV small changes

parent bddb88d9
......@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-18 18:04+0200\n"
"POT-Creation-Date: 2019-10-20 16:50+0200\n"
"PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n"
......@@ -4990,17 +4990,21 @@ msgstr "Supprimer signalement"
#: pedagogy/templates/pedagogy/uv_create.jinja:4
#: pedagogy/templates/pedagogy/uv_create.jinja:8
#, fuzzy
#| msgid "Edit"
msgid "Edit UV"
msgstr "Éditer"
#: pedagogy/templates/pedagogy/uv_create.jinja:27
msgid "Import from UTBM"
msgstr "Importer depuis l'UTBM"
#: pedagogy/templates/pedagogy/uv_create.jinja:57
#, fuzzy
#| msgid "Unknown event"
msgid "Unknown UV code"
msgstr "Code d'UV inconnu"
#: pedagogy/templates/pedagogy/uv_create.jinja:72
msgid "Successful autocomplete"
msgstr "Autocomplétion réussite"
#: pedagogy/templates/pedagogy/uv_detail.jinja:6
msgid "UV Details"
msgstr "Détails d'UV"
......
......@@ -24,7 +24,7 @@
{% if field.name == 'code' %}
<a href="javascript:void(0)" id="autofill">Fill</a>
<button type="button" id="autofill">{% trans %}Import from UTBM{% endtrans %}</button>
{% endif %}
</p>
{% endif %}
......@@ -48,13 +48,13 @@
autofillBtn.addEventListener('click', () => {
const today = new Date()
let year = today.getFullYear()
if (today.getMonth() < 7) { // student year, starts in september
if (today.getMonth() < 7) { // student year starts in september
year--
}
const url = "{{ url('api:uv_endpoint') }}?year=" + year + "&code=" + codeInput.value
$.getJSON(url, function(data, _, xhr) {
if (xhr.status != 200) {
alert('{% trans %}Unknown UV code{% endtrans %}')
alert("{% trans %}Unknown UV code{% endtrans %}")
return
}
for (let key in data) {
......@@ -68,9 +68,10 @@
}
}
alert('{% trans %}Successful autocomplete{% endtrans %}')
})
})
})
</script>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment