feat: Class-specific announcements

This commit is contained in:
2026-06-02 17:12:30 +02:00
parent fdcacc738d
commit 20b221acc8
4 changed files with 76 additions and 11 deletions
+28 -1
View File
@@ -42,6 +42,9 @@
.cell-actions {{ white-space: nowrap; }}
.flag {{ display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; background: #dbeafe; color: #1e40af; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }}
.class-pill {{ display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; background: #f0fdf4; color: #166534; font-size: 0.75rem; font-weight: 500; white-space: nowrap; }}
.class-pill.all {{ background: #f1f5f9; color: #64748b; font-style: italic; }}
.field-hint {{ font-size: 0.8rem; color: #94a3b8; font-weight: 400; }}
.empty {{ padding: 3rem 1rem; text-align: center; color: #94a3b8; font-size: 0.95rem; }}
.pagination {{ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 1rem 1.25rem; background: #fff; border-top: 1px solid #e2e8f0; }}
@@ -93,6 +96,7 @@
<th>Text</th>
<th>Start</th>
<th>End</th>
<th>For</th>
<th>Flags</th>
<th>Actions</th>
</tr>
@@ -125,7 +129,12 @@
End date
<input type="date" name="end_date" required>
</label>
<label style="gap:0.5rem">
<label>
Classes
<input id="classes-input" name="classes" placeholder="e.g. C2c, A1" autocomplete="off">
<span class="field-hint">Leave empty for all classes. Separate multiple with commas.</span>
</label>
<label id="flags-section" style="gap:0.5rem">
Flags
<div class="flag-checkboxes">
{flags_checkboxes}
@@ -138,5 +147,23 @@
</div>
</form>
</dialog>
<script>
document.addEventListener('DOMContentLoaded', function() {{
var classesInput = document.getElementById('classes-input');
var flagsSection = document.getElementById('flags-section');
function toggleFlags() {{
if (classesInput.value.trim() !== '') {{
flagsSection.style.display = 'none';
var cbs = flagsSection.querySelectorAll('input[type="checkbox"]');
for (var i = 0; i < cbs.length; i++) {{ cbs[i].checked = false; }}
}} else {{
flagsSection.style.display = '';
}}
}}
classesInput.addEventListener('input', toggleFlags);
toggleFlags();
}});
</script>
</body>
</html>