Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Milleville
SCODOC_R6A06
Commits
cd1efba0
Commit
cd1efba0
authored
2 years ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Tables recap: front: boutons vis cols
parent
27d7a365
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/static/css/scodoc.css
+23
-0
23 additions, 0 deletions
app/static/css/scodoc.css
app/static/js/table_recap.js
+103
-126
103 additions, 126 deletions
app/static/js/table_recap.js
app/tables/recap.py
+1
-0
1 addition, 0 deletions
app/tables/recap.py
with
127 additions
and
126 deletions
app/static/css/scodoc.css
+
23
−
0
View file @
cd1efba0
...
@@ -3992,6 +3992,29 @@ div.table_recap {
...
@@ -3992,6 +3992,29 @@ div.table_recap {
margin-top
:
6px
;
margin-top
:
6px
;
}
}
.table_recap
.but_on
{
background-color
:
rgb
(
177
,
238
,
162
);
font-weight
:
bold
;
}
.table_recap
.but_off
{
background-color
:
lightgray
;
}
.table_recap
button
.but_on
:hover:not
(
.disabled
),
.table_recap
div
.but_on
:hover:not
(
.disabled
),
.table_recap
a
.but_on
:hover:not
(
.disabled
),
.table_recap
input
.but_on
:hover:not
(
.disabled
)
{
background
:
linear-gradient
(
to
bottom
,
lightgray
0%
,
rgb
(
51
,
255
,
0
)
100%
);
}
.table_recap
button
.but_off
:hover:not
(
.disabled
),
.table_recap
div
.but_off
:hover:not
(
.disabled
),
.table_recap
a
.but_off
:hover:not
(
.disabled
),
.table_recap
input
.but_off
:hover:not
(
.disabled
)
{
background
:
linear-gradient
(
to
bottom
,
rgb
(
51
,
255
,
0
)
0%
,
lightgray
100%
);
}
div
.table_recap
table
.table_recap
{
div
.table_recap
table
.table_recap
{
width
:
auto
;
width
:
auto
;
/* font-family: Consolas, monaco, monospace; */
/* font-family: Consolas, monaco, monospace; */
...
...
This diff is collapsed.
Click to expand it.
app/static/js/table_recap.js
+
103
−
126
View file @
cd1efba0
...
@@ -32,146 +32,141 @@ $(function () {
...
@@ -32,146 +32,141 @@ $(function () {
}
}
}
}
// Les colonnes visibles
éta
nt mémorisées, il faut initialiser l
es titres
des boutons
// Les colonnes visibles
so
nt mémorisées, il faut initialiser l
'état
des boutons
function
update_buttons_labels
(
dt
)
{
function
update_buttons_labels
(
dt
)
{
console
.
log
(
"
update_buttons_labels
"
);
// chaque bouton controle une classe stockée dans le data-group du span
dt
.
buttons
(
'
toggle_ident:name
'
).
text
(
dt
.
columns
(
"
.identite_detail
"
).
visible
()[
0
]
?
"
Nom seul
"
:
"
Civ/Nom/Prénom
"
);
document
.
querySelectorAll
(
"
button.dt-button
"
).
forEach
(
but
=>
{
dt
.
buttons
(
'
toggle_partitions:name
'
).
text
(
dt
.
columns
(
"
.partition_aux
"
).
visible
()[
0
]
?
"
Cacher les groupes
"
:
"
Montrer groupes
"
);
let
g_span
=
but
.
querySelector
(
"
span > span
"
);
if
(
!
$
(
'
table.table_recap
'
).
hasClass
(
"
table_jury_but
"
))
{
if
(
g_span
)
{
// Bouton "rangs groupes", sauf pour table jury BUT
let
group
=
g_span
.
dataset
[
"
group
"
];
dt
.
buttons
(
'
toggle_partitions_rangs:name
'
).
text
(
dt
.
columns
(
"
.partition_rangs
"
).
visible
()[
0
]
?
"
Cacher rangs groupes
"
:
"
Rangs groupes
"
);
if
(
group
)
{
dt
.
buttons
(
'
toggle_admission:name
'
).
text
(
dt
.
columns
(
"
.admission
"
).
visible
()[
0
]
?
"
Cacher infos admission
"
:
"
Montrer infos admission
"
);
// si le group (= la 1ere col.) est visible, but_on
if
(
dt
.
columns
(
"
.
"
+
group
).
visible
()[
0
])
{
but
.
classList
.
add
(
"
but_on
"
);
but
.
classList
.
remove
(
"
but_off
"
);
}
else
{
}
else
{
// table jury BUT: avec ou sans codes enregistrés
but
.
classList
.
add
(
"
but_off
"
);
dt
.
buttons
(
'
toggle_recorded_code:name
'
).
text
(
dt
.
columns
(
"
.recorded_code
"
).
visible
()[
0
]
?
"
Cacher codes jury
"
:
"
Code jury enregistrés
"
);
but
.
classList
.
remove
(
"
but_on
"
);
}
}
// Boutons non visibles en mode jury:
if
(
!
$
(
'
table.table_recap
'
).
hasClass
(
"
jury
"
))
{
// Ces boutons dépendent du mode BUT ou classique:
if
(
$
(
'
table.table_recap
'
).
hasClass
(
"
apc
"
))
{
dt
.
buttons
(
'
toggle_res:name
'
).
text
(
dt
.
columns
(
"
.col_res
"
).
visible
()[
0
]
?
"
Cacher les ressources
"
:
"
Montrer les ressources
"
);
dt
.
buttons
(
'
toggle_sae:name
'
).
text
(
dt
.
columns
(
"
.col_sae
"
).
visible
()[
0
]
?
"
Cacher les SAÉs
"
:
"
Montrer les SAÉs
"
);
}
else
{
dt
.
buttons
(
'
toggle_mod:name
'
).
text
(
dt
.
columns
(
"
.col_mod:not(.col_empty)
"
).
visible
()[
0
]
?
"
Cacher les modules
"
:
"
Montrer les modules
"
);
}
}
dt
.
buttons
(
'
toggle_col_empty:name
'
).
text
(
dt
.
columns
(
"
.col_empty
"
).
visible
()[
0
]
?
"
Cacher mod. vides
"
:
"
Montrer mod. vides
"
);
}
}
});
}
}
let
buttons
=
[
// Changement visibilité groupes colonnes (boutons)
{
function
toggle_col_but_visibility
(
e
,
dt
,
node
,
config
)
{
name
:
"
toggle_ident
"
,
let
group
=
node
.
children
()[
0
].
firstChild
.
dataset
.
group
;
text
:
"
Civ/Nom/Prénom
"
,
toggle_col_group_visibility
(
dt
,
group
,
node
.
hasClass
(
"
but_on
"
));
action
:
function
(
e
,
dt
,
node
,
config
)
{
}
let
visible
=
dt
.
columns
(
"
.identite_detail
"
).
visible
()[
0
];
function
toggle_col_ident_visibility
(
e
,
dt
,
node
,
config
)
{
dt
.
columns
(
"
.identite_detail
"
).
visible
(
!
visible
);
let
onoff
=
node
.
hasClass
(
"
but_on
"
);
dt
.
columns
(
"
.identite_court
"
).
visible
(
visible
);
toggle_col_group_visibility
(
dt
,
"
identite_detail
"
,
onoff
);
toggle_col_group_visibility
(
dt
,
"
identite_court
"
,
!
onoff
);
}
function
toggle_col_ressources_visibility
(
e
,
dt
,
node
,
config
)
{
let
onoff
=
node
.
hasClass
(
"
but_on
"
);
toggle_col_group_visibility
(
dt
,
"
col_res
"
,
onoff
);
toggle_col_group_visibility
(
dt
,
"
col_ue_bonus
"
,
onoff
);
toggle_col_group_visibility
(
dt
,
"
col_malus
"
,
onoff
);
}
function
toggle_col_group_visibility
(
dt
,
group
,
onoff
)
{
if
(
onoff
)
{
dt
.
columns
(
'
.
'
+
group
).
visible
(
false
);
}
else
{
dt
.
columns
(
'
.
'
+
group
).
visible
(
true
);
}
update_buttons_labels
(
dt
);
update_buttons_labels
(
dt
);
}
}
// Definition des boutons au dessus de la table:
let
buttons
=
[
{
extend
:
'
copyHtml5
'
,
text
:
'
Copier
'
,
exportOptions
:
{
orthogonal
:
'
export
'
}
},
},
{
{
name
:
"
toggle_partitions
"
,
extend
:
'
excelHtml5
'
,
text
:
"
Montrer groupes
"
,
// footer: true, // ne fonctionne pas ?
exportOptions
:
{
orthogonal
:
'
export
'
},
title
:
document
.
querySelector
(
'
table.table_recap
'
).
dataset
.
filename
},
{
// force affichage de toutes les colonnes
text
:
'
<a title="Afficher toutes les colonnes">✴</a>
'
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
action
:
function
(
e
,
dt
,
node
,
config
)
{
let
visible
=
dt
.
columns
(
"
.partition_aux
"
).
visible
()[
0
];
dt
.
columns
().
visible
(
true
);
dt
.
columns
(
"
.partition_aux
"
).
visible
(
!
visible
);
update_buttons_labels
(
dt
);
update_buttons_labels
(
dt
);
}
}
},
},
];
// Bouton "rangs groupes", sauf pour table jury BUT
if
(
!
$
(
'
table.table_recap
'
).
hasClass
(
"
table_jury_but
"
))
{
buttons
.
push
(
{
{
name
:
"
toggle_partitions_rangs
"
,
text
:
'
<a title="Rétablir l
\'
affichage par défaut">➗</a>
'
,
text
:
"
Rangs groupes
"
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
action
:
function
(
e
,
dt
,
node
,
config
)
{
let
rangs_visible
=
dt
.
columns
(
"
.partition_rangs
"
).
visible
()[
0
]
;
localStorage
.
clear
()
;
dt
.
columns
(
"
.partition_rangs
"
).
visible
(
!
rangs_visible
);
console
.
log
(
"
cleared localStorage
"
);
update_buttons_labels
(
dt
);
location
.
reload
(
);
}
}
});
},
}
else
{
{
// table jury BUT: avec ou sans codes enregistrés
text
:
'
<span data-group="identite_detail">Civilité</span>
'
,
action
:
toggle_col_ident_visibility
,
},
{
text
:
'
<span data-group="partition_aux">Groupes</span>
'
,
action
:
toggle_col_but_visibility
,
},
{
text
:
'
<span data-group="partition_rangs">Rg</span>
'
,
action
:
toggle_col_but_visibility
,
},
];
// fin des boutons communs à toutes les tables recap
if
(
$
(
'
table.table_recap
'
).
hasClass
(
"
jury
"
))
{
// table jury: avec ou sans codes enregistrés
buttons
.
push
(
buttons
.
push
(
{
{
name
:
"
toggle_recorded_code
"
,
text
:
'
<span data-group="recorded_code">Code jurys</span>
'
,
text
:
"
Code jury enregistrés
"
,
action
:
toggle_col_but_visibility
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
let
visible
=
dt
.
columns
(
"
.recorded_code
"
).
visible
()[
0
];
dt
.
columns
(
"
.recorded_code
"
).
visible
(
!
visible
);
update_buttons_labels
(
dt
);
}
});
});
}
}
else
{
// BOUTONS SPECIFIQUES A LA TABLE RECAP NON JURY
if
(
!
$
(
'
table.table_recap
'
).
hasClass
(
"
jury
"
))
{
buttons
.
push
(
buttons
.
push
(
$
(
'
table.table_recap
'
).
hasClass
(
"
apc
"
)
?
$
(
'
table.table_recap
'
).
hasClass
(
"
apc
"
)
?
{
{
name
:
"
toggle_res
"
,
text
:
'
<span data-group="col_res">Ressources</span>
'
,
text
:
"
Visibilité ressources
"
,
action
:
toggle_col_ressources_visibility
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
let
visible
=
dt
.
columns
(
"
.col_res
"
).
visible
()[
0
];
dt
.
columns
(
"
.col_res
"
).
visible
(
!
visible
);
dt
.
columns
(
"
.col_ue_bonus
"
).
visible
(
!
visible
);
dt
.
columns
(
"
.col_malus
"
).
visible
(
!
visible
);
update_buttons_labels
(
dt
);
}
}
:
{
}
:
{
name
:
"
toggle_mod
"
,
name
:
"
toggle_mod
"
,
text
:
"
Cacher les modules
"
,
text
:
"
Cacher les modules
"
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
action
:
function
(
e
,
dt
,
node
,
config
)
{
let
visible
=
dt
.
columns
(
"
.col_mod:not(.col_empty)
"
).
visible
()[
0
];
let
onoff
=
node
.
hasClass
(
"
but_on
"
);
dt
.
columns
(
"
.col_mod:not(.col_empty)
"
).
visible
(
!
visible
);
toggle_col_group_visibility
(
dt
,
"
col_mod:not(.col_empty)
"
,
onoff
);
dt
.
columns
(
"
.col_ue_bonus
"
).
visible
(
!
visible
);
toggle_col_group_visibility
(
dt
,
"
col_ue_bonus
"
,
onoff
);
dt
.
columns
(
"
.col_malus
"
).
visible
(
!
visible
);
toggle_col_group_visibility
(
dt
,
"
col_malus
"
,
onoff
);
update_buttons_labels
(
dt
);
}
}
}
}
);
);
if
(
$
(
'
table.table_recap
'
).
hasClass
(
"
apc
"
))
{
if
(
$
(
'
table.table_recap
'
).
hasClass
(
"
apc
"
))
{
buttons
.
push
({
buttons
.
push
({
name
:
"
toggle_sae
"
,
text
:
'
<span data-group="col_sae">SAÉs</span>
'
,
text
:
"
Visibilité SAÉs
"
,
action
:
toggle_col_but_visibility
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
});
let
visible
=
dt
.
columns
(
"
.col_sae
"
).
visible
()[
0
];
dt
.
columns
(
"
.col_sae
"
).
visible
(
!
visible
);
update_buttons_labels
(
dt
);
}
})
}
buttons
.
push
({
name
:
"
toggle_col_empty
"
,
text
:
"
Visibilité mod. vides
"
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
let
visible
=
dt
.
columns
(
"
.col_empty
"
).
visible
()[
0
];
dt
.
columns
(
"
.col_empty
"
).
visible
(
!
visible
);
update_buttons_labels
(
dt
);
}
})
}
// Boutons admission, sauf pour table jury BUT
if
(
!
$
(
'
table.table_recap
'
).
hasClass
(
"
table_jury_but
"
))
{
buttons
.
push
({
name
:
"
toggle_admission
"
,
text
:
"
Montrer infos admission
"
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
let
visible
=
dt
.
columns
(
"
.admission
"
).
visible
()[
0
];
dt
.
columns
(
"
.admission
"
).
visible
(
!
visible
);
update_buttons_labels
(
dt
);
}
}
buttons
.
push
({
// modules vides
text
:
'
<span data-group="col_empty">Vides</span>
'
,
action
:
toggle_col_but_visibility
,
});
});
// Boutons admission (pas en jury)
if
(
!
$
(
'
table.table_recap
'
).
hasClass
(
"
jury
"
))
{
buttons
.
push
(
{
text
:
'
<span data-group="admission">Admission</span>
'
,
action
:
toggle_col_but_visibility
,
}
}
buttons
.
push
({
);
name
:
"
reset_table_display
"
,
text
:
"
Rétablir affichage par défaut
"
,
action
:
function
(
e
,
dt
,
node
,
config
)
{
localStorage
.
clear
();
location
.
reload
();
}
}
});
}
// ------------- LA TABLE ---------
try
{
try
{
let
table
=
$
(
'
table.table_recap
'
).
DataTable
(
let
table
=
$
(
'
table.table_recap
'
).
DataTable
(
{
{
...
@@ -217,25 +212,7 @@ $(function () {
...
@@ -217,25 +212,7 @@ $(function () {
],
],
dom
:
'
Bfrtip
'
,
dom
:
'
Bfrtip
'
,
buttons
:
[
{
extend
:
'
copyHtml5
'
,
text
:
'
Copier
'
,
exportOptions
:
{
orthogonal
:
'
export
'
}
},
{
extend
:
'
excelHtml5
'
,
// footer: true, // ne fonctionne pas ?
exportOptions
:
{
orthogonal
:
'
export
'
},
title
:
document
.
querySelector
(
'
table.table_recap
'
).
dataset
.
filename
},
{
extend
:
'
collection
'
,
text
:
'
Colonnes affichées
'
,
autoClose
:
true
,
buttons
:
buttons
,
buttons
:
buttons
,
},
],
"
drawCallback
"
:
function
(
settings
)
{
"
drawCallback
"
:
function
(
settings
)
{
// permet de conserver l'ordre de tri des colonnes
// permet de conserver l'ordre de tri des colonnes
let
order_info
=
JSON
.
stringify
(
$
(
'
table.table_recap
'
).
DataTable
().
order
());
let
order_info
=
JSON
.
stringify
(
$
(
'
table.table_recap
'
).
DataTable
().
order
());
...
...
This diff is collapsed.
Click to expand it.
app/tables/recap.py
+
1
−
0
View file @
cd1efba0
...
@@ -82,6 +82,7 @@ class TableRecap(tb.Table):
...
@@ -82,6 +82,7 @@ class TableRecap(tb.Table):
if
res
.
formsemestre
.
etuds_inscriptions
:
# table non vide
if
res
.
formsemestre
.
etuds_inscriptions
:
# table non vide
# Fixe l'ordre des groupes de colonnes communs:
# Fixe l'ordre des groupes de colonnes communs:
groups
=
[
groups
=
[
"
etud_codes
"
,
"
rang
"
,
"
rang
"
,
"
identite_court
"
,
"
identite_court
"
,
"
identite_detail
"
,
"
identite_detail
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment