Skip to content

Commit f38dbb6

Browse files
authored
refactor(admin): group the settings page into sections (#178)
* refactor(admin): group the settings page into sections The admin page was one long list of fields. It is now split into "Etherpad server", "Pad types and behaviour", "External pads and embedding" and "Diagnostics", with the pad type toggles at the top of their section and the field hints tied to their inputs. Saving and the diagnostic tools report next to their own buttons instead of into a single shared status line, so feedback appears where the action was triggered. The two areas update independently – a late response no longer clears the other one's result. Hints are linked with aria-describedby, the dynamic "no pad type enabled" hint announces itself via role="status", and spacing is set with explicit row classes rather than negative margins. Adds tests/js/admin-settings.test.js, the first coverage for src/admin-settings.js. * Address PR review comments - The Playwright health-check helper still read the save status node, so the admin health check spec would have failed against the new markup. - Diagnostics fall back to the save status area when the diagnostics area is absent, instead of silently dropping the feedback. - The new unit tests mocked responses without `ok: true`, so they ran through the error path; they now assert the success path explicitly. * Make the pad type hint announce, prefix its sibling hint ids role="status" was set on an element toggled via `display`, so the text arrived as initial content rather than a change and screen readers commonly stayed silent. The element is now always rendered and the script writes or clears its text, which is what a live region reacts to; an empty hint collapses via `.ep-field-hint:empty`, so nothing moves visually. Re-rendering identical text is skipped so a server-rendered message is not announced on load. The six new hint ids gain the app's `epnc-` prefix, matching every other id in the template. * Trim the comments added while reviewing The explanations were written for the review and read as heavy in the final code. Kept only the reasoning that is not visible from the code itself, at roughly a third the length.
1 parent 04ef397 commit f38dbb6

14 files changed

Lines changed: 424 additions & 79 deletions

css/admin-settings.css

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,73 @@
1010
display: block;
1111
}
1212

13+
/* Rows followed by a hint set their own gap, so it does not depend on
14+
whichever `p` rule wins. */
15+
#etherpad-nextcloud-admin-settings .ep-field-row {
16+
margin-bottom: 4px;
17+
}
18+
1319
#etherpad-nextcloud-admin-settings .ep-field-hint {
14-
margin-top: -8px;
20+
margin-top: 0;
1521
margin-bottom: 14px;
22+
max-width: 640px;
23+
color: var(--color-text-maxcontrast);
1624
}
1725

18-
#etherpad-nextcloud-admin-settings #allow-external-pads-row {
19-
margin-bottom: 6px;
26+
/* Lets the script empty a live region instead of hiding it — see
27+
updatePadTypesHint(). */
28+
#etherpad-nextcloud-admin-settings .ep-field-hint:empty {
29+
margin: 0;
2030
}
2131

22-
#etherpad-nextcloud-admin-settings #external-pad-allowlist-row {
23-
margin-bottom: 6px;
32+
/* A reported value, not an explanation: no muted hint styling. */
33+
#etherpad-nextcloud-admin-settings .ep-detected-value {
34+
margin-top: 0;
35+
margin-bottom: 14px;
2436
}
2537

26-
#etherpad-nextcloud-admin-settings #external-pad-allowlist-hint {
27-
margin-top: 0;
38+
/* An option and its description form one block: tight between them,
39+
clear gap to the next option, hint indented under the label text. */
40+
#etherpad-nextcloud-admin-settings .ep-checkbox-row {
41+
margin-bottom: 0;
42+
}
43+
44+
#etherpad-nextcloud-admin-settings .ep-checkbox-row label {
45+
margin-bottom: 0;
2846
}
2947

48+
#etherpad-nextcloud-admin-settings .ep-checkbox-hint {
49+
margin-top: 2px;
50+
margin-bottom: 22px;
51+
padding-left: 26px;
52+
}
53+
54+
/* Dark and bold like Nextcloud's own section names; muted or uppercase
55+
would read as secondary text next to the field labels. */
56+
#etherpad-nextcloud-admin-settings .ep-section-heading {
57+
margin: 0 0 14px;
58+
padding-top: 22px;
59+
border-top: 1px solid var(--color-border);
60+
font-size: 1.2em;
61+
font-weight: bold;
62+
color: var(--color-main-text);
63+
}
64+
65+
#etherpad-nextcloud-admin-settings form > .ep-section-heading:first-child {
66+
padding-top: 0;
67+
border-top: none;
68+
}
69+
70+
#etherpad-nextcloud-admin-settings #allow-external-pads-row {
71+
margin-bottom: 6px;
72+
}
73+
74+
/* Nextcloud mutes form labels; field names are primary content here. */
3075
#etherpad-nextcloud-admin-settings label {
3176
display: block;
3277
font-weight: 600;
3378
margin-bottom: 6px;
79+
color: var(--color-main-text);
3480
}
3581

3682
#etherpad-nextcloud-admin-settings input[type="url"],
@@ -42,11 +88,13 @@
4288
max-width: 640px;
4389
}
4490

91+
/* Same reason, plus weight: the option heads its own block. */
4592
#etherpad-nextcloud-admin-settings label.checkbox {
4693
display: inline-flex;
4794
align-items: center;
4895
gap: 8px;
49-
font-weight: 400;
96+
font-weight: 600;
97+
color: var(--color-main-text);
5098
}
5199

52100
#etherpad-nextcloud-admin-settings .etherpad-nextcloud-admin-actions {
@@ -55,8 +103,8 @@
55103
gap: 10px;
56104
}
57105

58-
#etherpad-nextcloud-admin-settings #etherpad-nextcloud-admin-status.ep-status-success,
59-
#etherpad-nextcloud-admin-settings #etherpad-nextcloud-admin-status.ep-status-error {
106+
#etherpad-nextcloud-admin-settings .ep-status.ep-status-success,
107+
#etherpad-nextcloud-admin-settings .ep-status.ep-status-error {
60108
color: var(--color-main-text, var(--color-text-maxcontrast, #1f2937));
61109
}
62110

js/etherpad_nextcloud-admin-settings.mjs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/etherpad_nextcloud-admin-settings.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)