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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -32
- data/README.md +129 -58
- data/Rakefile +3 -2
- data/app/controllers/bible270/admin_controller.rb +152 -33
- data/app/controllers/bible270/admin_roles_controller.rb +50 -0
- data/app/controllers/bible270/admin_scripture_frames_controller.rb +89 -0
- data/app/controllers/bible270/application_controller.rb +18 -2
- data/app/controllers/bible270/checkoffs_controller.rb +38 -9
- data/app/controllers/bible270/readers_controller.rb +1 -1
- data/app/controllers/bible270/scripture_frames_controller.rb +16 -0
- data/app/helpers/bible270/plan_helper.rb +4 -4
- data/app/mailers/bible270/notice_mailer.rb +2 -2
- data/app/models/bible270/checkoff.rb +69 -3
- data/app/models/bible270/participation.rb +71 -0
- data/app/models/bible270/plan_run.rb +121 -0
- data/app/models/bible270/reader.rb +142 -24
- data/app/models/bible270/scripture_frame.rb +48 -0
- data/app/models/bible270/setting.rb +13 -4
- data/app/views/bible270/admin/_reader_list.html.erb +55 -0
- data/app/views/bible270/admin/_scripture_frames.html.erb +34 -0
- data/app/views/bible270/admin/_scripture_text.html.erb +11 -0
- data/app/views/bible270/admin/index.html.erb +64 -49
- data/app/views/bible270/admin/show.html.erb +117 -54
- data/app/views/bible270/admin_scripture_frames/_form.html.erb +72 -0
- data/app/views/bible270/admin_scripture_frames/edit.html.erb +4 -0
- data/app/views/bible270/admin_scripture_frames/new.html.erb +4 -0
- data/app/views/bible270/days/_day_progress.html.erb +2 -2
- data/app/views/bible270/days/_reading.html.erb +5 -4
- data/app/views/bible270/profiles/edit.html.erb +14 -12
- data/app/views/bible270/readers/show.html.erb +1 -1
- data/app/views/bible270/shared/_admin_confirmations.html.erb +16 -0
- data/app/views/bible270/shared/_admin_reader_list_ui.html.erb +49 -0
- data/app/views/bible270/shared/_day_completion.html.erb +13 -0
- data/app/views/bible270/shared/_day_completion_ui.html.erb +152 -0
- data/app/views/bible270/shared/_day_index.html.erb +2 -1
- data/app/views/bible270/shared/_header.html.erb +12 -4
- data/app/views/bible270/shared/_interaction_ui.html.erb +2 -62
- data/app/views/bible270/shared/_scripture_frame.html.erb +14 -0
- data/app/views/bible270/shared/_scripture_frame_ui.html.erb +247 -0
- data/app/views/bible270/shared/_scripture_library_ui.html.erb +34 -0
- data/app/views/bible270/shared/_styles.html.erb +141 -10
- data/app/views/layouts/bible270/application.html.erb +8 -0
- data/config/routes.rb +9 -2
- data/config/scripture_frames.yml +134 -0
- data/db/migrate/20260101000024_create_bible270_plan_runs.rb +60 -0
- data/db/migrate/20260101000025_add_admin_to_bible270_readers.rb +7 -0
- data/db/migrate/20260101000026_add_revert_to_bible270_plan_runs.rb +8 -0
- data/db/migrate/20260101000027_create_bible270_scripture_frames.rb +16 -0
- data/lib/bible270/configuration.rb +17 -4
- data/lib/bible270/migration_reconciler.rb +91 -8
- data/lib/bible270/reader_consistency.rb +8 -4
- data/lib/bible270/reader_progress_report.rb +2 -1
- data/lib/bible270/scripture_frames.rb +226 -0
- data/lib/bible270/version.rb +1 -1
- data/lib/bible270.rb +1 -0
- data/lib/generators/bible270/install/templates/bible270.rb.tt +8 -1
- metadata +26 -1
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/avonderluft/bible270/actions/workflows/railsci.yml) [](https://coveralls.io/github/avonderluft/bible270?branch=main) [](https://rubygems.org/gems/bible270) [](https://rubygems.org/gems/bible270) [](https://github.com/avonderluft/bible270/releases)
|
|
4
4
|
|
|
5
|
-
A
|
|
5
|
+
A **Rails engine** for a 270-day (9-month) Bible reading plan. Readers check off readings, share reflections, and follow one another's progress.
|
|
6
6
|
|
|
7
7
|
Created for [Kingdom Movement School of Ministry](https://www.kmsm.life/) and designed to work with [ComfyMiddleSeat](https://github.com/avonderluft/comfy-middle-seat) CMS, it also works in other Rails apps.
|
|
8
8
|
|
|
@@ -20,17 +20,17 @@ By default, psalms of 25 verses or fewer stay whole. Longer chapters use selecte
|
|
|
20
20
|
|
|
21
21
|
The Old Testament and Revelation 22 finish on day 270 alongside Psalm 1. Daily readings average about 115 verses (range 76–166).
|
|
22
22
|
|
|
23
|
-
`Bible270::Plan` generates the schedule
|
|
23
|
+
`Bible270::Plan` generates the schedule from `Bible270::Versification`, not the database. **Progress and reflections are public.**
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Community lists readers alphabetically. Signed-in readers, including admins in non-admin view, see progress bars and completed-day counts. A line marks today on active schedules, except undated, future, or ended ones. Visitors see names and join dates; management links and ahead/behind labels are admin-only.
|
|
26
26
|
|
|
27
27
|
## Requirements
|
|
28
28
|
|
|
29
29
|
- **Ruby >= 3.2** and a **Rails >= 7.2** host app. CI covers selected combinations through Ruby 4.0 / Rails 8.1; check your host's dependencies before upgrading Ruby.
|
|
30
30
|
- Turbo JavaScript for check-offs without a page reload. The gem includes `turbo-rails`; ordinary HTML forms remain available without JavaScript.
|
|
31
|
-
- For picture uploads and backfills: **Active Storage** and **libvips** with PNG, JPEG, GIF, and WebP support on
|
|
31
|
+
- For picture uploads and backfills: **Active Storage** and **libvips** with PNG, JPEG, GIF, and WebP support on each upload/backfill host. Install with `sudo apt-get install libvips-tools` (Ubuntu) or `sudo pacman -S libvips` (Arch). The gem includes `image_processing` and `ruby-vips`; libvips loads only for optimization, not avatar display.
|
|
32
32
|
|
|
33
|
-
JavaScript controls show pending, success, and retry feedback.
|
|
33
|
+
JavaScript controls show pending, success, and retry feedback. Repeating a request keeps the intended check-off or like state.
|
|
34
34
|
|
|
35
35
|
## Install
|
|
36
36
|
|
|
@@ -65,9 +65,7 @@ The interactive generator:
|
|
|
65
65
|
4. Writes `config/initializers/bible270.rb` and, for social sign-in, `omniauth.rb`.
|
|
66
66
|
5. Adds `mount Bible270::Engine, at: Bible270.config.mount_at` to your routes.
|
|
67
67
|
|
|
68
|
-
Defaults use `/daily-bread` with email and GitHub sign-in. **
|
|
69
|
-
|
|
70
|
-
Copied migrations belong to your app. The engine does not also add its migration directory to your app's migration paths.
|
|
68
|
+
Defaults use `/daily-bread` with email and GitHub sign-in. **Configure mail delivery, provider credentials, and OAuth callback URLs** as listed by the generator. Migrations run before initializers are written; the copied migrations belong to your app, with no duplicate engine migration path.
|
|
71
69
|
|
|
72
70
|
For non-interactive setup:
|
|
73
71
|
|
|
@@ -88,7 +86,7 @@ bin/rails generate bible270:install --defaults \
|
|
|
88
86
|
| `--migrate` / `--no-migrate` | Run or skip migrations |
|
|
89
87
|
| `--active-storage` / `--no-active-storage` | Install or skip missing Active Storage tables |
|
|
90
88
|
|
|
91
|
-
Re-running skips existing strategy gems and reuses the
|
|
89
|
+
Re-running skips existing strategy gems and reuses the mount, moving it above catch-all routes if needed. Rails prompts before overwriting initializers. Complete any skipped bundling or migrations before using affected features.
|
|
92
90
|
|
|
93
91
|
<details>
|
|
94
92
|
<summary>Manual installation</summary>
|
|
@@ -125,7 +123,7 @@ Configure Action Mailer delivery and, if needed, [OmniAuth](#social-sign-in).
|
|
|
125
123
|
|
|
126
124
|
### Upgrading
|
|
127
125
|
|
|
128
|
-
|
|
126
|
+
**Back up the host database before migrating.** From the host Rails app (no generator re-run needed):
|
|
129
127
|
|
|
130
128
|
```bash
|
|
131
129
|
bundle update bible270
|
|
@@ -133,7 +131,12 @@ bin/rails bible270:install:migrations # skips existing copies
|
|
|
133
131
|
bin/rails db:migrate
|
|
134
132
|
```
|
|
135
133
|
|
|
136
|
-
Review the [changelog](CHANGELOG.md) before deploying
|
|
134
|
+
Review the [changelog](CHANGELOG.md) before deploying and run **all current migrations**, not just those for features you use.
|
|
135
|
+
|
|
136
|
+
- `20260101000024` saves existing readers and progress as the first run. **This migration cannot be rolled back without losing run history.** Keep a pre-migration backup for recovery.
|
|
137
|
+
- `20260101000025` enables admin roles in the panel. Configured admins become Site-admins and keep their access.
|
|
138
|
+
- `20260101000026` saves restart snapshots so future new runs can be reverted.
|
|
139
|
+
- `20260101000027` stores admin-added Scripture frame texts.
|
|
137
140
|
|
|
138
141
|
**Schedule changes do not remap existing day-based check-offs.** Compared with 1.13.3, the current default Psalms/Proverbs assignments differ on days 112–113 and 117–270, including the closing Psalm 1 reading. Review the effect on an active group before upgrading.
|
|
139
142
|
|
|
@@ -145,14 +148,14 @@ A copied database may already contain the tables but have migration versions tha
|
|
|
145
148
|
bin/rails bible270:migrations:reconcile
|
|
146
149
|
```
|
|
147
150
|
|
|
148
|
-
The task
|
|
151
|
+
The task matches Bible270 and generated Active Storage migrations by name, then checks tables, columns, indexes, and foreign keys—not just table existence. **Review the preview and back up the database** before applying:
|
|
149
152
|
|
|
150
153
|
```bash
|
|
151
154
|
APPLY=1 bin/rails bible270:migrations:reconcile
|
|
152
155
|
bin/rails db:migrate
|
|
153
156
|
```
|
|
154
157
|
|
|
155
|
-
Preview writes nothing. Apply
|
|
158
|
+
Preview writes nothing. Apply records verified versions in `schema_migrations`, without changing application tables. Missing changes remain pending for `db:migrate`.
|
|
156
159
|
|
|
157
160
|
## Mount point
|
|
158
161
|
|
|
@@ -192,10 +195,10 @@ Bible270.configure do |config|
|
|
|
192
195
|
end
|
|
193
196
|
```
|
|
194
197
|
|
|
195
|
-
-
|
|
196
|
-
- Only a **SHA-256 token digest** is stored, not the raw token or a password.
|
|
197
|
-
-
|
|
198
|
-
- Names come from the reader
|
|
198
|
+
- Links are single-use and expire after 20 minutes by default. Tokens are 256-bit and URL-safe.
|
|
199
|
+
- Only a **SHA-256 token digest** is stored, not the raw token or a password. Records still contain personal data, including email addresses.
|
|
200
|
+
- All valid-address requests get “Check your inbox,” whether known, unknown, or rate-limited, to avoid revealing accounts.
|
|
201
|
+
- Names come from the reader or email address (`mary.anne.smith@…` → “Mary Anne Smith”). Email readers use `provider: "email"`.
|
|
199
202
|
- Schedule `Bible270::SignInToken.sweep!` to remove expired or consumed records older than seven days by default.
|
|
200
203
|
|
|
201
204
|
### Social sign-in
|
|
@@ -245,7 +248,7 @@ end
|
|
|
245
248
|
|
|
246
249
|
## Admin panel
|
|
247
250
|
|
|
248
|
-
The panel at `<mount>/admin` returns **404**
|
|
251
|
+
The panel at `<mount>/admin` returns **404** for unauthorized readers. Configure Site-admins in the host initializer:
|
|
249
252
|
|
|
250
253
|
```ruby
|
|
251
254
|
config.admin_emails = %w[andrew@example.org]
|
|
@@ -253,17 +256,25 @@ config.admin_emails = %w[andrew@example.org]
|
|
|
253
256
|
config.admin_resolver = ->(reader) { reader.email.to_s.end_with?('@example.org') }
|
|
254
257
|
```
|
|
255
258
|
|
|
256
|
-
|
|
259
|
+
The generated initializer labels this section **Site-admins**; the option names remain `admin_emails` and `admin_resolver`. A callable resolver takes precedence over the email list.
|
|
260
|
+
|
|
261
|
+
- **Site-admins** can grant or revoke admin access on any reader's Admin page, including alumni, and delete other admins. Configured Site-admins cannot be demoted or deleted in the UI.
|
|
262
|
+
- **Admins** manage readers but cannot change roles or delete privileged readers.
|
|
263
|
+
- Roles persist across runs, independently of **Active/Alumni** status. Site-admins can change their own membership status.
|
|
264
|
+
|
|
265
|
+
Authorized readers get an **Admin** link. **View as non-admin** hides admin details and disables all administration for this session, including role and membership changes. You remain signed in; reflections and active check-offs still work. Use **Return to admin view** in the Admin tab or sign in again to restore access. Roles and other sessions are unchanged.
|
|
257
266
|
|
|
258
267
|
The panel supports:
|
|
259
268
|
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
269
|
+
- Sort active readers by name, completed days, activity, or consistency; **Reader Stats** follows the same sort.
|
|
270
|
+
- Edit profiles, themes, and notification preferences. Editing another reader's theme leaves yours unchanged. Enable or disable the completion dove with one button.
|
|
271
|
+
- Adjust active readers' start dates; check-offs stay tied to day numbers.
|
|
272
|
+
- Set progress through day N, **clearing completions after N**, or toggle individual days.
|
|
273
|
+
- Mark readers as alumni, reactivate them, and view past-run history.
|
|
274
|
+
- Delete unprotected readers **and all their check-offs and reflections across runs**.
|
|
275
|
+
- Hide (reversibly) or delete reflections at `<mount>/admin/comments`. Posts are public immediately, without approval.
|
|
276
|
+
- Manage [Scripture frame](#scripture-frame) texts near the bottom of the panel: add texts, edit or delete custom texts, and enable or disable any text.
|
|
277
|
+
- Send individually addressed email: **Write to everyone** reaches active readers; **Write to all admins** includes alumni admins. Both require an email address.
|
|
267
278
|
|
|
268
279
|
To print a progress report ordered by completed days:
|
|
269
280
|
|
|
@@ -271,7 +282,33 @@ To print a progress report ordered by completed days:
|
|
|
271
282
|
docker compose exec -e RAILS_ENV=production rails bin/rails bible270:readers:list
|
|
272
283
|
```
|
|
273
284
|
|
|
274
|
-
The report
|
|
285
|
+
The report defaults to active readers, showing completed days, last activity, and status: on track, ahead, behind, or undated.
|
|
286
|
+
|
|
287
|
+
### Runs and alumni
|
|
288
|
+
|
|
289
|
+
At the bottom of Admin, enter a start date, choose **Start a new run**, and accept the confirmation prompt. This:
|
|
290
|
+
|
|
291
|
+
- Archives the current memberships and freezes their calendars and statistics.
|
|
292
|
+
- Makes all current Admins and Site-admins active in the new run, with zero progress and no personal start date. Previous progress stays in read-only history.
|
|
293
|
+
- Leaves other readers as alumni and opens enrollment, even if the installation started with `config.enrollment_open = false`.
|
|
294
|
+
- Keeps reader accounts, photos, check-offs, reflections, replies, likes, and admin roles.
|
|
295
|
+
|
|
296
|
+
**Revert to previous run** restores the reader statuses, personal dates, shared-date override, and enrollment settings saved before the restart. Everyone, including Admins and Site-admins, returns to their saved status; readers who joined only the newer run become alumni. Both runs' progress and discussions are kept, and admin roles do not change. Accept the confirmation prompt to proceed. Revert is available only for restarts made after migration `20260101000026`; earlier states cannot be reconstructed safely. Restored settings without an override follow the current site configuration.
|
|
297
|
+
|
|
298
|
+
Alumni can sign in, view Community's **active-reader list**, and post, reply to, and like reflections. Earlier reflections remain visible under the same moderation rules. Archived check-offs are read-only and excluded from current statistics and daily completer lists.
|
|
299
|
+
|
|
300
|
+
**Show / Hide Active Readers** starts expanded and remembers your choice in the current tab's sign-in session, including after sorting or revisiting Admin. Sorting and Reader Stats stay accessible when it is collapsed.
|
|
301
|
+
|
|
302
|
+
**Show / Hide Alumni** at the bottom of Admin uses the browser's built-in expandable section, starting collapsed like **View all 270 days**. It needs no JavaScript or reload and changes no membership. It uses the selected sort and frozen reader statistics; the main list and Reader Stats show active readers only. Each alumni row has a confirmed **Make Active** button that returns to Admin with the same sort.
|
|
303
|
+
|
|
304
|
+
Only admins reactivate alumni; signing in or posting does not re-enroll them:
|
|
305
|
+
|
|
306
|
+
- **New run:** zero completions and no personal start date; old history stays intact.
|
|
307
|
+
- **Same run:** progress and personal start date are preserved.
|
|
308
|
+
|
|
309
|
+
Each reader's **Past runs / history** table shows read-only start/end dates, archive date, and completed days.
|
|
310
|
+
|
|
311
|
+
Admin templates include `bible270/shared/admin_confirmations`, even with custom layouts. Keep this partial in host template overrides; no layout include is needed.
|
|
275
312
|
|
|
276
313
|
### Consistency ranking
|
|
277
314
|
|
|
@@ -279,24 +316,24 @@ Consistency is the average end-of-day score on a dated schedule:
|
|
|
279
316
|
|
|
280
317
|
`100 + 5 × min(days ahead, 7) − 10 × days behind`
|
|
281
318
|
|
|
282
|
-
A score of 100
|
|
319
|
+
A score of 100 means on track on average, not 100%. Negative scores display as `0` but keep their true ranking. All Admin sorts show scores, on-track/ahead percentages, and evaluated-day counts; consistency sort adds an explanation and **Rank** column.
|
|
283
320
|
|
|
284
|
-
- Evaluation runs from the later of plan start or
|
|
321
|
+
- Evaluation runs from the later of plan start or joining the run (`joined_at`) through the earlier of yesterday or plan end, in the plan's time zone. Archives use frozen dates and stop before the archive date. Joining late does not reset the scheduled day.
|
|
285
322
|
- A day counts when all required readings are checked off, using the latest check-off timestamp. Early completions carry forward; today's catch-up does not improve previous evenings.
|
|
286
323
|
- Readers with seven or more evaluated evenings rank first, then **Provisional** readers with one to six, then **Not ranked** readers with none.
|
|
287
|
-
-
|
|
324
|
+
- Rank uses unrounded score, then on-track/ahead percentage, then evaluated days. Ties share ranks (`1, 1, 1, 4`), ordered by name and ID. Unranked readers show a dash.
|
|
288
325
|
|
|
289
|
-
This is **reconstructed history, not an audit log**. Rechecking readings, bulk progress edits, or
|
|
326
|
+
This is **reconstructed history, not an audit log**. Rechecking readings, bulk progress edits, or date changes can alter active-run scores. Completion timestamps record entry time, not necessarily reading time. No snapshot job is required.
|
|
290
327
|
|
|
291
328
|
## Reflections and notifications
|
|
292
329
|
|
|
293
|
-
|
|
330
|
+
Reflections are ordered by latest approved reply, with day/author filters, page navigation, and new-activity indicators.
|
|
294
331
|
|
|
295
|
-
Drafts stay in
|
|
332
|
+
Drafts stay in this browser for up to **30 days**, clearing after a successful post. Blocked or full storage triggers a warning but does not prevent posting. **Clear browser storage on shared devices** to remove drafts.
|
|
296
333
|
|
|
297
|
-
|
|
334
|
+
Type `@` for up to five reader-handle suggestions; manual mentions work without JavaScript. **Formatting** adds bold, italic, quotations, lists, links, and YouTube videos. **Preview** applies the same safety filtering as posts. Existing reflections stay plain text unless converted; without migration `20260101000021` (`body_format`), the composer also uses plain text.
|
|
298
335
|
|
|
299
|
-
|
|
336
|
+
With `config.mention_notifications` enabled, readers or admins can choose email for all reflections/replies, only direct replies and mentions, or none. Broad notices use BCC and exclude alumni. Personal notices are individually addressed and still reach opted-in alumni; saved preferences are kept.
|
|
300
337
|
|
|
301
338
|
Migration `20260101000018` adds broad notifications without changing existing choices; `20260101000022` makes them the default for new readers only. Follow [Upgrading](#upgrading) to install these and the visit-tracking migration (`20260101000017`).
|
|
302
339
|
|
|
@@ -320,11 +357,37 @@ The **Video** button accepts YouTube watch, share (`youtu.be`), Shorts, live, an
|
|
|
320
357
|
[YouTube video](https://www.youtube.com/watch?v=aB3_dE-fG12 "bible270-video")
|
|
321
358
|
```
|
|
322
359
|
|
|
323
|
-
Preview and
|
|
360
|
+
Preview and posts show **View video** or **View video ‘Name’**. No remote thumbnail or player loads until playback is requested. The player uses `www.youtube-nocookie.com` without autoplay. **Loading it shares the reader's IP address and request metadata with YouTube**; privacy-enhanced mode is not anonymous.
|
|
361
|
+
|
|
362
|
+
**Open on YouTube** works without JavaScript or when embeds are blocked, opening a new tab with `rel="nofollow ugc noopener"`. Emails use ordinary links with the optional name. Unmarked or unsupported links stay links; start times and playlists are not retained. No API key, extra gem, or migration is needed; uploads are not supported.
|
|
363
|
+
|
|
364
|
+
For a host Content Security Policy (CSP), add `https://www.youtube-nocookie.com` to existing **`frame-src`**; do not replace the policy or allow arbitrary frames. Custom layouts must render `bible270/shared/video_embeds` once.
|
|
365
|
+
|
|
366
|
+
## Scripture frame
|
|
367
|
+
|
|
368
|
+
Hover over the header's bread icon for **3 seconds** to open a random passage in a theme-matched frame. Tap, click, or focus the icon and press Enter/Space to open immediately. Hover previews fade when you leave; Escape, selecting the bread again, or clicking outside dismisses the frame.
|
|
369
|
+
|
|
370
|
+
Completing a day's final check-off fades in a random frame over **1.3 seconds**, holds it for **5.5 seconds**, then plays a **1.4-second** dove flight. The dove keeps moving while it and the frame fade together over the flight's final **0.4 seconds**, with no final pause or extra delay. Disabling the dove keeps the frame, which fades out over **0.2 seconds** after the hold. Reduced-motion users see a static frame without the dove; Escape dismisses the sequence early.
|
|
371
|
+
|
|
372
|
+
The [bundled YAML catalog](config/scripture_frames.yml) includes Deuteronomy 6:6-7 (NASB95), Deuteronomy 11:18 (NKJV), Deuteronomy 30:14 (ESV), Psalm 19:8 (NKJV), Psalm 107:20 (NKJV), Psalm 119:11 (NASB95), Psalm 119:47 (NKJV), Psalm 119:103 (NASB95), Psalm 119:105 (NKJV), Psalm 119:130 (NASB95), Proverbs 6:23 (NASB95), Isaiah 55:11 (ESV), Jeremiah 15:16 (NASB95), Jeremiah 23:29 (NKJV), John 6:63 (NKJV), John 17:17 (NASB95), 2 Corinthians 4:6 (NKJV), Colossians 3:16 (ESV), 2 Timothy 3:16-17 (ESV), Hebrews 4:12 (NKJV), and 1 Peter 2:2-3 (NASB95), in biblical order. Near the bottom of **Admin**, **Scripture frames** lists custom passages in biblical order before defaults, with Custom/Default marked on each row rather than separate group headings. Non-Scripture quotations follow custom passages. Hover or focus a row's heading to preview the text; select it to expand. **Add text** sits beside **Scripture frames**; Edit, Disable/Enable, and Delete sit beside each custom heading. All text management lives on this page. To add a passage, enter Reference and Translation on the top row, then paste the required Text (up to 4,000 characters). Bible translation credits are automatic; line breaks are preserved. For non-Scripture text, select **Other quotation**, enter **Author / source**, and paste the quote. These frames show the source without a Bible translation or its copyright credit and join the same random selection when enabled. Use texts you have permission to reproduce.
|
|
373
|
+
|
|
374
|
+
**Admin additions are stored in the database and supplement the defaults. They never change the YAML file.** Defaults start enabled. Use the **Enable/Disable** button to the right of each default in Admin; disabled texts remain previewable but are excluded from bread-icon and completion frames. These switches are saved across runs without changing YAML or requiring a new migration. Default text cannot be edited or deleted; custom texts can be edited, disabled, or deleted. Adding custom texts requires migration `20260101000027`.
|
|
375
|
+
|
|
376
|
+
**TODO:** Integrate the [YouVersion API](https://developers.youversion.com/) to retrieve Scripture text by reference and translation. Keep the app key server-side, confirm permission to store and display each translation, and preserve required attribution. For now, paste the text; no API setup is needed.
|
|
377
|
+
|
|
378
|
+
Hosts can optionally replace the default catalog:
|
|
379
|
+
|
|
380
|
+
```ruby
|
|
381
|
+
config.scripture_frames_path = Rails.root.join('config/bible270_scripture_frames.yml')
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Use the bundled YAML structure: a list of entries with a unique slug `id`, `reference`, `translation`, `text`, and optional `attribution`. Keep one consistent attribution per translation. Catalog translations become choices in Admin, alongside NKJV, NASB95, LSB, ESV, KJV, YLT, CSB, and NIV. Shared choices follow the reader-preference order; CSB and NIV follow them. Custom database texts still supplement the chosen catalog. Invalid or unreadable host catalogs fall back to the bundled defaults.
|
|
324
385
|
|
|
325
|
-
|
|
386
|
+
Custom layouts that include the header must also render the shared styles and this partial once near the end of `<body>`:
|
|
326
387
|
|
|
327
|
-
|
|
388
|
+
```erb
|
|
389
|
+
<%= render "bible270/shared/scripture_frame_ui" %>
|
|
390
|
+
```
|
|
328
391
|
|
|
329
392
|
## Themes
|
|
330
393
|
|
|
@@ -357,7 +420,7 @@ config.allow_reader_start_date = true
|
|
|
357
420
|
| a date | false | Shared date for everyone; stored personal dates ignored |
|
|
358
421
|
| nil | false | Fully undated |
|
|
359
422
|
|
|
360
|
-
Dated plans show dates, a **Today** badge, and
|
|
423
|
+
Dated active plans show dates, a **Today** badge, and “Go to today.” Admins can override the shared `config.start_date` without deploying, reset it, or adjust personal calendars. Changes immediately shift dates, Today, and reminders for affected active readers. **Check-offs and reflections stay tied to day numbers.** Archives keep their frozen calendar (including undated ones), with no Today marker; later date or calendar-setting changes do not affect them. Changing the start date does not [start a new run](#runs-and-alumni).
|
|
361
424
|
|
|
362
425
|
Date helpers work without Rails:
|
|
363
426
|
|
|
@@ -371,7 +434,7 @@ Bible270::Plan.before_start?(date, start)
|
|
|
371
434
|
|
|
372
435
|
## Daily reading reminders
|
|
373
436
|
|
|
374
|
-
Reminders require
|
|
437
|
+
Reminders require host enablement and reader opt-in; both default to off. Profile offers quarter-hour times (default `08:00`), preserving older off-quarter choices until changed. Times use the **plan's time zone**, shown in Profile, not the device's.
|
|
375
438
|
|
|
376
439
|
```ruby
|
|
377
440
|
# config/initializers/bible270.rb
|
|
@@ -403,7 +466,7 @@ For Docker Compose, use `pwd` in the Compose directory and `command -v docker` t
|
|
|
403
466
|
|
|
404
467
|
`-T` disables the interactive terminal that cron cannot provide. Verify with `crontab -l` and check the log after the next interval. **Run one scheduler per database**, not one per web container.
|
|
405
468
|
|
|
406
|
-
The task
|
|
469
|
+
The task uses `deliver_now` on the first run at or after the chosen local time, recording the sent date only after success. It skips alumni, already-sent dates, undated or out-of-range calendars, completed days, blank emails, and readers not opted in. Failures are logged without stopping other deliveries; each run prints a delivered count.
|
|
407
470
|
|
|
408
471
|
## Avatar optimization
|
|
409
472
|
|
|
@@ -411,7 +474,9 @@ Profile and Admin uploads produce a **256×256 static WebP at quality 85**: auto
|
|
|
411
474
|
|
|
412
475
|
Limits are **2 MiB** by default (`config.avatar_max_bytes`) and **40 million pixels** in the selected frame/container canvas. The pixel limit bounds dimensions, not total processor memory. Processing or storage failure leaves the previous picture and profile details unchanged.
|
|
413
476
|
|
|
414
|
-
The
|
|
477
|
+
The original, **including its metadata**, stays in `avatar`; `avatar_thumbnail` holds the display image. This allows reprocessing, not picture history: storage grows even as downloads shrink. Replacing or removing a picture detaches the old pair; **keep Active Job workers running** for purge jobs. No migration is needed if Active Storage is installed.
|
|
478
|
+
|
|
479
|
+
On desktop, hover over an avatar for **3 seconds** to preview the uncropped original, fitted to the viewport with a 200 ms fade. The original is fetched on demand; touch behavior is unchanged.
|
|
415
480
|
|
|
416
481
|
### Backfill existing uploads
|
|
417
482
|
|
|
@@ -428,12 +493,12 @@ RAILS_ENV=production bundle exec rake bible270:avatars:optimize BATCH_SIZE=100
|
|
|
428
493
|
RAILS_ENV=production bundle exec rake bible270:avatars:optimize FORCE=1
|
|
429
494
|
```
|
|
430
495
|
|
|
431
|
-
- Skips current thumbnails, protects concurrent avatar changes, continues after
|
|
432
|
-
- Reports reader IDs, counts, and original/optimized **display-byte totals**, not
|
|
433
|
-
- `BATCH_SIZE` defaults to 100 (
|
|
434
|
-
- Reads originals and writes thumbnails
|
|
496
|
+
- Skips current thumbnails, protects concurrent avatar changes, and continues after failures, exiting nonzero if any fail. Fix files, limits, storage access, or processor dependencies, then rerun.
|
|
497
|
+
- Reports reader IDs, counts, and original/optimized **display-byte totals**, not storage savings.
|
|
498
|
+
- `BATCH_SIZE` defaults to 100 (range: 1–1000). Dry-run checks eligibility, not file availability or decodability.
|
|
499
|
+
- Reads originals and writes thumbnails; remote storage may incur request/transfer costs. Provider avatars and unrelated host attachments are untouched.
|
|
435
500
|
|
|
436
|
-
Host
|
|
501
|
+
Host uploads should use `reader.attach_avatar(upload)` or `Bible270::AvatarImages.update!(reader, attributes, upload: upload)`; direct attachment bypasses optimization. **Run uploads and backfills outside caller-owned database transactions** to avoid orphaned files after rollback. Failed cleanup retains unattached blob records and storage keys for retry; use logged blob IDs in host cleanup.
|
|
437
502
|
|
|
438
503
|
## Configuration reference
|
|
439
504
|
|
|
@@ -444,7 +509,7 @@ Bible270.configure do |config|
|
|
|
444
509
|
config.mount_at = "/daily-bread"
|
|
445
510
|
config.app_name = "Daily Bread"
|
|
446
511
|
config.tagline = "Journeying through Scripture in 9 months"
|
|
447
|
-
config.admin_emails = %w[andrew@example.org]
|
|
512
|
+
config.admin_emails = %w[andrew@example.org] # Site-admins
|
|
448
513
|
|
|
449
514
|
config.start_date = nil # no shared calendar by default
|
|
450
515
|
config.allow_reader_start_date = true
|
|
@@ -536,14 +601,17 @@ Mount the engine and add a CMS navigation link to use its own themed pages. To u
|
|
|
536
601
|
|
|
537
602
|
| Table | Holds |
|
|
538
603
|
|-------|-------|
|
|
539
|
-
| `bible270_readers` | Identity, provider/uid or polymorphic owner, start date, and
|
|
540
|
-
| `
|
|
604
|
+
| `bible270_readers` | Identity, provider/uid or polymorphic owner, personal start date, preferences, and persistent `admin` boolean |
|
|
605
|
+
| `bible270_plan_runs` | Current-run marker, shared start date, and archive timestamp |
|
|
606
|
+
| `bible270_participations` | One membership per reader/run (unique pair), Active/Alumni status, `joined_at`, personal date, archive date, and frozen effective start date |
|
|
607
|
+
| `bible270_checkoffs` | Reader and participation references; one row per participation/day/track/part, protected by a unique index |
|
|
541
608
|
| `bible270_comments` | Day/track reflections and replies, stored as plain text or safely rendered Markdown |
|
|
542
609
|
| `bible270_likes` | Reader likes on comments |
|
|
543
|
-
| `bible270_settings` |
|
|
610
|
+
| `bible270_settings` | Current shared-date override, enrollment state, and administrative settings |
|
|
611
|
+
| `bible270_scripture_frames` | Admin-added passages, translation credits, and enabled status; shared across runs |
|
|
544
612
|
| `bible270_sign_in_tokens` | Email, token digest, expiry, and consumption time |
|
|
545
613
|
|
|
546
|
-
A day
|
|
614
|
+
A complete day requires all parts of all three tracks. Progress uses the current membership, or the latest historical one if absent; runs are never added together. Reflections, replies, and likes belong to readers and remain shared across groups. **Progress and visible reflections are public, not private journals.**
|
|
547
615
|
|
|
548
616
|
## Routes (inside the mount point)
|
|
549
617
|
|
|
@@ -562,6 +630,7 @@ DELETE /comments/:id comments#destroy
|
|
|
562
630
|
POST /comments/:id/like likes#toggle
|
|
563
631
|
GET /community readers#index
|
|
564
632
|
GET /mention-suggestions readers#mention_suggestions (signed-in JSON)
|
|
633
|
+
GET /scripture-frame scripture_frames#show (public JSON)
|
|
565
634
|
GET /readers/:id readers#show
|
|
566
635
|
GET /progress readers#progress
|
|
567
636
|
GET /sign_in sessions#new
|
|
@@ -602,9 +671,9 @@ Precedence is built-in `CHAPTER_BREAKS`, then `config.chapter_breaks`, then YAML
|
|
|
602
671
|
| `PSALM_119_SECTION_SIZE` | `16` | Default verses per Psalm 119 section |
|
|
603
672
|
| `CHAPTER_BREAKS` | Built-in chapter map | Selected breaks and whole-chapter overrides |
|
|
604
673
|
|
|
605
|
-
For New Testament and Psalms/Proverbs
|
|
674
|
+
For New Testament and Psalms/Proverbs, explicit breaks fix a chapter's reading count; other chapters divide by verse load to fill remaining days, using equal parts. Psalms/Proverbs reserves the final day for Psalm 1.
|
|
606
675
|
|
|
607
|
-
Breaks must be ascending, distinct, and inside the chapter; invalid entries or too many pinned readings raise `ArgumentError`.
|
|
676
|
+
Breaks must be ascending, distinct, and inside the chapter; invalid entries or too many pinned readings raise `ArgumentError`. Cached results refresh when breaks change. No schedule migration is needed, but **changed assignments do not remap check-offs or reflections**. Test custom schedules before using them with an active group.
|
|
608
677
|
|
|
609
678
|
## Scaling
|
|
610
679
|
|
|
@@ -622,11 +691,11 @@ Custom controls must POST with a CSRF token; use `button_to`. Confirm `omniauth-
|
|
|
622
691
|
|
|
623
692
|
**No email arrives**
|
|
624
693
|
|
|
625
|
-
Check Action Mailer
|
|
694
|
+
Check Action Mailer settings, an accepted `mailer_from`, and logs. Sign-in uses `deliver_now` unless `email_sign_in_deliver_later` is enabled; then check the Active Job worker too. Delivery errors are hidden from readers to avoid revealing accounts.
|
|
626
695
|
|
|
627
696
|
**“That link has expired or was already used”**
|
|
628
697
|
|
|
629
|
-
Request a fresh link. Links are single-use and expire after 20 minutes by default. Mail scanners or preview bots can consume them
|
|
698
|
+
Request a fresh link. Links are single-use and expire after 20 minutes by default. Mail scanners or preview bots can consume them early; investigate prefetching if it recurs. Increasing `email_sign_in_ttl` helps only with expiry, not consumed links.
|
|
630
699
|
|
|
631
700
|
**Custom layout is unstyled**
|
|
632
701
|
|
|
@@ -641,7 +710,9 @@ node --test test/javascript/*.cjs
|
|
|
641
710
|
bundle exec rubocop --cache false
|
|
642
711
|
```
|
|
643
712
|
|
|
644
|
-
`rake test`
|
|
713
|
+
`rake test` uses one isolated worker per available CPU, up to eight. Coverage stays enabled at `coverage/index.html`; recorded runtimes in `tmp/parallel_runtime_test.log` balance the work. Large Admin and Profile tests are split by feature, with shared setup in `test/support`.
|
|
714
|
+
|
|
715
|
+
Use `PARALLEL_WORKERS=4 bundle exec rake test` to choose the count, or `bundle exec rake test:serial` for serial coverage. Logs keep warnings and errors in `test/dummy/log/test-*.log`; set `TEST_LOG_LEVEL=debug` for request, template, and SQL details.
|
|
645
716
|
|
|
646
717
|
Video UI tests require **Node.js 22+**, use the built-in runner with no npm dependencies, and do not contact YouTube. Check live playback and host CSP separately in a browser. Plan logic is unit-tested without a Rails dependency.
|
|
647
718
|
|
|
@@ -660,7 +731,7 @@ Use your local host/port. If `raw` is nil, the address is invalid or rate-limite
|
|
|
660
731
|
|
|
661
732
|
Report bugs or open pull requests at <https://github.com/avonderluft/bible270>.
|
|
662
733
|
|
|
663
|
-
Fork
|
|
734
|
+
Fork, clone, and branch from `main` (`git checkout -b my-feature`). Add tests, run the [development checks](#development), and open a pull request against `main` explaining the change.
|
|
664
735
|
|
|
665
736
|
- Keep plan logic independent of Rails.
|
|
666
737
|
- Pin exact expected references in tests for schedule changes.
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'bundler/gem_tasks' # provides build / install / release
|
|
4
|
+
require 'etc'
|
|
4
5
|
require 'open3'
|
|
5
6
|
require 'rake/testtask'
|
|
6
7
|
require 'stringio'
|
|
@@ -144,7 +145,7 @@ end
|
|
|
144
145
|
|
|
145
146
|
Rake::Task[:build].enhance([:normalize_gem_permissions])
|
|
146
147
|
|
|
147
|
-
desc 'Run tests in isolated processes
|
|
148
|
+
desc 'Run tests in isolated processes'
|
|
148
149
|
namespace :test do
|
|
149
150
|
task :prepare_serial do
|
|
150
151
|
FileUtils.rm_rf('coverage')
|
|
@@ -160,7 +161,7 @@ namespace :test do
|
|
|
160
161
|
Rake::Task['test:serial'].enhance(['test:prepare_serial'])
|
|
161
162
|
|
|
162
163
|
task :parallel do
|
|
163
|
-
workers = ENV.fetch('PARALLEL_WORKERS',
|
|
164
|
+
workers = ENV.fetch('PARALLEL_WORKERS') { Etc.nprocessors.clamp(1, 8).to_s }
|
|
164
165
|
FileUtils.rm_rf('coverage')
|
|
165
166
|
env = {
|
|
166
167
|
'PARALLEL_COVERAGE' => 'true',
|