bible270 1.19.0 → 1.20.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3dfc37decf954d5e4c09a801dd5351bb92bf581f76488d2313713ecfdb19ae20
4
- data.tar.gz: 978863928b51813457d448ef3fb8c7744416a85917b53bdce0981309a4eabf5a
3
+ metadata.gz: 6a65a67fcc122a62da55e92fef4963276c602f49a1065aa76d9ae01465bbbb35
4
+ data.tar.gz: b105759802039f75165f009fdeb3ebcaee7d25e509da9a7a3157d2f3892b4019
5
5
  SHA512:
6
- metadata.gz: 7060fdc5566ff5bafd10f879fa99b9d353beace15e657ab6dc9c484496aa80d14caac3b6a094694393e2fb39c360a28bfa955635c6d1e7010be5dc4e96b16a05
7
- data.tar.gz: b9cc997a2d380e110eaf34b2f5c74c454834c2488fc4585ce7cbf0e02a168a336808f7e34852b525073639d668afb15f6ac6dbe92188497e8ac4f29b1774868d
6
+ metadata.gz: 619c55ea4f70ac7c59b9170e0c10437a9cf36ec08d1989f7162a5cb6be3a2e148d3a01f6bd233cb4a95004a4e4a965a2313008e3d4ad46848e55c1ae60e2eda4
7
+ data.tar.gz: 42b46a4f1e320fd4e5bd819cf53c3f9ab533212b285bf3f4ee8aa99b3f34bb76e13618530ca7a752047f8c3c9a938061d3b2c7883c2705dabd81dafaa5b5b5c5
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ Notable changes, following [Keep a Changelog](https://keepachangelog.com/en/1.1.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ### Added
8
+
9
+ - preview any Scripture frame from Admin in the current theme
10
+
7
11
  ### Changed
8
12
 
9
13
  - give longer completion passages more reading time, from 5.5 to 30 seconds
data/README.md CHANGED
@@ -424,7 +424,7 @@ The [bundled YAML catalog](config/scripture_frames.yml) supplies the defaults in
424
424
  - For non-Scripture text, select **Other quotation** under Translation and enter **Author / source** and the quote. No Bible credit is attached.
425
425
  - Edit or delete custom texts; enable or disable any text. Disabled texts remain previewable but do not appear in random frames.
426
426
 
427
- Custom passages come first in biblical order, then quotations and defaults. Hover or focus a heading to preview; select it to expand. Use text you have permission to reproduce.
427
+ Custom passages come first in biblical order, then quotations and defaults. **Preview** opens the reader-facing frame in your theme, without animation or a timer. Hover or focus a heading for plain text; select it to expand. Use text you have permission to reproduce.
428
428
 
429
429
  **Custom texts are stored in the database and supplement, not change, the YAML catalog.** Texts and enable/disable choices persist across runs. Defaults start enabled and cannot be edited or deleted. Custom texts require migration `20260101000027`.
430
430
 
@@ -20,9 +20,14 @@
20
20
  <% text_id = "b270-scripture-library-#{source.downcase}-#{index}" %>
21
21
  <article class="b270-scripture-library-entry b270-scripture-library-entry--<%= source.downcase %>" data-source="<%= source.downcase %>"
22
22
  aria-label="<%= source == 'Default' ? 'Bundled' : 'Custom' %> text: <%= frame.reference %>">
23
- <%= render 'bible270/admin/scripture_text', frame: frame, source: source, text_id: text_id, return_to: 'admin' %>
24
- <% if source == 'Custom' %>
25
- <div class="b270-scripture-actions">
23
+ <%= render 'bible270/admin/scripture_text', frame: frame, source: source, text_id: text_id %>
24
+ <div class="b270-scripture-actions">
25
+ <%= button_tag 'Preview', type: 'button', class: 'b270-linkbtn',
26
+ data: { b270_scripture_preview: true, b270_preview_reference: frame.reference,
27
+ b270_preview_translation: frame.translation, b270_preview_text: frame.text,
28
+ b270_preview_attribution: frame.attribution.to_s },
29
+ aria: { haspopup: 'dialog', controls: 'b270-scripture-preview', label: "Preview #{frame.reference}" } %>
30
+ <% if source == 'Custom' %>
26
31
  <%= link_to 'Edit', edit_admin_scripture_frame_path(frame, sort: @reader_sort), aria: { label: "Edit #{frame.reference}" } %>
27
32
  <%= button_to frame.enabled? ? 'Disable' : 'Enable', admin_scripture_frame_path(frame), method: :patch,
28
33
  params: { scripture_frame: { enabled: frame.enabled? ? '0' : '1' }, sort: @reader_sort }, class: 'b270-linkbtn',
@@ -30,8 +35,14 @@
30
35
  <%= button_to 'Delete', admin_scripture_frame_path(frame), method: :delete, class: 'b270-linkbtn',
31
36
  params: { sort: @reader_sort }, aria: { label: "Delete #{frame.reference}" },
32
37
  form: { data: { b270_admin_confirm: 'Delete this custom scripture frame permanently?' } } %>
33
- </div>
34
- <% end %>
38
+ <% elsif @scripture_frame_default_settings_available %>
39
+ <% disabled = Array(@disabled_default_scripture_frame_ids).include?(frame.id) %>
40
+ <%= button_to disabled ? 'Enable' : 'Disable', admin_default_scripture_frame_path(frame.id), method: :patch,
41
+ params: { enabled: disabled ? '1' : '0', return_to: 'admin', sort: @reader_sort },
42
+ class: 'b270-linkbtn', form: { class: 'b270-scripture-default-toggle' },
43
+ aria: { label: "#{disabled ? 'Enable' : 'Disable'} #{frame.reference}" } %>
44
+ <% end %>
45
+ </div>
35
46
  </article>
36
47
  <% end %>
37
48
  </div>
@@ -3,9 +3,3 @@
3
3
  <summary aria-describedby="<%= text_id %>"><strong><%= frame.reference %></strong> · <%= Bible270::ScriptureFrames.quotation?(frame.translation) ? 'Other quotation' : frame.translation %> · <%= source %><% if disabled %> · Disabled<% end %></summary>
4
4
  <blockquote class="b270-scripture-library-text" id="<%= text_id %>" role="tooltip" tabindex="0"><%= frame.text %></blockquote>
5
5
  </details>
6
- <% if source == 'Default' && @scripture_frame_default_settings_available %>
7
- <%= button_to disabled ? 'Enable' : 'Disable', admin_default_scripture_frame_path(frame.id), method: :patch,
8
- params: { enabled: disabled ? '1' : '0', return_to: local_assigns.fetch(:return_to, 'texts'), sort: @reader_sort },
9
- class: 'b270-linkbtn', form: { class: 'b270-scripture-default-toggle' },
10
- aria: { label: "#{disabled ? 'Enable' : 'Disable'} #{frame.reference}" } %>
11
- <% end %>
@@ -226,3 +226,4 @@
226
226
  <%= render 'bible270/shared/admin_confirmations' %>
227
227
  <%= render 'bible270/shared/admin_reader_list_ui' %>
228
228
  <%= render 'bible270/shared/scripture_library_ui' %>
229
+ <%= render 'bible270/shared/scripture_preview_ui' %>
@@ -0,0 +1,113 @@
1
+ <dialog id="b270-scripture-preview" class="b270-scripture-preview" aria-label="Scripture frame preview" data-b270-scripture-preview-dialog>
2
+ <form method="dialog" class="b270-scripture-preview-close">
3
+ <button type="submit" class="b270-linkbtn" aria-label="Close preview" autofocus>×</button>
4
+ </form>
5
+ <%= render partial: "bible270/shared/scripture_frame", locals: { frame: nil } %>
6
+ </dialog>
7
+
8
+ <script nonce="<%= content_security_policy_nonce %>" data-b270-scripture-preview-ui>
9
+ (() => {
10
+ if (window.Bible270ScripturePreview) {
11
+ window.Bible270ScripturePreview.reset();
12
+ return;
13
+ }
14
+
15
+ const selector = "button[data-b270-scripture-preview]";
16
+ const keys = ["reference", "translation", "text", "attribution"];
17
+ let active = null;
18
+ let backdropStart = false;
19
+
20
+ function clear(dialog) {
21
+ dialog.returnValue = "";
22
+ dialog.removeAttribute("open");
23
+ const art = dialog.querySelector("[data-b270-scripture-art]");
24
+ if (art) art.hidden = true;
25
+ keys.forEach((key) => {
26
+ const field = dialog.querySelector(`[data-b270-scripture-${key}]`);
27
+ if (!field) return;
28
+ field.textContent = "";
29
+ if (key === "translation" || key === "attribution") field.hidden = true;
30
+ });
31
+ }
32
+
33
+ function reset() {
34
+ const state = active;
35
+ active = null;
36
+ backdropStart = false;
37
+ if (!state) return;
38
+ // Native close restores its original focus target even after blur. Make
39
+ // that target briefly inert so navigation cannot refocus the departing page.
40
+ const previousFocus = state.previousFocus;
41
+ const wasInert = previousFocus?.inert;
42
+ if (previousFocus) previousFocus.inert = true;
43
+ if (state.dialog.contains(document.activeElement)) document.activeElement.blur();
44
+ if (state.dialog.open) state.dialog.close();
45
+ if (previousFocus) previousFocus.inert = wasInert;
46
+ clear(state.dialog);
47
+ }
48
+
49
+ function outside(dialog, event) {
50
+ const rect = dialog.getBoundingClientRect();
51
+ return event.clientX < rect.left || event.clientX > rect.right ||
52
+ event.clientY < rect.top || event.clientY > rect.bottom;
53
+ }
54
+
55
+ document.addEventListener("pointerdown", (event) => {
56
+ backdropStart = !!active && event.target === active.dialog && outside(active.dialog, event);
57
+ });
58
+ document.addEventListener("pointercancel", () => { backdropStart = false; });
59
+
60
+ document.addEventListener("click", (event) => {
61
+ const startedOutside = backdropStart;
62
+ backdropStart = false;
63
+ if (event.defaultPrevented) return;
64
+ const trigger = event.target.closest?.(selector);
65
+ if (!trigger) {
66
+ const dismiss = active && startedOutside && event.target === active.dialog && outside(active.dialog, event);
67
+ if (dismiss) active.dialog.close();
68
+ return;
69
+ }
70
+ const dialog = document.getElementById(trigger.getAttribute("aria-controls"));
71
+ if (!trigger.isConnected || !dialog?.matches("dialog[data-b270-scripture-preview-dialog]") ||
72
+ !dialog.isConnected || typeof dialog.showModal !== "function") return;
73
+ const art = dialog.querySelector("[data-b270-scripture-art]");
74
+ const fields = keys.map((key) => art?.querySelector(`[data-b270-scripture-${key}]`));
75
+ if (!art || fields.some((field) => !field)) return;
76
+ event.preventDefault();
77
+ if (active && active.dialog !== dialog) reset();
78
+ const previousFocus = active?.dialog === dialog && dialog.open ? active.previousFocus : document.activeElement;
79
+ active = { dialog, trigger, previousFocus };
80
+ backdropStart = false;
81
+ const quotation = trigger.getAttribute("data-b270-preview-translation") === "OTHER";
82
+ keys.forEach((key, index) => {
83
+ const value = trigger.getAttribute(`data-b270-preview-${key}`) || "";
84
+ const omit = quotation && (key === "translation" || key === "attribution");
85
+ fields[index].textContent = omit ? "" : value;
86
+ if (key === "translation" || key === "attribution") fields[index].hidden = omit || !value.trim();
87
+ });
88
+ art.hidden = false;
89
+ try {
90
+ if (!dialog.open) dialog.showModal();
91
+ dialog.scrollTop = 0;
92
+ } catch (_) {
93
+ reset();
94
+ }
95
+ });
96
+
97
+ // Native form dismissal and Escape both deliver close, which does not bubble.
98
+ document.addEventListener("close", (event) => {
99
+ const state = active;
100
+ // A queued close from an earlier session must not clear a reopened dialog.
101
+ if (!state || event.target !== state.dialog || state.dialog.open) return;
102
+ active = null;
103
+ backdropStart = false;
104
+ clear(state.dialog);
105
+ if (state.dialog.isConnected && state.trigger.isConnected) state.trigger.focus({ preventScroll: true });
106
+ }, true);
107
+
108
+ document.addEventListener("turbo:before-cache", reset);
109
+ document.addEventListener("turbo:before-render", reset);
110
+ window.addEventListener("pagehide", reset);
111
+ window.Bible270ScripturePreview = { reset };
112
+ })();
113
+ </script>
@@ -526,6 +526,11 @@
526
526
  .b270-scripture-actions>a,.b270-scripture-actions .b270-linkbtn{margin:0;font-size:12.5px;color:var(--oxblood)}
527
527
  .b270-scripture-library-entry{padding:10px 0;border-top:1px solid var(--line-soft);font-size:13px}
528
528
  .b270-scripture-library-entry--default,.b270-scripture-library-entry--custom{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:12px}
529
+ @media(max-width:360px){
530
+ #b270-scripture-frames{padding-inline:10px}
531
+ .b270-scripture-library-entry--default,.b270-scripture-library-entry--custom{grid-template-columns:minmax(0,1fr)}
532
+ .b270-scripture-actions{justify-self:end}
533
+ }
529
534
  .b270-scripture-default-toggle{margin:0}
530
535
  .b270 .b270-scripture-default-toggle .b270-linkbtn{margin:0;font-size:12.5px;line-height:inherit;white-space:nowrap;color:var(--oxblood)}
531
536
  .b270-scripture-library-disclosure{position:relative}
@@ -561,6 +566,14 @@
561
566
  width:min(32rem,calc(100vw - 24px));max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);
562
567
  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);
563
568
  box-shadow:var(--shadow);opacity:0;pointer-events:none;transition:opacity 180ms ease-out}
569
+ .b270-scripture-preview{box-sizing:border-box;width:min(32rem,calc(100vw - 24px));max-width:none;
570
+ max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;
571
+ 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);box-shadow:var(--shadow)}
572
+ .b270-scripture-preview::backdrop{background:rgb(0 0 0 / .55)}
573
+ .b270-scripture-preview-close{display:flex;justify-content:flex-end;margin:0 0 8px}
574
+ .b270-scripture-preview-close .b270-linkbtn{margin:0;padding:0 6px;color:var(--ink);font-size:22px;line-height:1}
575
+ .b270-scripture-preview-close .b270-linkbtn:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
576
+ .b270[data-display-mode="sage"] .b270-scripture-preview,
564
577
  .b270[data-display-mode="sage"] .b270-scripture-library-text,
565
578
  .b270[data-display-mode="sage"] .b270-scripture-art__mat,
566
579
  .b270[data-display-mode="sage"] .b270-scripture-popup{background:#d1e2ea}
@@ -86,6 +86,17 @@
86
86
  I rejoice at Your word,
87
87
  As one who finds great spoil.
88
88
  attribution: NASB 1995 © The Lockman Foundation.
89
+ id: proverbs-4-20-22
90
+ reference: Proverbs 4:20-22
91
+ translation: NASB95
92
+ text: |-
93
+ My son, give attention to my words;
94
+ Incline your ear to my sayings.
95
+ Do not let them depart from your sight;
96
+ Keep them in the midst of your heart.
97
+ For they are life to those who find them
98
+ And health to all their body.
99
+ attribution: NASB 1995 © The Lockman Foundation.
89
100
  - id: proverbs-6-23
90
101
  reference: Proverbs 6:23
91
102
  translation: NASB95
@@ -208,3 +219,8 @@
208
219
  translation: NASB95
209
220
  text: like newborn babies, long for the pure milk of the word, so that by it you may grow in respect to salvation, if you have tasted the kindness of the Lord.
210
221
  attribution: NASB 1995 © The Lockman Foundation.
222
+ - id: 2-peter-1-19-21
223
+ reference: 2 Peter 1:19-21
224
+ translation: NASB95
225
+ text: So we have the prophetic word made more sure, to which you do well to pay attention as to a lamp shining in a dark place, until the day dawns and the morning star arises in your hearts. But know this first of all, that no prophecy of Scripture is a matter of one’s own interpretation, for no prophecy was ever made by an act of human will, but men moved by the Holy Spirit spoke from God.
226
+ attribution: NASB 1995 © The Lockman Foundation.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bible270
4
- VERSION = '1.19.0'
4
+ VERSION = '1.20.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bible270
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew vonderLuft
@@ -245,6 +245,7 @@ files:
245
245
  - app/views/bible270/shared/_scripture_frame_ui.html.erb
246
246
  - app/views/bible270/shared/_scripture_library_ui.html.erb
247
247
  - app/views/bible270/shared/_scripture_popups.html.erb
248
+ - app/views/bible270/shared/_scripture_preview_ui.html.erb
248
249
  - app/views/bible270/shared/_styles.html.erb
249
250
  - app/views/bible270/shared/_theme_scenery.html.erb
250
251
  - app/views/bible270/shared/_theme_ui.html.erb