Autofull UV small changes

This commit is contained in:
tleb 2019-10-20 17:09:36 +02:00
parent bddb88d97f
commit 4759551c16
2 changed files with 14 additions and 9 deletions

View File

@ -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"

View File

@ -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 %}