forked from ScoDoc/ScoDoc
EDT: conserve état view
This commit is contained in:
parent
c8ac59d8da
commit
8e74a143fa
@ -20,9 +20,9 @@
|
|||||||
<button class="dropbtn">Semaine</button>
|
<button class="dropbtn">Semaine</button>
|
||||||
<div class="dropdown-content">
|
<div class="dropdown-content">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#" data-view="day">Jour</a></li>
|
{% for v in views_names %}
|
||||||
<li><a href="#" data-view="week">Semaine</a></li>
|
<li><a href="#" data-view="{{v}}">{{views_names[v]}}</a></li>
|
||||||
<li><a href="#" data-view="month">Mois</a></li>
|
{% endfor %}
|
||||||
<li>
|
<li>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="showModulesTitles"
|
<input type="checkbox" id="showModulesTitles"
|
||||||
@ -109,7 +109,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
const Calendar = tui.Calendar;
|
const Calendar = tui.Calendar;
|
||||||
const container = document.getElementById('formsemestre-calendar');
|
const container = document.getElementById('formsemestre-calendar');
|
||||||
const options = {
|
const options = {
|
||||||
defaultView: 'week',
|
defaultView: '{{view}}',
|
||||||
calendars: [
|
calendars: [
|
||||||
{
|
{
|
||||||
id: 'cal1',
|
id: 'cal1',
|
||||||
@ -247,6 +247,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
const dropdown = document.querySelector('.dropdown');
|
const dropdown = document.querySelector('.dropdown');
|
||||||
const dropbtn = document.querySelector('.dropbtn');
|
const dropbtn = document.querySelector('.dropbtn');
|
||||||
const dropdownContent = document.querySelector('.dropdown-content');
|
const dropdownContent = document.querySelector('.dropdown-content');
|
||||||
|
dropbtn.textContent = "{{views_names[view]}}";
|
||||||
|
|
||||||
dropbtn.addEventListener('click', function(event) {
|
dropbtn.addEventListener('click', function(event) {
|
||||||
dropdownContent.style.display = dropdownContent.style.display === 'block' ? 'none' : 'block';
|
dropdownContent.style.display = dropdownContent.style.display === 'block' ? 'none' : 'block';
|
||||||
|
@ -45,6 +45,7 @@ from app.scodoc import (
|
|||||||
sco_formation_versions,
|
sco_formation_versions,
|
||||||
sco_groups_view,
|
sco_groups_view,
|
||||||
)
|
)
|
||||||
|
from app.scodoc.sco_exceptions import ScoValueError
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
from app.scodoc import sco_utils as scu
|
from app.scodoc import sco_utils as scu
|
||||||
from app.views import notes_bp as bp
|
from app.views import notes_bp as bp
|
||||||
@ -163,8 +164,13 @@ def formsemestre_edit_modimpls_codes(formsemestre_id: int):
|
|||||||
@permission_required(Permission.ScoView)
|
@permission_required(Permission.ScoView)
|
||||||
def formsemestre_edt(formsemestre_id: int):
|
def formsemestre_edt(formsemestre_id: int):
|
||||||
"""Expérimental: affiche emploi du temps du semestre"""
|
"""Expérimental: affiche emploi du temps du semestre"""
|
||||||
|
|
||||||
current_date = request.args.get("current_date")
|
current_date = request.args.get("current_date")
|
||||||
show_modules_titles = scu.to_bool(request.args.get("show_modules_titles", False))
|
show_modules_titles = scu.to_bool(request.args.get("show_modules_titles", False))
|
||||||
|
view = request.args.get("view", "week")
|
||||||
|
views_names = {"day": "Jour", "month": "Mois", "week": "Semaine"}
|
||||||
|
if view not in views_names:
|
||||||
|
raise ScoValueError("valeur invalide pour le paramètre view")
|
||||||
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
formsemestre = FormSemestre.get_formsemestre(formsemestre_id)
|
||||||
cfg = ScoDocSiteConfig.query.filter_by(name="assi_morning_time").first()
|
cfg = ScoDocSiteConfig.query.filter_by(name="assi_morning_time").first()
|
||||||
hour_start = cfg.value.split(":")[0].lstrip(" 0") if cfg else "7"
|
hour_start = cfg.value.split(":")[0].lstrip(" 0") if cfg else "7"
|
||||||
@ -191,6 +197,9 @@ def formsemestre_edt(formsemestre_id: int):
|
|||||||
groups_query_args=groups_infos.groups_query_args,
|
groups_query_args=groups_infos.groups_query_args,
|
||||||
sco=ScoData(formsemestre=formsemestre),
|
sco=ScoData(formsemestre=formsemestre),
|
||||||
show_modules_titles=show_modules_titles,
|
show_modules_titles=show_modules_titles,
|
||||||
|
title=f"EDT S{formsemestre.semestre_id} {formsemestre.titre_formation()}",
|
||||||
|
view=view,
|
||||||
|
views_names=views_names,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user