Skip to content

Commit 95c2ab9

Browse files
committed
Add toggling
1 parent 4b49f01 commit 95c2ab9

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

language.html.jinja

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
<th>completion*</th>
1919
</tr>
2020
</thead>
21-
<tbody>
2221
{% for directory in stats.stats_by_directory() %}
23-
<tr>
22+
<tr class="directory" data-toggle="directory-{{ loop.index }}">
2423
<td>▶ {{ directory.path.name }} ({{ directory.files_stats | length }})</td>
2524
<td data-label="completion">
2625
<div class="progress-bar" style="width: {{ directory.completion }}%;background-color: #4caf50;">
@@ -31,6 +30,7 @@
3130
</div>
3231
</td>
3332
</tr>
33+
<tbody class="files" id="directory-{{ loop.index }}" style="display: none;">
3434
{% for file in directory.files_stats | sort(attribute='filename') %}
3535
<tr>
3636
<td>{{ file.filename }}</td>
@@ -44,8 +44,8 @@
4444
</td>
4545
</tr>
4646
{% endfor %}
47-
{% endfor %}
4847
</tbody>
48+
{% endfor %}
4949
</table>
5050
<p>* in brackets: number of strings (entries) translated / total</p>
5151
</body>
@@ -66,5 +66,23 @@
6666
updateProgressBarVisibility();
6767
6868
window.addEventListener('resize', updateProgressBarVisibility);
69+
70+
document.querySelectorAll('.directory').forEach(directoryRow => {
71+
directoryRow.addEventListener('click', () => {
72+
const toggleId = directoryRow.getAttribute('data-toggle');
73+
const filesTable = document.getElementById(toggleId);
74+
const arrow = directoryRow.querySelector('td:first-child');
75+
76+
if (filesTable.style.display === 'none') {
77+
filesTable.style.display = 'table-row-group';
78+
arrow.textContent = arrow.textContent.replace('', '');
79+
} else {
80+
filesTable.style.display = 'none';
81+
arrow.textContent = arrow.textContent.replace('', '');
82+
}
83+
84+
updateProgressBarVisibility();
85+
});
86+
});
6987
</script>
7088
</html>

style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ td[data-label="completion"] {
5353
right: 10px;
5454
}
5555

56+
.directory {
57+
cursor: pointer;
58+
}
59+
5660
@media screen and (max-width: 675px) {
5761
.switchpages{
5862
all: unset;

0 commit comments

Comments
 (0)