-
Notifications
You must be signed in to change notification settings - Fork 1
/
listeTPs.html
73 lines (65 loc) · 2.56 KB
/
listeTPs.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
layout: default
title: TPs
header_title: Listes des travaux pratiques
---
<div class="card">
<h5 class="card-header" style="text-decoration: none;" >
<a class="collapsed d-block" style="color:#173b6c" data-toggle="collapse" href="#collapse-collapsed_filters" aria-expanded="true" aria-controls="collapse-collapsed_filters" id="heading-collapsed">
<i class="fa fa-chevron-down float-right"></i>
Filtrer
</a>
</h5>
<div id="collapse-collapsed_filters" class="collapse" aria-labelledby="heading-collapsed">
<div class="card-body">
<b>Par module</b>
<select class="form-control" id="filterModule" >
<option> Tous </option>
{% assign listeDesModules = site.modules | sort:"numeroModule" %}
{% for s in listeDesModules %}
<option> {{ s.numeroModule}}</option>
{% endfor %}
</select>
<br>
<div class="text-right">
<button class="btn btn-primary" onclick="javascript:showHideFUnction();"> <i class="fas fa-filter"></i> Filter</button>
</div>
</div>
</div>
</div>
<br>
{% assign listeSequences_to_max = site.sequences | where:"numeroModule", include.itemModule.numeroModule %}
{% assign max_value = 0 | plus: 0 %}
{% for item in listeSequences_to_max %}
{% assign inter_test = item.numeroEdition[0] | to_integer %}
{% if inter_test > max_value %}
{% assign max_value = inter_test %}
{% endif %}
{% endfor %}
{% assign listeDesTPs = site.sequences | where:"type", "tp" | where:"numeroEdition", max_value | group_by: "numeroModule" %}
{% assign listeDesTPs = listeDesTPs | sort: "numeroSequence" %}
{% for group in listeDesTPs %}
<h4 name='module_{{group.name}}'>Module {{group.name}}</h4>
{% for item in group.items %}
{% include sequenceCard.html itemSequence=item %}
{% endfor %}
{% endfor %}
<script>
function showHideFUnction() {
var nbModules = {{ site.modules | size }};
var value = document.getElementById("filterModule").value;
if(value == "Tous"){
for (var i = 1; i <= nbModules; i++) {
document.getElementsByName('module_' + i ).forEach(function(entry) { entry.style.display = 'block';});
}
} else {
for (var i = 1; i <= nbModules; i++) {
if(i == value){
document.getElementsByName('module_' + i ).forEach(function(entry) { entry.style.display = 'block';});
} else {
document.getElementsByName('module_' + i ).forEach(function(entry) { entry.style.display = 'none';});
}
}
}
}
</script>