Skip to content

Commit f976afd

Browse files
committed
feat: make all sections collapsible (skills, rules, install)
Made-with: Cursor
1 parent 308bf2e commit f976afd

File tree

1 file changed

+70
-29
lines changed

1 file changed

+70
-29
lines changed

site-template/template.html.j2

Lines changed: 70 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@
142142
.section-actions { margin-left: 0; }
143143
}
144144
145+
/* SR ONLY */
146+
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
147+
145148
/* REDUCED MOTION */
146149
@media (prefers-reduced-motion: reduce) {
147150
html { scroll-behavior: auto; }
@@ -199,18 +202,26 @@
199202
<div class="section-header">
200203
<h2>Skills</h2>
201204
<span class="count">{{ skill_count }}</span>
205+
<div class="section-actions">
206+
<button class="btn-sm toggle-section" data-target="skills-body">Collapse</button>
207+
</div>
202208
</div>
203-
<table class="data-table">
204-
<thead><tr><th>Name</th><th>Description</th></tr></thead>
205-
<tbody>
206-
{% for skill in skills %}
207-
<tr>
208-
<td class="name-cell">{{ skill.name }}</td>
209-
<td>{{ skill.description }}</td>
210-
</tr>
211-
{% endfor %}
212-
</tbody>
213-
</table>
209+
<details class="cat-group" id="skills-body" open>
210+
<summary class="sr-only">Skills list</summary>
211+
<div class="cat-body">
212+
<table class="data-table">
213+
<thead><tr><th>Name</th><th>Description</th></tr></thead>
214+
<tbody>
215+
{% for skill in skills %}
216+
<tr>
217+
<td class="name-cell">{{ skill.name }}</td>
218+
<td>{{ skill.description }}</td>
219+
</tr>
220+
{% endfor %}
221+
</tbody>
222+
</table>
223+
</div>
224+
</details>
214225
</section>
215226
{% endif %}
216227

@@ -220,19 +231,27 @@
220231
<div class="section-header">
221232
<h2>Rules</h2>
222233
<span class="count">{{ rule_count }}</span>
234+
<div class="section-actions">
235+
<button class="btn-sm toggle-section" data-target="rules-body">Collapse</button>
236+
</div>
223237
</div>
224-
<table class="data-table">
225-
<thead><tr><th>Name</th><th>Scope</th><th>Description</th></tr></thead>
226-
<tbody>
227-
{% for rule in rules %}
228-
<tr>
229-
<td class="name-cell">{{ rule.name }}</td>
230-
<td class="scope-cell">{{ rule.scope }}</td>
231-
<td>{{ rule.description }}</td>
232-
</tr>
233-
{% endfor %}
234-
</tbody>
235-
</table>
238+
<details class="cat-group" id="rules-body" open>
239+
<summary class="sr-only">Rules list</summary>
240+
<div class="cat-body">
241+
<table class="data-table">
242+
<thead><tr><th>Name</th><th>Scope</th><th>Description</th></tr></thead>
243+
<tbody>
244+
{% for rule in rules %}
245+
<tr>
246+
<td class="name-cell">{{ rule.name }}</td>
247+
<td class="scope-cell">{{ rule.scope }}</td>
248+
<td>{{ rule.description }}</td>
249+
</tr>
250+
{% endfor %}
251+
</tbody>
252+
</table>
253+
</div>
254+
</details>
236255
</section>
237256
{% endif %}
238257

@@ -292,12 +311,22 @@
292311
<!-- Install -->
293312
{% if site.installSteps %}
294313
<section class="section" id="install">
295-
<div class="section-header"><h2>Installation</h2></div>
296-
<ol class="install-steps">
297-
{% for step in site.installSteps %}
298-
<li><span>{{ step | safe }}</span></li>
299-
{% endfor %}
300-
</ol>
314+
<div class="section-header">
315+
<h2>Installation</h2>
316+
<div class="section-actions">
317+
<button class="btn-sm toggle-section" data-target="install-body">Collapse</button>
318+
</div>
319+
</div>
320+
<details class="cat-group" id="install-body" open>
321+
<summary class="sr-only">Installation steps</summary>
322+
<div class="cat-body">
323+
<ol class="install-steps">
324+
{% for step in site.installSteps %}
325+
<li><span>{{ step | safe }}</span></li>
326+
{% endfor %}
327+
</ol>
328+
</div>
329+
</details>
301330
</section>
302331
{% endif %}
303332

@@ -420,6 +449,18 @@
420449
});
421450
})();
422451
452+
/* Section collapse/expand toggles (Skills, Rules) */
453+
(function () {
454+
document.querySelectorAll('.toggle-section').forEach(function (btn) {
455+
var targetId = btn.getAttribute('data-target');
456+
var details = document.getElementById(targetId);
457+
if (!details) return;
458+
function updateLabel() { btn.textContent = details.open ? 'Collapse' : 'Expand'; }
459+
btn.addEventListener('click', function () { details.open = !details.open; updateLabel(); });
460+
details.addEventListener('toggle', updateLabel);
461+
});
462+
})();
463+
423464
/* Scroll spy */
424465
(function () {
425466
var links = document.querySelectorAll('.nav-links a[href^="#"]');

0 commit comments

Comments
 (0)