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. /* table_editor, par Sébastien L.
*/ */
body {
font-family: Arial, Helvetica, sans-serif;
}
/***************************/ /***************************/
/* Le tableau */ /* Le tableau */

View File

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

View File

@ -1,9 +1,10 @@
<form onchange="change_semestre()">Semestre: <form>Semestre:
<select name="semestre_idx" id="semestre_idx"> <select onchange="this.form.submit()"" name="semestre_idx" id="semestre_idx">
{% for i in semestre_ids %} {% for i in semestre_ids %}
<option value="{{i}}" {%if semestre_idx==i%}selected{%endif%}>{{i}}</option> <option value="{{i}}" {%if semestre_idx==i%}selected{%endif%}>{{i}}</option>
{% endfor %} {% endfor %}
</select> </select>
<input type="hidden" name="formation_id" value="{{formation.id}}"></input>
<span><a class="stdlink" href="{{ <span><a class="stdlink" href="{{
url_for('notes.ue_table', scodoc_dept=g.scodoc_dept, url_for('notes.ue_table', scodoc_dept=g.scodoc_dept,
formation_id=formation.id, semestre_idx=semestre_idx) formation_id=formation.id, semestre_idx=semestre_idx)
@ -19,16 +20,9 @@
</div> </div>
<script> <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 () { $(function () {
let semestre_idx = $("#semestre_idx")[0].value; let semestre_idx = $("#semestre_idx")[0].value;
if (semestre_idx > -10) { if (semestre_idx >= 0) {
let base_url = "{{data_source}}"; let base_url = "{{data_source}}";
let data_url = base_url.replace(/\/[\-0-9]*$/, "/" + semestre_idx); let data_url = base_url.replace(/\/[\-0-9]*$/, "/" + semestre_idx);
console.log("data_url=", data_url); 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) 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")
@bp.route("/edit_modules_ue_coefs/<formation_id>/<semestre_idx>")
@scodoc @scodoc
@permission_required(Permission.ScoChangeFormation) @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""" """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 = models.Formation.query.filter_by(
formation_id=formation_id formation_id=formation_id
).first_or_404() ).first_or_404()
@ -185,13 +186,13 @@ def edit_modules_ue_coefs(formation_id, semestre_idx=None):
"notes.table_modules_ue_coefs", "notes.table_modules_ue_coefs",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
formation_id=formation_id, formation_id=formation_id,
semestre_idx=semestre_idx or "", semestre_idx=semestre_idx,
), ),
data_save=url_for( data_save=url_for(
"notes.set_module_ue_coef", "notes.set_module_ue_coef",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
), ),
semestre_idx=int(semestre_idx), semestre_idx=semestre_idx,
semestre_ids=range(1, formation.get_parcours().NB_SEM + 1), semestre_ids=range(1, formation.get_parcours().NB_SEM + 1),
), ),
html_sco_header.sco_footer(), html_sco_header.sco_footer(),