From d803925b2bd7c1c1ca4a1c97011f65a7b51d988e Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 8 May 2018 15:57:59 +0200 Subject: [PATCH] add ordering in 'vue.ue.manage' by professor name OR volume count | formation list length --- webpack/data/ue.js | 30 +++++++++++++++++++++++++++++- webpack/scss/container/list.scss | 2 ++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/webpack/data/ue.js b/webpack/data/ue.js index 9b2ac34..d739644 100644 --- a/webpack/data/ue.js +++ b/webpack/data/ue.js @@ -1104,7 +1104,35 @@ gstore.add('order_toggle', function(ord_i){ // 4. Get all elements to order 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; + } + } + + }); diff --git a/webpack/scss/container/list.scss b/webpack/scss/container/list.scss index 8ef14d3..6338b6c 100644 --- a/webpack/scss/container/list.scss +++ b/webpack/scss/container/list.scss @@ -22,6 +22,8 @@ /* (1) List element */ & > section{ + order: -100000; + flex: 1 1 90%; display: flex;