-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathlanguage.html.jinja
More file actions
88 lines (82 loc) · 2.95 KB
/
Copy pathlanguage.html.jinja
File metadata and controls
88 lines (82 loc) · 2.95 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<html lang="en">
<head>
<title>Python Docs Translation Dashboard</title>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8">
<meta name="description" content="Python Docs Translation Dashboard">
<base target="_blank">
</head>
<body>
<h1>Python Docs Translation Dashboard: {{ language.name }}</h1>
<nav class="switchpages">
<a href="index.html" target="_self">main</a> | <a href="metadata.html" target="_self">meta</a>
</nav>
<table>
<thead>
<tr>
<th>path</th>
<th>completion*</th>
</tr>
</thead>
{% for directory in stats.stats_by_directory() %}
<tr class="directory" data-toggle="directory-{{ loop.index }}">
<td>▶ {{ directory.path.name }} ({{ directory.files_stats | length }})</td>
<td data-label="completion">
<div class="progress-bar" style="width: {{ directory.completion }}%;background-color: #4caf50;">
{{ '{:.2f}%'.format(directory.completion) }} ({{ directory.translated }} / {{ directory.entries }})
</div>
<div class="progress-bar-outer-label">
{{ '{:.2f}%'.format(directory.completion) }} ({{ directory.translated }} / {{ directory.entries }})
</div>
</td>
</tr>
<tbody class="files" id="directory-{{ loop.index }}" style="display: none;">
{% for file in directory.files_stats | sort(attribute='filename') %}
<tr>
<td>{{ file.filename }}</td>
<td data-label="completion">
<div class="progress-bar" style="width: {{ file.percent_translated }}%;background-color: #4caf50;">
{{ file.percent_translated }}% ({{ file.translated }} / {{ file.entries }})
</div>
<div class="progress-bar-outer-label">
{{ file.percent_translated }}% ({{ file.translated }} / {{ file.entries }})
</div>
</td>
</tr>
{% endfor %}
</tbody>
{% endfor %}
</table>
<p>* in brackets: number of strings (entries) translated / total</p>
</body>
<script>
function updateProgressBarVisibility() {
document.querySelectorAll('.progress-bar').forEach(progressBar => {
const barWithOverflowWidth = progressBar.scrollWidth;
const barWidth = progressBar.clientWidth;
if (barWidth < barWithOverflowWidth) {
progressBar.classList.add('low');
} else {
progressBar.classList.remove('low');
}
});
}
updateProgressBarVisibility();
window.addEventListener('resize', updateProgressBarVisibility);
document.querySelectorAll('.directory').forEach(directoryRow => {
directoryRow.addEventListener('click', () => {
const toggleId = directoryRow.getAttribute('data-toggle');
const filesTable = document.getElementById(toggleId);
const arrow = directoryRow.querySelector('td:first-child');
if (filesTable.style.display === 'none') {
filesTable.style.display = 'table-row-group';
arrow.textContent = arrow.textContent.replace('▶', '▼');
} else {
filesTable.style.display = 'none';
arrow.textContent = arrow.textContent.replace('▼', '▶');
}
updateProgressBarVisibility();
});
});
</script>
</html>