add ordering in 'vue.ue.manage' by professor name OR volume count | formation list length

This commit is contained in:
xdrm-brackets 2018-05-08 15:57:59 +02:00
parent bc5d2fff19
commit d803925b2b
2 changed files with 31 additions and 1 deletions

View File

@ -1104,7 +1104,35 @@ gstore.add('order_toggle', function(ord_i){
// 4. Get all elements to order // 4. Get all elements to order
let els = document.querySelectorAll('section[data-prof][data-vol][data-form]'); let els = document.querySelectorAll('section[data-prof][data-vol][data-form]');
// 5. Ordering by 'prof' // 5. Ordering by formations
if( gstore.get.order.current === 2 ){
return els.forEach((el) => {
el.style.order = el.getAttribute('data-form').split('|').length * gstore.get.order.way
});
}
// 6. Ordering by 'volume'
if( gstore.get.order.current === 1 )
return els.forEach((el) => {
el.style.order = parseInt( el.getAttribute('data-vol') ) * gstore.get.order.way
});
// 7. Ordering by 'prof'
els.forEach((el) => {
var profId = parseInt( el.getAttribute('data-prof') );
// outside by default if no prof set
el.style.order = - gstore.get.order.way;
// professors are already sorted
for( pi in gstore.get.manage.prof ) {
if( gstore.get.manage.prof[pi].idProfesseur == profId ){
el.style.order = pi * gstore.get.order.way;
break;
}
}
});

View File

@ -22,6 +22,8 @@
/* (1) List element */ /* (1) List element */
& > section{ & > section{
order: -100000;
flex: 1 1 90%; flex: 1 1 90%;
display: flex; display: flex;