1
0
forked from ScoDoc/ScoDoc

WIP: revamp html/css: sidebar, hamburger, templates

This commit is contained in:
Emmanuel Viennet 2024-07-22 16:53:50 +02:00
parent 36547afb0b
commit c9ca97df6e
14 changed files with 343 additions and 48 deletions

View File

@ -109,7 +109,7 @@ class ScolarNews(db.Model):
)
def __str__(self):
"'Chargement notes dans Stage (S3 FI) par Aurélie Dupont'"
"exemple: 'Notes dans Stage (S3 FI) par Aurélie Dupont'"
formsemestre = self.get_news_formsemestre()
user = User.query.filter_by(user_name=self.authenticated_user).first()

View File

@ -651,7 +651,7 @@ def do_evaluations_upload_xls(
ScolarNews.add(
typ=ScolarNews.NEWS_NOTE,
obj=obj_id,
text=f"""Chargement notes dans <a href="{status_url}">{modules_str}</a>""",
text=f"""Notes dans <a href="{status_url}">{modules_str}</a>""",
url=status_url,
max_frequency=10 * 60, # 10 minutes
)

View File

@ -1047,7 +1047,7 @@ def save_notes(
ScolarNews.add(
typ=ScolarNews.NEWS_NOTE,
obj=evaluation.moduleimpl_id,
text=f"""Chargement notes dans <a href="{status_url}">{
text=f"""Notes dans <a href="{status_url}">{
evaluation.moduleimpl.module.titre or evaluation.moduleimpl.module.code}</a>""",
url=status_url,
max_frequency=30 * 60, # 30 minutes

View File

@ -1,4 +1,4 @@
/* ScoDoc, (c) Emmanuel Viennet 1998 - 2023
/* ScoDoc, (c) Emmanuel Viennet 1998 - 2024
*/
:root {
@ -40,6 +40,10 @@ h3 {
font-weight: bold;
}
body a {
color: rgb(4, 16, 159);
}
details>summary:first-of-type {
display: list-item !important;
}

207
app/static/css/scodoc97.css Normal file
View File

@ -0,0 +1,207 @@
/* ScoDoc, (c) Emmanuel Viennet 1998 - 2024
*/
.scodoc-container {
display: grid;
grid-template-columns: 130px 1fr;
grid-template-rows: auto 1fr;
}
.app-corner {
/* background-color: rgb(235, 235, 228); */
grid-column-start: 1;
grid-row-start: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.formsemestre-page-header {
grid-column-start: 2;
grid-row-start: 1;
display: flex;
flex-direction: column;
flex-grow: 1;
justify-content: left;
white-space: nowrap;
padding: 0 10px;
/* Optional: Padding for some space around the text */
}
#sidebar {
border-right: 1px solid rgb(230, 230, 225);
grid-column-start: 1;
grid-row-start: 2;
padding-left: 4px;
/* Sidebar transition */
transition: transform 400ms ease, opacity 400ms ease;
}
#app-content {
grid-column-start: 2;
grid-row-start: 2;
background-color: #f0f0f0;
/* Optional: background color for content area */
/* Sidebar transition */
transition: margin-left 400ms ease;
}
.infos {
/* container infos semestre */
font-size: 12pt;
}
.sco_menu {
/* container menu bar semestre */
background-color: lightblue;
flex-grow: 1;
padding: 5px;
margin-top: 5px;
}
.hamburger {
white-space: nowrap;
display: flex;
align-items: center;
}
.hamburger>div {
font-size: 12pt;
font-weight: bold;
vertical-align: bottom;
white-space: nowrap;
}
.hamburger>.hamburger-icon {
font-size: 24pt;
margin-top: -8px;
margin-right: 8px;
}
.app-corner .scodoc-index,
.app-corner .scodoc-index a {
font-size: 14pt;
display: inline;
color: rgb(4, 16, 159);
}
.hamburger-menu {
display: none;
flex-direction: column;
background-color: #333;
position: fixed;
top: 50px;
left: 0;
/* width: 100%; */
max-width: 400px;
z-index: 1001;
/* Ensure it is above the top bar */
}
.hamburger-menu div {
padding: 10px;
border-bottom: 1px solid #444;
}
.hamburger-menu a {
color: white;
text-decoration: none;
}
#toggle-sidebar-img {
box-sizing: content-box;
padding-left: 4px;
padding-right: 4px;
transition: transform 400ms ease;
}
#toggle-sidebar-img.collapsed {
transform: scaleX(-1);
}
.vspace48 {
margin-top: 48px;
}
.hidden {
display: none;
}
.overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.05);
z-index: 1000;
/* Below the menu but above the top bar */
}
/* Media query for desktop devices */
@media (min-width: 769px) {
#sidebar.collapsed {
/* Slide the sidebar out to the left */
transform: translateX(-130px);
opacity: 0;
/* fade out effect */
}
#app-content.collapsed {
grid-column-start: 1;
grid-column-end: 3;
}
}
/* Hide the sidebar for mobile devices and print */
@media screen and (max-width: 768px),
print {
#sidebar,
div.toggle-sidebar {
display: none;
}
#app-content {
grid-column-start: 1;
grid-column-end: 3;
}
}
/* Sidebar */
#sidebar sco-title {
color: rgb(102, 102, 102);
font-size: large;
font-weight: bold;
text-decoration: none;
}
#sidebar h2 {
color: rgb(102, 102, 102);
font-weight: bold;
font-size: large;
margin-bottom: 0;
}
#sidebar div.sidebar-item {
margin-left: 4px;
}
#sidebar div.sidebar-item a:link,
#sidebar div.sidebar-item a:link,
#sidebar div.sidebar-item a:visited {
color: rgb(4, 16, 159);
text-decoration: none;
}
#sidebar div.sidebar-item a:hover {
color: rgb(153, 51, 51);
text-decoration: underline;
}
/* Content */
#app-content>.gtrcontent {
height: 100%;
margin-left: 10px;
margin-bottom: 10px;
}

View File

@ -0,0 +1 @@
<svg id="Layer_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="m52.246 239.578c-9.043 9.043-9.043 23.803 0 32.846l177.132 177.126c9.057 9.057 23.79 9.057 32.846 0l9.908-9.908c9.065-9.065 9.067-23.79.001-32.857l-134.37-134.357c-9.067-9.065-9.067-23.793 0-32.858l134.369-134.358c9.067-9.066 9.066-23.79-.001-32.856l-9.908-9.908c-9.043-9.043-23.803-9.043-32.846 0zm364.742-177.132c9.052-9.053 23.799-9.052 32.851 0l9.908 9.908c9.048 9.048 9.049 23.808 0 32.857l-134.363 134.359c-9.066 9.066-9.066 23.792 0 32.858l134.364 134.358c9.052 9.051 9.051 23.806 0 32.857l-9.908 9.908c-9.056 9.056-23.795 9.057-32.851 0l-161.398-161.403c-45.274 45.229-33.822 33.759-.033-.033l-15.69-15.691c-9.049-9.049-9.048-23.798 0-32.847z" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 844 B

View File

@ -0,0 +1,5 @@
<div>
<a href="{{url_for('scodoc.index', scodoc_dept=g.scodoc_dept) }}">Accueil général</a>
</div>
<div><a href="#">Item 2</a></div>
<div><a href="#">Item 3</a></div>

View File

@ -8,6 +8,7 @@
<link type="text/css" rel="stylesheet"
href="{{scu.STATIC_DIR}}/libjs/timepicker-1.3.5/jquery.timepicker.min.css" />
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/scodoc.css">
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/scodoc97.css">
<link href="{{scu.STATIC_DIR}}/css/menu.css" rel="stylesheet" type="text/css" />
<link href="{{scu.STATIC_DIR}}/css/gt_table.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="{{scu.STATIC_DIR}}/libjs/qtip/jquery.qtip-3.0.3.min.css" />
@ -21,25 +22,49 @@
{% endblock %}
{% block content %}
<!-- sco_page -->
{% block scodoc_sidebar %}
{% include "sidebar.j2" %}
{% endblock %}
<!-- sco_page revamp -->
<div class="overlay" id="overlay" onclick="closeMobileMenu()"></div>
<div class="hamburger-menu" id="hamburgerMenu">
{% block hamburger_menu %}
{% include "hamburger_menu.j2" %}
{% endblock %}
</div>
<div class="scodoc-container">
<div class="app-corner">
<div class="hamburger">
<div class="hamburger-icon" onclick="toggleMobileMenu()">☰</div>
<div class="scodoc-index"><a class="sco-title" href="{{
url_for('scodoc.index', scodoc_dept=g.scodoc_dept) }}"
>ScoDoc</a>
</div>
</div>
<div class="toggle-sidebar" onclick="toggleSidebar()">
<img id="toggle-sidebar-img" src="{{scu.STATIC_DIR}}/icons/back.svg" width="12px" alt="toggle sidebar"/>
</div>
</div>
<div class="formsemestre-page-header">
{% include "flashed_messages.j2" %}
{% if sco.formsemestre %}
{% block formsemestre_header %}
{% include "formsemestre_header.j2" %}
{% endblock %}
{% endif %}
</div>
<div id="sidebar">
{% include "sidebar.j2" %}
</div>
<div id="gtrcontent" class="gtrcontent">
{% include "flashed_messages.j2" %}
{% if sco.formsemestre %}
{% block formsemestre_header %}
{% include "formsemestre_header.j2" %}
{% endblock %}
{% endif %}
<div class="sco-app-content">
{% block app_content %}
{{ content | safe }}
{% endblock %}
<div id="app-content">
<div id="gtrcontent" class="gtrcontent">
<div class="sco-app-content">
{% block app_content %}
{{ content | safe }}
{% endblock %}
</div>
</div>
</div>
</div>
<!-- sco_page -->
{% endblock %}
{% block scripts %}
@ -58,6 +83,32 @@
}
};
const SCO_URL = "{{ url_for('scolar.index_html', scodoc_dept=g.scodoc_dept) }}";
function toggleSidebar() {
document.getElementById('sidebar').classList.toggle('collapsed');
document.getElementById('app-content').classList.toggle('collapsed');
document.getElementById('toggle-sidebar-img').classList.toggle('collapsed');
}
function toggleMobileMenu() {
const menu = document.getElementById('hamburgerMenu');
const overlay = document.getElementById('overlay');
if (menu.style.display === 'none' || menu.style.display === '') {
menu.style.display = 'flex';
overlay.style.display = 'block';
} else {
menu.style.display = 'none';
overlay.style.display = 'none';
}
}
function closeMobileMenu() {
document.getElementById('hamburgerMenu').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
}
// Ensure the hamburger menu and overlay are hidden initially
document.getElementById('hamburgerMenu').style.display = 'none';
document.getElementById('overlay').style.display = 'none';
</script>
{% endblock %}

View File

@ -0,0 +1,12 @@
{%- extends 'sco_page.j2' -%}
{# -*- Base des pages dans département mais hors formsemestre -*- #}
{# -*- Comme sco_page mais cache le bandeau formsemestre -*- #}
{% block styles %}
{{super()}}
<style>
.formsemestre-page-header {
display: none;
}
</style>
{% endblock %}

View File

@ -1,6 +1,6 @@
{# page accueil département #}
{% extends "sco_page.j2" %}
{% extends "sco_page_dept.j2" %}
{% block app_content %}
<style>

View File

@ -1,10 +1,7 @@
{# Barre marge gauche ScoDoc #}
{# -*- mode: jinja-html -*- #}
<!-- sidebar -->
<div class="sidebar" id="sidebar">
{# sidebar_common #}
<a class="scodoc_title" href="{{
url_for('scodoc.index', scodoc_dept=g.scodoc_dept) }}">ScoDoc {{ sco.SCOVERSION }}</a>
<div id="authuser"><a id="authuserlink" href="{{
url_for('users.user_info_page', scodoc_dept=g.scodoc_dept, user_name=current_user.user_name)
}}">{{current_user.user_name}}</a>
@ -12,34 +9,44 @@
</div>
{% block sidebar_dept %}
<h2 class="insidebar">Dépt. {{ sco.prefs["DeptName"] }}</h2>
<a href="{{ url_for('scolar.index_html', scodoc_dept=g.scodoc_dept) }}" class="sidebar">Accueil</a> <br />
{% if sco.prefs["DeptIntranetURL"] %}
<a href="{{ sco.prefs['DeptIntranetURL'] }}" class="sidebar">
{{ sco.prefs["DeptIntranetTitle"] }}</a>
{% endif %}
<br>
<h2><a href="{{ url_for('scolar.index_html', scodoc_dept=g.scodoc_dept) }}"
>Dépt. {{ sco.prefs["DeptName"] }}</a></h2>
{% if sco.prefs["DeptIntranetURL"] %}
<div class="sidebar-item">
<a href="{{ sco.prefs['DeptIntranetURL'] }}">{{ sco.prefs["DeptIntranetTitle"] }}</a>
</div>
{% endif %}
{% endblock %}
<h2 class="insidebar">Scolarité</h2>
<a href="{{url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)}}" class="sidebar">Semestres</a> <br>
<a href="{{url_for('notes.index_html', scodoc_dept=g.scodoc_dept)}}" class="sidebar">Formations</a> <br>
<div class="sidebar-item">
<a href="{{url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)}}">Semestres</a>
</div>
<div class="sidebar-item">
<a href="{{url_for('notes.index_html', scodoc_dept=g.scodoc_dept)}}">Formations</a>
</div>
{% if current_user.has_permission(sco.Permission.AbsChange)%}
<a href="{{url_for('assiduites.bilan_dept', scodoc_dept=g.scodoc_dept)}}" class="sidebar">Assiduité</a> <br>
<div class="sidebar-item">
<a href="{{url_for('assiduites.bilan_dept', scodoc_dept=g.scodoc_dept)}}">Assiduité</a>
</div>
{% endif %}
{% if current_user.has_permission(sco.Permission.UsersAdmin)
or current_user.has_permission(sco.Permission.UsersView)
%}
<a href="{{url_for('users.index_html', scodoc_dept=g.scodoc_dept)}}" class="sidebar">Utilisateurs</a> <br />
<div class="sidebar-item">
<a href="{{url_for('users.index_html', scodoc_dept=g.scodoc_dept)}}">Utilisateurs</a>
</div>
{% endif %}
{% if current_user.has_permission(sco.Permission.EditPreferences) %}
<a href="{{url_for('scolar.edit_preferences', scodoc_dept=g.scodoc_dept)}}" class="sidebar">Paramétrage</a> <br>
<div class="sidebar-item">
<a href="{{url_for('scolar.edit_preferences', scodoc_dept=g.scodoc_dept)}}">Paramétrage</a>
</div>
{% endif %}
{# /sidebar_common #}
<div class="box-chercheetud">Chercher étudiant:<br>
<div class="box-chercheetud">Chercher étudiant:
<form method="get" id="form-chercheetud"
action="{{ url_for('scolar.search_etud_in_dept', scodoc_dept=g.scodoc_dept) }}">
<div>
@ -81,18 +88,23 @@
{# LOGO #}
<div class="logo-insidebar">
<div class="sidebar-bottom"><a href="{{ url_for( 'scodoc.about',
scodoc_dept=g.scodoc_dept ) }}" class="sidebar">À propos</a>
<br />
<a href="{{ scu.SCO_USER_MANUAL }}" target="_blank" rel="noopener" class="sidebar">Aide</a>
<div class="sidebar-bottom">
<div class="sidebar-item">
<a href="{{ url_for( 'scodoc.about', scodoc_dept=g.scodoc_dept ) }}">À propos</a>
</div>
<div class="sidebar-item">
<a href="{{ scu.SCO_USER_MANUAL }}" target="_blank" rel="noopener">Aide</a>
</div>
</div>
</div>
<div class="logo-logo">
<a href="{{ url_for( 'scodoc.about', scodoc_dept=g.scodoc_dept ) }}">
{{ scu.icontag("scologo_img", no_size=True) | safe}}</a>
<div class="sidebar-item version">
{{ sco.SCOVERSION }}
</div>
{% if DEBUG %}
<div style="color:gold; background-color:navy;">DEBUG</div>
<div style="color:gold; background-color:navy; margin-top: 8px;">DEBUG</div>
{% endif %}
</div>
</div>
<!-- end of sidebar -->

View File

@ -676,7 +676,6 @@ def index_html():
return table.make_page(fmt=fmt, filename=f"Formations-{g.scodoc_dept}")
H = [
html_sco_header.sco_header(page_title="Formations (programmes)"),
f"""<h2>Formations (programmes pédagogiques)</h2>
<form>
<input type="checkbox" id="detailCheckbox" name="detail"
@ -726,8 +725,11 @@ def index_html():
"""
)
H.append(html_sco_header.sco_footer())
return "\n".join(H)
return render_template(
"sco_page_dept.j2",
content="\n".join(H),
title="Formations (programmes)",
)
# --------------------------------------------------------------------

View File

@ -346,6 +346,7 @@ def show_etud_log(etudid, fmt="html"):
@permission_required(Permission.ScoView)
@scodoc7func
def index_html(showcodes=0, showsemtable=0):
"La page d'accueil département (ScoDoc/<dept>/Scolarite)"
return sco_dept.index_html(showcodes=showcodes, showsemtable=showsemtable)

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.7.5"
SCOVERSION = "9.7.R"
SCONAME = "ScoDoc"