1
0
forked from ScoDoc/ScoDoc

WIP: Edition formations

This commit is contained in:
Emmanuel Viennet 2021-11-18 11:29:38 +01:00
parent e3219a6b0c
commit b2c98af293
4 changed files with 11 additions and 19 deletions

View File

@ -1,8 +1,5 @@
/* table_editor, par Sébastien L.
*/
body {
font-family: Arial, Helvetica, sans-serif;
}
/***************************/
/* Le tableau */

View File

@ -29,7 +29,7 @@
{% if editable %}
<div><a href="{{
url_for('notes.formation_edit', scodoc_dept=g.scodoc_dept,
formation_id=formation_id)
formation_id=formation.id)
}}" class="stdlink">modifier ces informations</a>
</div>
{% endif %}

View File

@ -1,9 +1,10 @@
<form onchange="change_semestre()">Semestre:
<select name="semestre_idx" id="semestre_idx">
<form>Semestre:
<select onchange="this.form.submit()"" name="semestre_idx" id="semestre_idx">
{% for i in semestre_ids %}
<option value="{{i}}" {%if semestre_idx==i%}selected{%endif%}>{{i}}</option>
{% endfor %}
</select>
<input type="hidden" name="formation_id" value="{{formation.id}}"></input>
<span><a class="stdlink" href="{{
url_for('notes.ue_table', scodoc_dept=g.scodoc_dept,
formation_id=formation.id, semestre_idx=semestre_idx)
@ -19,16 +20,9 @@
</div>
<script>
function change_semestre() {
let semestre_idx = $("#semestre_idx")[0].value;
let url = window.location.href.replace(/\/[\-0-9]*$/, "/" + semestre_idx);
window.location.href = url;
};
$(function () {
let semestre_idx = $("#semestre_idx")[0].value;
if (semestre_idx > -10) {
if (semestre_idx >= 0) {
let base_url = "{{data_source}}";
let data_url = base_url.replace(/\/[\-0-9]*$/, "/" + semestre_idx);
console.log("data_url=", data_url);

View File

@ -151,12 +151,13 @@ def set_module_ue_coef():
return scu.json_error("ok", success=True, status=201)
@bp.route("/edit_modules_ue_coefs/<formation_id>", defaults={"semestre_idx": -100})
@bp.route("/edit_modules_ue_coefs/<formation_id>/<semestre_idx>")
@bp.route("/edit_modules_ue_coefs")
@scodoc
@permission_required(Permission.ScoChangeFormation)
def edit_modules_ue_coefs(formation_id, semestre_idx=None):
def edit_modules_ue_coefs(semestre_idx=None):
"""Formulaire édition grille coefs EU/modules"""
formation_id = int(request.args["formation_id"])
semestre_idx = int(request.args.get("semestre_idx", -1))
formation = models.Formation.query.filter_by(
formation_id=formation_id
).first_or_404()
@ -185,13 +186,13 @@ def edit_modules_ue_coefs(formation_id, semestre_idx=None):
"notes.table_modules_ue_coefs",
scodoc_dept=g.scodoc_dept,
formation_id=formation_id,
semestre_idx=semestre_idx or "",
semestre_idx=semestre_idx,
),
data_save=url_for(
"notes.set_module_ue_coef",
scodoc_dept=g.scodoc_dept,
),
semestre_idx=int(semestre_idx),
semestre_idx=semestre_idx,
semestre_ids=range(1, formation.get_parcours().NB_SEM + 1),
),
html_sco_header.sco_footer(),