bible270 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -32
  3. data/README.md +129 -58
  4. data/Rakefile +3 -2
  5. data/app/controllers/bible270/admin_controller.rb +152 -33
  6. data/app/controllers/bible270/admin_roles_controller.rb +50 -0
  7. data/app/controllers/bible270/admin_scripture_frames_controller.rb +89 -0
  8. data/app/controllers/bible270/application_controller.rb +18 -2
  9. data/app/controllers/bible270/checkoffs_controller.rb +38 -9
  10. data/app/controllers/bible270/readers_controller.rb +1 -1
  11. data/app/controllers/bible270/scripture_frames_controller.rb +16 -0
  12. data/app/helpers/bible270/plan_helper.rb +4 -4
  13. data/app/mailers/bible270/notice_mailer.rb +2 -2
  14. data/app/models/bible270/checkoff.rb +69 -3
  15. data/app/models/bible270/participation.rb +71 -0
  16. data/app/models/bible270/plan_run.rb +121 -0
  17. data/app/models/bible270/reader.rb +142 -24
  18. data/app/models/bible270/scripture_frame.rb +48 -0
  19. data/app/models/bible270/setting.rb +13 -4
  20. data/app/views/bible270/admin/_reader_list.html.erb +55 -0
  21. data/app/views/bible270/admin/_scripture_frames.html.erb +34 -0
  22. data/app/views/bible270/admin/_scripture_text.html.erb +11 -0
  23. data/app/views/bible270/admin/index.html.erb +64 -49
  24. data/app/views/bible270/admin/show.html.erb +117 -54
  25. data/app/views/bible270/admin_scripture_frames/_form.html.erb +72 -0
  26. data/app/views/bible270/admin_scripture_frames/edit.html.erb +4 -0
  27. data/app/views/bible270/admin_scripture_frames/new.html.erb +4 -0
  28. data/app/views/bible270/days/_day_progress.html.erb +2 -2
  29. data/app/views/bible270/days/_reading.html.erb +5 -4
  30. data/app/views/bible270/profiles/edit.html.erb +14 -12
  31. data/app/views/bible270/readers/show.html.erb +1 -1
  32. data/app/views/bible270/shared/_admin_confirmations.html.erb +16 -0
  33. data/app/views/bible270/shared/_admin_reader_list_ui.html.erb +49 -0
  34. data/app/views/bible270/shared/_day_completion.html.erb +13 -0
  35. data/app/views/bible270/shared/_day_completion_ui.html.erb +152 -0
  36. data/app/views/bible270/shared/_day_index.html.erb +2 -1
  37. data/app/views/bible270/shared/_header.html.erb +12 -4
  38. data/app/views/bible270/shared/_interaction_ui.html.erb +2 -62
  39. data/app/views/bible270/shared/_scripture_frame.html.erb +14 -0
  40. data/app/views/bible270/shared/_scripture_frame_ui.html.erb +247 -0
  41. data/app/views/bible270/shared/_scripture_library_ui.html.erb +34 -0
  42. data/app/views/bible270/shared/_styles.html.erb +141 -10
  43. data/app/views/layouts/bible270/application.html.erb +8 -0
  44. data/config/routes.rb +9 -2
  45. data/config/scripture_frames.yml +134 -0
  46. data/db/migrate/20260101000024_create_bible270_plan_runs.rb +60 -0
  47. data/db/migrate/20260101000025_add_admin_to_bible270_readers.rb +7 -0
  48. data/db/migrate/20260101000026_add_revert_to_bible270_plan_runs.rb +8 -0
  49. data/db/migrate/20260101000027_create_bible270_scripture_frames.rb +16 -0
  50. data/lib/bible270/configuration.rb +17 -4
  51. data/lib/bible270/migration_reconciler.rb +91 -8
  52. data/lib/bible270/reader_consistency.rb +8 -4
  53. data/lib/bible270/reader_progress_report.rb +2 -1
  54. data/lib/bible270/scripture_frames.rb +226 -0
  55. data/lib/bible270/version.rb +1 -1
  56. data/lib/bible270.rb +1 -0
  57. data/lib/generators/bible270/install/templates/bible270.rb.tt +8 -1
  58. metadata +26 -1
@@ -0,0 +1,247 @@
1
+ <div id="b270-scripture-frame" class="b270-scripture-popup" role="dialog" aria-modal="false"
2
+ aria-label="Scripture frame" tabindex="-1" hidden>
3
+
4
+ <p class="b270-scripture-popup__status" data-b270-scripture-status role="status" aria-live="polite" aria-atomic="true"></p>
5
+ <%= render partial: "bible270/shared/scripture_frame", locals: { frame: nil } %>
6
+ </div>
7
+
8
+ <script nonce="<%= content_security_policy_nonce %>">
9
+ (() => {
10
+ if (window.Bible270ScriptureFrame) {
11
+ window.Bible270ScriptureFrame.reset();
12
+ return;
13
+ }
14
+
15
+ const selector = "button[data-b270-scripture-trigger]";
16
+ const finePointer = window.matchMedia?.("(hover: hover) and (pointer: fine)");
17
+ const reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
18
+ let active = null;
19
+ let previousID = null;
20
+ let fadingPopup = null;
21
+ let fadeTimer = null;
22
+ let lastPointerType = null;
23
+
24
+ function finishFade() {
25
+ clearTimeout(fadeTimer);
26
+ fadeTimer = null;
27
+ if (fadingPopup) fadingPopup.hidden = true;
28
+ fadingPopup = null;
29
+ }
30
+
31
+ function within(state, target) {
32
+ return !!target && (state.trigger.contains(target) || state.popup.contains(target));
33
+ }
34
+
35
+ function current(state) {
36
+ return active === state && state.trigger.isConnected && state.popup.isConnected;
37
+ }
38
+
39
+ function reset(immediate = true, restoreFocus = false) {
40
+ finishFade();
41
+ const state = active;
42
+ active = null;
43
+ if (!state) return;
44
+
45
+ clearTimeout(state.timer);
46
+ clearTimeout(state.leaveTimer);
47
+ clearTimeout(state.focusTimer);
48
+ state.controller?.abort();
49
+ state.trigger.setAttribute("aria-expanded", "false");
50
+ if (restoreFocus && state.trigger.isConnected && (state.focusMode || state.popup.contains(document.activeElement))) {
51
+ state.trigger.focus();
52
+ }
53
+ state.popup.classList.remove("is-visible");
54
+ state.popup.setAttribute("aria-hidden", "true");
55
+ state.popup.removeAttribute("aria-busy");
56
+ state.popup.inert = true;
57
+ if (immediate || reducedMotion?.matches || state.popup.hidden) {
58
+ state.popup.hidden = true;
59
+ } else {
60
+ fadingPopup = state.popup;
61
+ fadeTimer = setTimeout(finishFade, 180);
62
+ }
63
+ }
64
+
65
+ function position(state) {
66
+ const trigger = state.trigger.getBoundingClientRect();
67
+ const popup = state.popup.getBoundingClientRect();
68
+ const margin = 12;
69
+ state.popup.style.left = `${Math.max(margin, Math.min(trigger.left, window.innerWidth - popup.width - margin))}px`;
70
+ state.popup.style.top = `${Math.max(margin, Math.min(trigger.bottom + 12, window.innerHeight - popup.height - margin))}px`;
71
+ }
72
+
73
+ function status(state, message, kind) {
74
+ state.status.textContent = message;
75
+ state.status.hidden = !message;
76
+ state.status.setAttribute("data-state", kind);
77
+ state.popup.setAttribute("aria-busy", String(kind === "loading"));
78
+ }
79
+
80
+ async function open(state) {
81
+ if (!current(state)) return;
82
+ state.timer = null;
83
+ state.popup.hidden = false;
84
+ state.popup.inert = false;
85
+ state.popup.removeAttribute("aria-hidden");
86
+ state.art.hidden = true;
87
+ state.trigger.setAttribute("aria-expanded", "true");
88
+ status(state, "Loading Scripture frame…", "loading");
89
+ position(state);
90
+ state.popup.classList.add("is-visible");
91
+ if (state.focusMode) state.popup.focus();
92
+ state.controller = new AbortController();
93
+
94
+ try {
95
+ const url = new URL(state.trigger.getAttribute("data-b270-scripture-url"), window.location.href);
96
+ if (previousID !== null) url.searchParams.set("exclude", previousID);
97
+ const response = await fetch(url.href, {
98
+ headers: { Accept: "application/json" }, credentials: "same-origin", signal: state.controller.signal
99
+ });
100
+ if (!current(state)) return;
101
+ if (response.status === 204) {
102
+ status(state, "No Scripture frames are available yet.", "empty");
103
+ } else {
104
+ if (!response.ok) throw new Error("Scripture frame request failed");
105
+ const frame = await response.json();
106
+ if (!current(state)) return;
107
+ if (!frame || !["reference", "text", "translation"].every((key) => typeof frame[key] === "string" && frame[key].trim()) ||
108
+ (frame.attribution != null && typeof frame.attribution !== "string")) {
109
+ throw new Error("Invalid Scripture frame");
110
+ }
111
+ ["reference", "text", "translation", "attribution"].forEach((key) => {
112
+ const field = state.art.querySelector(`[data-b270-scripture-${key}]`);
113
+ const omit = frame.translation === "OTHER" && (key === "translation" || key === "attribution");
114
+ field.textContent = omit ? "" : (frame[key] || "");
115
+ if (key === "translation" || key === "attribution") field.hidden = omit || !frame[key]?.trim();
116
+ });
117
+ previousID = frame.id == null ? null : String(frame.id);
118
+ state.art.hidden = false;
119
+ status(state, "", "ready");
120
+ }
121
+ position(state);
122
+ } catch (error) {
123
+ if (!current(state)) return;
124
+ status(state, "This Scripture frame could not be loaded. Please try again.", "error");
125
+ position(state);
126
+ }
127
+ }
128
+
129
+ function begin(trigger, manual = false, focusMode = false) {
130
+ reset();
131
+ const popup = document.getElementById(trigger.getAttribute("aria-controls"));
132
+ if (!trigger.isConnected || !popup) return;
133
+ const state = {
134
+ trigger, popup, art: popup.querySelector("[data-b270-scripture-art]"),
135
+ status: popup.querySelector("[data-b270-scripture-status]"),
136
+ pinned: manual, focusMode, timer: null, leaveTimer: null, focusTimer: null, controller: null
137
+ };
138
+ active = state;
139
+ if (manual) {
140
+ open(state);
141
+ } else {
142
+ state.timer = setTimeout(() => {
143
+ if (!current(state) || !finePointer?.matches) {
144
+ if (active === state) reset();
145
+ return;
146
+ }
147
+ open(state);
148
+ }, 3000);
149
+ }
150
+ }
151
+
152
+ document.addEventListener("pointerover", (event) => {
153
+ if (!finePointer?.matches || !["mouse", "pen"].includes(event.pointerType)) return;
154
+ if (active && within(active, event.target)) {
155
+ clearTimeout(active.leaveTimer);
156
+ return;
157
+ }
158
+ const trigger = event.target.closest?.(selector);
159
+ // Descendant transitions are not fresh intent, including after Escape dismisses the frame.
160
+ if (trigger && !trigger.contains(event.relatedTarget)) begin(trigger);
161
+ });
162
+
163
+ document.addEventListener("pointerout", (event) => {
164
+ const state = active;
165
+ if (!state || state.pinned || !within(state, event.target) || within(state, event.relatedTarget)) return;
166
+ if (state.timer !== null) {
167
+ reset();
168
+ } else {
169
+ clearTimeout(state.leaveTimer);
170
+ state.leaveTimer = setTimeout(() => {
171
+ if (active === state) reset(false);
172
+ }, 220);
173
+ }
174
+ });
175
+
176
+ document.addEventListener("pointerdown", (event) => {
177
+ lastPointerType = event.pointerType;
178
+ event.target.closest?.(selector)?.setAttribute("data-b270-scripture-pointer-focus", "");
179
+ if (active && !within(active, event.target)) reset(false);
180
+ });
181
+
182
+ document.addEventListener("click", (event) => {
183
+ const trigger = event.target.closest?.(selector);
184
+ if (trigger) {
185
+ if (event.detail !== 0) trigger.setAttribute("data-b270-scripture-pointer-focus", "");
186
+ const focusMode = event.detail === 0 || event.pointerType === "touch" || lastPointerType === "touch" || !finePointer?.matches;
187
+ if (active?.trigger === trigger) {
188
+ if (active.pinned) {
189
+ reset(false, true);
190
+ } else {
191
+ active.pinned = true;
192
+ active.focusMode = focusMode;
193
+ clearTimeout(active.leaveTimer);
194
+ if (active.timer !== null) {
195
+ clearTimeout(active.timer);
196
+ open(active);
197
+ } else if (focusMode) {
198
+ active.popup.focus();
199
+ }
200
+ }
201
+ } else {
202
+ begin(trigger, true, focusMode);
203
+ }
204
+ return;
205
+ }
206
+ if (active && !within(active, event.target)) reset(false);
207
+ });
208
+
209
+ // Native button activation supplies Enter/Space clicks; no parallel key handler is needed.
210
+ document.addEventListener("keydown", (event) => {
211
+ lastPointerType = null;
212
+ // Escape dismisses pointer-opened frames without changing their focus modality.
213
+ if (event.key !== "Escape") {
214
+ document.querySelectorAll("[data-b270-scripture-pointer-focus]").forEach((trigger) => {
215
+ trigger.removeAttribute("data-b270-scripture-pointer-focus");
216
+ });
217
+ }
218
+ if (event.key !== "Escape" || !active) return;
219
+ reset(false, true);
220
+ event.preventDefault();
221
+ });
222
+
223
+ document.addEventListener("focusout", (event) => {
224
+ const state = active;
225
+ if (!state || !within(state, event.target) || within(state, event.relatedTarget)) return;
226
+ if (event.relatedTarget) {
227
+ reset(false);
228
+ } else {
229
+ clearTimeout(state.focusTimer);
230
+ state.focusTimer = setTimeout(() => {
231
+ if (active === state && !within(state, document.activeElement)) reset(false);
232
+ }, 0);
233
+ }
234
+ });
235
+
236
+ document.addEventListener("scroll", (event) => {
237
+ if (active?.popup.contains(event.target)) return;
238
+ reset(false);
239
+ }, true);
240
+ window.addEventListener("resize", () => reset(false));
241
+ window.addEventListener("pagehide", () => reset());
242
+ document.addEventListener("turbo:before-cache", () => reset());
243
+ document.addEventListener("turbo:before-render", () => reset());
244
+
245
+ window.Bible270ScriptureFrame = { reset };
246
+ })();
247
+ </script>
@@ -0,0 +1,34 @@
1
+ <script nonce="<%= content_security_policy_nonce %>" data-b270-scripture-library-ui>
2
+ (() => {
3
+ if (window.Bible270ScriptureLibrary) return;
4
+ window.Bible270ScriptureLibrary = true;
5
+
6
+ const selector = "details.b270-scripture-library-disclosure";
7
+ const dismissed = "data-b270-scripture-preview-dismissed";
8
+
9
+ // Suppress hover/focus preview before the native summary click closes details.
10
+ document.addEventListener("click", (event) => {
11
+ if (event.defaultPrevented) return;
12
+ const summary = event.target.closest?.("summary");
13
+ const disclosure = summary?.parentElement;
14
+ if (!disclosure?.matches(selector)) return;
15
+ if (disclosure.open) disclosure.setAttribute(dismissed, "");
16
+ else disclosure.removeAttribute(dismissed);
17
+ });
18
+
19
+ document.addEventListener("toggle", (event) => {
20
+ const disclosure = event.target;
21
+ if (!disclosure.matches?.(selector)) return;
22
+ if (disclosure.open) disclosure.removeAttribute(dismissed);
23
+ else disclosure.setAttribute(dismissed, "");
24
+ }, true);
25
+
26
+ function freshPreview(event) {
27
+ const disclosure = event.target.closest?.(selector);
28
+ if (disclosure && !disclosure.contains(event.relatedTarget)) disclosure.removeAttribute(dismissed);
29
+ }
30
+
31
+ document.addEventListener("pointerover", freshPreview);
32
+ document.addEventListener("focusin", freshPreview);
33
+ })();
34
+ </script>
@@ -154,8 +154,11 @@
154
154
  .b270-theme-scenery[data-scenery="light"]{height:100%;overflow:hidden}
155
155
  .b270-papyrus-grid{transform-box:view-box;transform:translateY(calc(100% - clamp(380px,76vh,820px) * .7))}
156
156
  .b270-papyrus-opposite{transform-box:view-box;transform-origin:0 0;transform:translate(100%,100%) rotate(180deg)}
157
- @media (max-width:600px){
158
- .b270-papyrus-corner{transform:scale(.55)}
157
+ @media (max-width:1100px){
158
+ .b270-papyrus-corner{transform:scale(.4)}
159
+ }
160
+ @media (max-width:820px){
161
+ .b270-papyrus-corner{transform:scale(.35)}
159
162
  }
160
163
  .b270-theme-scenery[data-scenery="dark"]{height:100%}
161
164
  .b270-theme-scenery[data-scenery="sage_sky"]{height:100%}
@@ -225,7 +228,8 @@
225
228
  .b270-wrap{max-width:var(--b270-content-width);margin:0 auto;padding:clamp(14px,3.5vw,36px) clamp(14px,4vw,40px) 64px}
226
229
 
227
230
  .b270-topbar{display:flex;align-items:center;gap:12px;flex-wrap:nowrap;padding-bottom:20px;border-bottom:1px solid var(--line-soft);margin-bottom:26px}
228
- .b270-brand{display:flex;align-items:baseline;gap:14px;margin-right:auto;min-width:0}
231
+ .b270-brand{display:flex;align-items:center;flex:1;flex-wrap:wrap;gap:8px 14px;margin-right:auto;min-width:0}
232
+ .b270-brand-home{display:flex;align-items:center;gap:6px;flex:1 1 160px;min-width:0;max-width:100%}
229
233
  .b270-header-theme{position:relative;display:flex;align-items:baseline;gap:4px;margin:0;flex:none}
230
234
  .b270-header-theme-select{font:inherit;font-size:12px;width:8em;height:28px;padding:2px 6px;margin:0;
231
235
  border:1px solid var(--line);border-radius:6px;background:var(--card);color:var(--ink);cursor:pointer}
@@ -238,11 +242,17 @@
238
242
  .b270-header-theme-status[data-error="true"]{position:absolute;z-index:30;right:0;top:calc(100% + 6px);width:220px;max-width:calc(100vw - 28px);
239
243
  padding:8px 10px;border:1px solid var(--alert-line);border-radius:8px;background:var(--alert-surface);
240
244
  color:var(--alert-ink);font-size:12px;line-height:1.5;box-shadow:var(--shadow)}
241
- /* The whole brand is one link, so the mark and the words highlight together. */
242
- .b270-brandlink{display:flex;align-items:baseline;gap:6px;text-decoration:none;min-width:0}
245
+ /* The title links home; the separate mark button opens a Scripture frame. */
246
+ .b270-brandlink{display:flex;align-items:center;gap:6px;text-decoration:none;min-width:0}
243
247
  .b270-mark{display:flex;align-items:center;align-self:center;flex:none;line-height:0}
244
- .b270-mark svg,.b270-mark img,.b270-brandlink > img.b270-mark{display:block;width:28px;height:28px;border-radius:8px}
245
- .b270-title{font-family:"Spectral",Georgia,serif;font-weight:600;font-size:18px;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
248
+ .b270-mark svg,.b270-mark img,.b270-brandlink > img.b270-mark,.b270-scripture-trigger > img.b270-mark{display:block;width:34px;height:34px;border-radius:8px;object-fit:contain}
249
+ /* Only the inline header board follows the theme; the golden loaf and favicon stay unchanged. */
250
+ .b270-scripture-trigger .b270-mark svg > rect{fill:var(--card);stroke:none}
251
+ .b270-scripture-trigger{display:flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;padding:4px;
252
+ border:1px solid transparent;border-radius:10px;background:transparent;color:var(--ink);cursor:pointer}
253
+ .b270-scripture-trigger[aria-expanded="true"]{border-color:var(--line);background:var(--card)}
254
+ .b270-scripture-trigger[data-b270-scripture-pointer-focus]:focus{outline:none}
255
+ .b270-title{display:block;font-family:"Spectral",Georgia,serif;font-weight:600;font-size:18px;line-height:1.25;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
246
256
  .b270-nav{display:flex;align-items:center;font-size:14px;flex:none;white-space:nowrap}
247
257
  .b270-desktopnav{display:flex;align-items:center;gap:16px}
248
258
  .b270-navmenu{display:none}
@@ -259,6 +269,8 @@
259
269
  .b270-avatarrow{display:flex;align-items:center;gap:14px}
260
270
  .b270-avatarrow input[type=file]{font:inherit;font-size:13px;max-width:100%}
261
271
  .b270-emailform{display:grid;gap:12px;max-width:340px;margin:12px 0 0}
272
+ .b270-name-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:100%;max-width:300px}
273
+ .b270-name-fields .b270-field,.b270-name-fields input{min-width:0}
262
274
  .b270-field{display:grid;gap:5px;font-size:12.5px;color:var(--muted)}
263
275
  .b270-field input{font:inherit;font-size:15px;padding:10px 12px;border:1px solid var(--control-line);border-radius:9px;background:var(--control);color:var(--ink);width:100%}
264
276
  .b270-field input:focus{outline:none;border-color:var(--gold);box-shadow:0 0 0 3px rgba(165,129,44,.13)}
@@ -341,8 +353,12 @@
341
353
  .b270-startline strong{color:var(--ink)}
342
354
  .b270-startform{display:flex;align-items:flex-end;gap:10px;margin-top:10px;flex-wrap:wrap}
343
355
  .b270-startform input[type=date]{font:inherit;font-size:14px;padding:8px 10px;border:1px solid var(--control-line);border-radius:8px;background:var(--control);color:var(--ink)}
356
+ .b270-restart-form{align-items:center}
357
+ .b270-restart-form label{font-size:12.5px;color:var(--muted);white-space:nowrap}
358
+ .b270 .b270-restart-form .b270-btn,.b270 .b270-revert-form .b270-btn{margin:0;white-space:nowrap}
344
359
  .b270-linkbtn{background:none;border:none;padding:0;margin-top:8px;font:inherit;font-size:12.5px;color:var(--oxblood);cursor:pointer;text-decoration:underline}
345
360
  .b270-hint{margin:8px 0 0;font-size:12px;color:var(--faint);max-width:111ch}
361
+ .b270-theme-hint{white-space:nowrap}
346
362
  .b270-tracks{margin-top:16px;display:grid;gap:11px}
347
363
  .b270-tm{display:grid;grid-template-columns:130px 1fr auto;align-items:center;gap:12px;font-size:12.5px}
348
364
  .b270-tm .lab{color:var(--muted);display:flex;align-items:center;gap:8px}
@@ -363,18 +379,35 @@
363
379
  .b270-dayhead .b270-badge{margin-left:0}
364
380
  .b270-badge{display:inline-block;vertical-align:middle;line-height:1;font-size:10.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--on-accent);background:var(--gold-lite);padding:5px 8px 4px;border-radius:20px;margin-left:9px}
365
381
 
382
+ .b270-reader-badge{display:inline-flex;align-items:center;justify-content:center;min-height:15px;font-family:"Inter",system-ui,sans-serif;font-size:9px;line-height:1;letter-spacing:.04em;
383
+ padding:2px 5px;border:1px solid var(--line);border-radius:4px;margin:0;white-space:nowrap;
384
+ background:var(--line-soft);background:color-mix(in srgb,var(--card) 80%,var(--ink));color:var(--ink)}
385
+ /* Center the capitals, not the font's unused ascender and descender space. */
386
+ .b270-reader-badge>span{display:block;text-box:trim-both cap alphabetic}
387
+
366
388
  .b270-day-complete{display:flex;align-items:center;gap:14px;margin:0 0 14px;padding:11px 13px;
367
389
  border:1px solid var(--line);border-radius:10px;background:var(--card);box-shadow:var(--shadow)}
368
390
  .b270-day-complete div{display:flex;flex-direction:column;gap:2px;min-width:0}
369
391
  .b270-day-complete strong{font-family:"Spectral",serif;font-size:16px}
370
392
  .b270-day-complete span{font-size:12px;color:var(--muted)}
371
393
  .b270 .b270-day-complete .b270-btn{flex:none;margin:0 0 0 auto}
394
+ .b270-completion{position:fixed;inset:0;z-index:1050;display:grid;place-items:center;padding:12px;pointer-events:none}
395
+ .b270-completion[hidden]{display:none}
396
+ .b270-completion-frame{width:min(32rem,100%);max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);
397
+ overflow:auto;overscroll-behavior:contain;opacity:0;transition:opacity .2s ease-in-out}
398
+ .b270-completion.is-visible .b270-completion-frame{opacity:1;pointer-events:auto;transition-duration:1.3s}
399
+ /* Fade both together while the dove is still moving, with no stationary hold. */
400
+ .b270-completion.is-visible.is-flying{animation:b270-completion-exit .4s ease-in-out calc(var(--b270-dove-duration,1.4s) - .4s) both}
401
+ @keyframes b270-completion-exit{
402
+ from{opacity:1}
403
+ to{opacity:0;visibility:hidden}
404
+ }
372
405
  .b270-completion-dove{position:fixed;z-index:1000;top:72vh;left:50vw;
373
406
  width:min(80vw,104vh);height:auto;overflow:visible;pointer-events:none;opacity:0;
374
407
  color-scheme:only light;forced-color-adjust:none;
375
408
  filter:drop-shadow(0 0 8px rgba(255,255,255,1)) drop-shadow(0 0 24px rgba(255,252,220,1)) drop-shadow(0 0 52px rgba(225,191,92,.82));
376
409
  will-change:top,left,transform,opacity}
377
- .b270-completion-dove-active{animation:b270-dove-flight 1.7s cubic-bezier(.18,.72,.28,1) both}
410
+ .b270-completion-dove-active{animation:b270-dove-flight var(--b270-dove-duration,1.4s) linear both}
378
411
  .b270-dove-silhouette{fill:url(#b270-dove-light)!important;stroke:none}
379
412
  .b270-dove-light-center{stop-color:#fff!important}
380
413
  .b270-dove-light-middle{stop-color:#fffef8!important}
@@ -382,8 +415,8 @@
382
415
  @keyframes b270-dove-flight{
383
416
  0%{top:72vh;left:50vw;opacity:.22;visibility:visible;transform:translate(-50%,-50%) scale(.02) rotate(-8deg)}
384
417
  8%{top:calc(72vh - 10px);left:50vw;opacity:.78;transform:translate(-50%,-50%) scale(.08) rotate(-5deg)}
385
- 33%{top:50vh;left:50vw;opacity:1;visibility:visible;transform:translate(-50%,-50%) scale(1) rotate(4deg)}
386
- 100%{top:50vh;left:50vw;opacity:0;visibility:hidden;transform:translate(-50%,-50%) scale(1) rotate(4deg)}
418
+
419
+ 100%{top:50vh;left:50vw;opacity:1;visibility:visible;transform:translate(-50%,-50%) scale(1) rotate(4deg)}
387
420
  }
388
421
 
389
422
  /* readings */
@@ -464,6 +497,66 @@
464
497
  .b270-avatar-preview>img{display:block;width:auto;height:auto;max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);
465
498
  box-sizing:border-box;padding:4px;border:1px solid var(--line);border-radius:10px;background:var(--card);box-shadow:var(--shadow)}
466
499
 
500
+ .b270-scripture-fields{display:flex;align-items:center;flex-wrap:wrap;gap:12px 20px}
501
+ .b270-scripture-fields .b270-field{display:flex;align-items:center;gap:8px;flex:1 1 220px;min-width:0}
502
+ .b270-scripture-fields label{white-space:nowrap}
503
+ .b270-scripture-fields .b270-field>input,.b270-scripture-fields .b270-select-wrap{flex:1;min-width:0}
504
+ .b270-scripture-panel-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 0 8px}
505
+ .b270-scripture-panel-header>.b270-subhead,.b270 .b270-scripture-panel-header>.b270-btn{margin:0}
506
+ .b270-scripture-panel-header>.b270-subhead{min-width:0;overflow-wrap:anywhere}
507
+ .b270 .b270-scripture-panel-header>.b270-btn{flex-shrink:0;padding:6px 10px;font-size:12.5px;white-space:nowrap}
508
+ .b270-scripture-actions{display:flex;align-items:center;gap:10px;margin:0;white-space:nowrap}
509
+ .b270-scripture-actions>form{margin:0}
510
+ .b270-scripture-actions>a,.b270-scripture-actions .b270-linkbtn{margin:0;font-size:12.5px;color:var(--oxblood)}
511
+ .b270-scripture-library-entry{padding:10px 0;border-top:1px solid var(--line-soft);font-size:13px}
512
+ .b270-scripture-library-entry--default,.b270-scripture-library-entry--custom{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:12px}
513
+ .b270-scripture-default-toggle{margin:0}
514
+ .b270 .b270-scripture-default-toggle .b270-linkbtn{margin:0;font-size:12.5px;line-height:inherit;white-space:nowrap;color:var(--oxblood)}
515
+ .b270-scripture-library-disclosure{position:relative}
516
+ .b270-scripture-library-disclosure>summary{cursor:pointer;overflow-wrap:anywhere}
517
+ .b270-scripture-library-text{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font-family:"Spectral",Georgia,serif;font-size:15px;line-height:1.5}
518
+ .b270-scripture-library-disclosure>.b270-scripture-library-text{position:absolute;z-index:30;inset:100% auto auto 0;
519
+ width:min(32rem,100%);max-height:50vh;max-height:50dvh;overflow:auto;overscroll-behavior:contain;
520
+ padding:12px 14px;border:1px solid var(--line);border-radius:8px;background:var(--paper);background:color-mix(in srgb,var(--card) 90%,var(--gold));color:var(--ink);box-shadow:var(--shadow)}
521
+ .b270-scripture-library-disclosure[open]>.b270-scripture-library-text{position:relative;inset:auto;width:100%;margin-top:8px}
522
+ .b270-scripture-library-text:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
523
+ /* Keep native tap/Enter disclosure as the fallback in browsers without ::details-content. */
524
+ @supports selector(details::details-content){
525
+ .b270-scripture-library-disclosure::details-content{display:block;content-visibility:visible}
526
+ .b270-scripture-library-disclosure:not([open])>.b270-scripture-library-text{display:none}
527
+ .b270-scripture-library-disclosure:not([data-b270-scripture-preview-dismissed]):hover>.b270-scripture-library-text,
528
+ .b270-scripture-library-disclosure:not([data-b270-scripture-preview-dismissed]):focus-within>.b270-scripture-library-text{display:block}
529
+ }
530
+
531
+ /* A small, theme-coloured wall-art mat, shared with stored-frame previews. */
532
+ .b270-scripture-art{box-sizing:border-box;max-width:100%;min-width:0;margin:0;padding:7px;border:1px solid var(--gold);
533
+ background:linear-gradient(135deg,var(--line),var(--gold),var(--line-soft) 45%,var(--gold));
534
+ box-shadow:var(--shadow);color:var(--ink);overflow-wrap:anywhere}
535
+ .b270-scripture-art[hidden],.b270-scripture-art [hidden],.b270-scripture-popup[hidden],.b270-scripture-popup [hidden]{display:none}
536
+ .b270-scripture-art__mat{padding:clamp(24px,6vw,52px) clamp(22px,5vw,44px);border:1px solid var(--line);
537
+ outline:1px solid var(--gold);outline-offset:-9px;background:var(--card);background:color-mix(in srgb,var(--card) 90%,var(--gold))}
538
+ .b270-scripture-art__verse{margin:0;text-align:center;font-family:"Spectral",Georgia,serif;font-size:clamp(19px,3.8vw,25px);font-weight:400;line-height:1.65}
539
+ .b270-scripture-art__verse p{margin:0;white-space:pre-wrap}
540
+ .b270-scripture-art__caption{display:flex;justify-content:center;align-items:baseline;flex-wrap:wrap;gap:5px 10px;margin-top:26px;text-align:center}
541
+ .b270-scripture-art__reference{font-family:"Spectral",Georgia,serif;font-size:17px;font-weight:600}
542
+ .b270-scripture-art__translation{color:var(--muted);font-size:10px;letter-spacing:.12em}
543
+ .b270-scripture-art__attribution{margin:18px 0 0;color:var(--muted);font-size:11px;line-height:1.6;text-align:center;white-space:pre-wrap}
544
+ .b270-scripture-popup{position:fixed;inset:0 auto auto 0;z-index:1100;display:flex;flex-direction:column;gap:10px;box-sizing:border-box;
545
+ width:min(32rem,calc(100vw - 24px));max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);
546
+ padding:10px;border:1px solid var(--line);border-radius:8px;background:var(--card);background:color-mix(in srgb,var(--card) 90%,var(--gold));color:var(--ink);
547
+ box-shadow:var(--shadow);opacity:0;pointer-events:none;transition:opacity 180ms ease-out}
548
+ .b270[data-display-mode="sage"] .b270-scripture-library-text,
549
+ .b270[data-display-mode="sage"] .b270-scripture-art__mat,
550
+ .b270[data-display-mode="sage"] .b270-scripture-popup{background:#d1e2ea}
551
+ .b270-scripture-popup.is-visible{opacity:1;pointer-events:auto}
552
+
553
+ .b270-scripture-popup__status{flex:none;margin:4px 12px 16px;color:var(--muted);font-size:14px;line-height:1.6;overflow-wrap:anywhere}
554
+ .b270-scripture-popup__status[data-state="error"]{color:var(--alert-ink)}
555
+ .b270-scripture-popup>.b270-scripture-art{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
556
+ @media (prefers-reduced-motion:reduce){
557
+ .b270-scripture-popup{transition:none}
558
+ }
559
+
467
560
  /* comments */
468
561
  .b270-section-h{font-family:"Spectral",serif;font-size:20px;font-weight:600;margin:34px 0 14px}
469
562
  .b270-comment{display:flex;gap:12px;padding:14px 0;border-top:1px solid var(--line-soft)}
@@ -564,6 +657,28 @@
564
657
 
565
658
  /* community */
566
659
  .b270-admin-view-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
660
+ .b270-panel.b270-admin-control{display:flex;align-items:center;justify-content:space-between;gap:8px 12px;flex-wrap:wrap;padding-top:12px;padding-bottom:12px}
661
+ .b270-admin-control>.b270-subhead{margin:0}
662
+ .b270-admin-control>form{margin:0 0 0 auto}
663
+ .b270 .b270-admin-control .b270-btn{margin:0;padding:7px 12px;font-size:13px;white-space:nowrap}
664
+ .b270-admin-position-controls{display:flex;align-items:center;gap:12px 24px;flex-wrap:wrap}
665
+ .b270-admin-position-controls .b270-startform{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;margin:0}
666
+ .b270-admin-position-controls .b270-field{display:flex;align-items:center;gap:8px;margin:0}
667
+ .b270-admin-position-controls .b270-field>span{white-space:nowrap}
668
+ .b270-admin-position-controls .b270-field>input{margin:0;width:auto;min-width:0}
669
+ .b270-admin-position-controls input[type=number]{width:5em}
670
+ .b270 .b270-admin-position-controls .b270-btn{margin:0;white-space:nowrap}
671
+ @media (max-width:480px){
672
+ .b270-admin-position-controls .b270-startform,.b270-admin-position-controls .b270-field{flex-wrap:wrap;max-width:100%;min-width:0}
673
+ }
674
+ .b270-admin-inline-form{display:flex;align-items:center;gap:12px}
675
+ .b270-admin-inline-option{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);white-space:nowrap}
676
+ .b270-admin-inline-option input[type=checkbox]{margin:0;accent-color:var(--gold)}
677
+
678
+ .b270-run-history-scroll{max-width:100%;overflow-x:auto}
679
+ .b270-run-history-table{width:100%;border-collapse:collapse;font-size:12.5px;text-align:left}
680
+ .b270-run-history-table th,.b270-run-history-table td{padding:8px;border-bottom:1px solid var(--line-soft);white-space:nowrap}
681
+ .b270-run-history-table th{font-weight:600;color:var(--muted)}
567
682
  .b270-admin-view-header .b270-eyebrow,.b270-admin-view-header form,.b270 .b270-admin-view-header .b270-btn{margin:0}
568
683
  .b270-admin-reader-tools{display:flex;align-items:flex-end;justify-content:flex-end;gap:8px;margin:0 0 10px;flex-wrap:wrap}
569
684
  .b270-admin-reader-sort{display:flex;align-items:flex-end;gap:8px}
@@ -583,6 +698,9 @@
583
698
  .b270-li.b270-reader-theme{background:var(--card);color:var(--ink)}
584
699
  .b270-li+.b270-li{border-top:1px solid var(--line-soft)}
585
700
  .b270-li .name{font-weight:600}
701
+ .b270-admin-reader-details{flex:1;min-width:0;overflow-wrap:anywhere}
702
+ .b270-admin-reader-details .name{display:flex;align-items:center;flex-wrap:wrap;gap:4px 6px;line-height:1.3;margin-bottom:2px}
703
+ .b270-admin-reader-details .name>.b270-badge{flex:none;margin:0}
586
704
  .b270-li .sub{font-size:12.5px;color:var(--faint)}
587
705
  .b270-community-reader-details{flex:1;min-width:0;overflow-wrap:anywhere}
588
706
  .b270-reader-progress{display:flex;align-items:center;gap:8px;max-width:280px;margin-top:6px;flex-wrap:wrap}
@@ -595,6 +713,8 @@
595
713
  .b270-li .b270-admin-progress:hover,.b270-li .b270-admin-progress:focus-visible{color:var(--gold)}
596
714
  .b270-li .stat{margin-left:auto;text-align:right}
597
715
  .b270-li .stat .big{font-family:"Spectral",serif;font-size:20px;font-weight:600}
716
+ #b270-alumni .stat>form{margin:6px 0 0}
717
+ .b270 .b270-admin-activate{margin:0;padding:6px 9px;font-size:12px;white-space:nowrap}
598
718
 
599
719
  /* calendar grid */
600
720
  .b270-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(30px,1fr));gap:6px;margin-top:16px}
@@ -643,9 +763,20 @@
643
763
  .b270-footer p{margin:0;line-height:1.5}
644
764
  details.b270-index summary{cursor:pointer;font-family:"Spectral",serif;font-size:18px;font-weight:600;list-style:none;margin-top:30px}
645
765
  details.b270-index summary::-webkit-details-marker{display:none}
766
+ details.b270-active-readers{margin-bottom:24px}
767
+ details.b270-active-readers>summary{margin:0 0 12px}
768
+ details.b270-active-readers .b270-active-readers-hide{display:none}
769
+ details.b270-active-readers[open] .b270-active-readers-show{display:none}
770
+ details.b270-active-readers[open] .b270-active-readers-hide{display:inline}
771
+ details.b270-alumni{margin-bottom:24px}
772
+ details.b270-alumni .b270-alumni-hide{display:none}
773
+ details.b270-alumni[open] .b270-alumni-show{display:none}
774
+ details.b270-alumni[open] .b270-alumni-hide{display:inline}
775
+ details.b270-alumni>.b270-list{margin-top:12px}
646
776
  /* Switch to the compact menu before the full navigation can crowd the theme control. */
647
777
  @media (max-width:820px){
648
778
  .b270-topbar{flex-wrap:nowrap;align-items:center;gap:8px}
779
+ .b270-brand-home{padding-left:12px}
649
780
 
650
781
  .b270-nav{position:relative;flex:none}
651
782
  .b270-desktopnav{display:none}
@@ -26,6 +26,13 @@
26
26
  <%= render "bible270/shared/theme_scenery" %>
27
27
  <div class="b270-wrap">
28
28
  <%= render "bible270/shared/header" %>
29
+ <% if current_reader&.alumni? %>
30
+ <p class="b270-flash notice b270-alumni-notice">
31
+ You are viewing as alumni. Your previous progress is preserved.
32
+ You can still visit <%= link_to 'Community', community_path %> and share reflections.
33
+ An admin can add you to the current run with fresh progress.
34
+ </p>
35
+ <% end %>
29
36
  <% if flash[:alert] %><div class="b270-flash alert"><%= flash[:alert] %></div><% end %>
30
37
  <% if flash[:notice] %><div class="b270-flash notice"><%= flash[:notice] %></div><% end %>
31
38
  <%= yield %>
@@ -35,6 +42,7 @@
35
42
  </div>
36
43
  <%= render "bible270/shared/avatar_ui" %>
37
44
  <%= render "bible270/shared/avatar_preview_ui" %>
45
+ <%= render "bible270/shared/scripture_frame_ui" %>
38
46
  <%= render "bible270/shared/theme_ui" %>
39
47
  <%= render "bible270/shared/scripture_popups" %>
40
48
  <%= render "bible270/shared/video_embeds" %>
data/config/routes.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  # Rails routes are intentionally kept in one cohesive DSL block.
4
4
  Bible270::Engine.routes.draw do
5
5
  root to: 'days#index'
6
+ get 'scripture-frame', to: 'scripture_frames#show', as: :scripture_frame, defaults: { format: 'json' }
6
7
 
7
8
  get 'day/:day', to: 'days#show', as: :day, constraints: { day: %r{\d+} }
8
9
 
@@ -18,12 +19,16 @@ Bible270::Engine.routes.draw do
18
19
  patch 'comments/:id', to: 'comments#update'
19
20
  delete 'comments/:id', to: 'comments#destroy', as: :comment
20
21
 
21
- # Admin panel — 404s unless config.admin_emails / admin_resolver allows you.
22
+ # Admin panel — configured site-admins and readers granted admin access.
23
+ patch 'admin/scripture-frame-defaults/:id', to: 'admin_scripture_frames#update_default', as: :admin_default_scripture_frame
24
+ resources :admin_scripture_frames, path: 'admin/scripture-frames', only: %i[index new create edit update destroy]
22
25
  get 'admin', to: 'admin#index', as: :admin
23
26
  patch 'admin/view', to: 'admin#update_view', as: :admin_view
24
27
  get 'admin/readers/:id', to: 'admin#show', as: :admin_reader
25
28
  delete 'admin/readers/:id', to: 'admin#destroy'
26
- patch 'admin/readers/:id/profile', to: 'admin#update_profile', as: :admin_reader_profile
29
+ patch 'admin/readers/:id/role', to: 'admin_roles#update', as: :admin_reader_role
30
+ patch 'admin/readers/:id/participation', to: 'admin#update_participation', as: :admin_reader_participation
31
+ patch 'admin/readers/:id/profile', to: 'admin#update_profile', as: :admin_reader_profile
27
32
  patch 'admin/readers/:id/theme', to: 'admin#update_theme', as: :admin_reader_theme
28
33
  patch 'admin/readers/:id/notifications', to: 'admin#update_notifications', as: :admin_reader_notifications
29
34
  patch 'admin/readers/:id/completion-animation', to: 'admin#update_completion_animation',
@@ -34,6 +39,8 @@ Bible270::Engine.routes.draw do
34
39
  patch 'admin/readers/:id/through', to: 'admin#complete_through', as: :admin_reader_through
35
40
  post 'admin/readers/:id/days/:day', to: 'admin#toggle_day', as: :admin_reader_day
36
41
 
42
+ post 'admin/restart', to: 'admin#restart', as: :admin_restart
43
+ post 'admin/revert', to: 'admin#revert', as: :admin_revert
37
44
  post 'admin/broadcast', to: 'admin#broadcast', as: :admin_broadcast
38
45
  patch 'admin/enrollment', to: 'admin#update_enrollment', as: :admin_enrollment
39
46
  patch 'admin/run-start', to: 'admin#update_run_start', as: :admin_run_start