Commit Graph

341 Commits

Author SHA1 Message Date
0daf413b47 Prevent sole admin from deleting their account
Without this guard, the last admin in the system could delete their own
account, making the application unmanageable. This adds a model method
`User#sole_admin?`, a controller guard in `RegistrationsController#destroy`,
and disables the delete button in the profile edit view when the current
user is the only remaining admin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 06:52:14 +00:00
f3cb8db1f4 Setup wizard: use labeled-form grid for vertical field layout
Replace the fieldset-based layout with the app's standard
.labeled-form CSS grid so email, password and retype fields
stack vertically (label left, input right) exactly like the
existing sign-in and registration forms.

Section headings and checkbox rows are given explicit grid-column
spans via inline styles so they span the full form width rather
than being constrained to the label column.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 17:37:49 +00:00
7904ff3ef9 Add web-based installation wizard
Replace the CLI-only setup (db:seed + manual application.rb edits)
with a web wizard shown automatically on first visit when no admin
account exists yet.

SetupController (GET/POST /setup) collects the admin e-mail and
password, a "skip e-mail confirmation" toggle, and an option to
seed the built-in default units.  Once submitted it creates the
admin User, persists the chosen options as Setting records, and
redirects to the sign-in page.

ApplicationController gains a redirect_to_setup_if_needed
before_action that catches every request (including Devise routes)
when no admin exists, so a fresh installation always lands on the
wizard rather than an empty sign-in form.

A new Setting model provides a lightweight key-value store for
runtime options that were previously hard-coded in application.rb
(e.g. skip_email_confirmation).  RegistrationsController now reads
that flag from the database instead of from the application config.

Seeds.rb is kept for headless / automated deployments and skips
admin creation when an admin already exists (idempotent), with a
comment pointing to the web wizard as the preferred path.

Also extends the SQLite nil-limit fix (|| Float::INFINITY) to the
Quantity model, which suffered the same ArgumentError as Unit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 17:19:24 +00:00
9ad922e3a1 Add skip_email_confirmation option; fix SQLite length validation
Introduce config.skip_email_confirmation in application.rb.dist.
When set to true, new registrations are automatically confirmed
without requiring email verification — useful for installations
where outgoing email is not configured or for development/testing.
Implemented by calling skip_confirmation! in build_resource before
the record is saved, so no confirmation email is ever sent.

Also fix ArgumentError raised in length validations when
type_for_attribute(:column).limit returns nil, which happens with
SQLite for string columns that have no explicit limit in the
migration. Guard with || Float::INFINITY so the validation is
effectively skipped when the database imposes no limit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 15:57:50 +00:00
ea8bff9b3d Bundle update to Rails 7.2.3, Devise 5 2026-02-26 02:39:11 +01:00
80130fb7d1 Allow cascade delete Unit/Quantity
Closes #32
2026-02-22 17:50:43 +01:00
1ba7d29441 Update tests to match labeled form changes 2026-02-22 00:55:21 +01:00
84945fa4b4 Simplify and improve labeled form 2026-02-22 00:53:18 +01:00
675eb0aad8 Optimize styles; clean up <fieldset> 2026-02-03 15:33:37 +01:00
bd1a664caa Measurement form based on select-styled <details> 2026-01-31 17:22:09 +01:00
0fb7f9946a Create alternative, spreadsheet-like style 2025-07-29 15:43:49 +02:00
d9bd2b46e3 Fix svg_tag display on Users tab 2025-07-26 23:24:54 +02:00
3aaf06806f Update Contributing section regarding gems and assets 2025-07-26 00:24:23 +02:00
ef0f3cbae3 Revert to asset precompilation in production 2025-07-26 00:10:59 +02:00
eb2d45ddc2 Draft auto-installation of database adapter gems 2025-07-25 15:32:31 +02:00
ae5bad89ac Update db schema 2025-07-25 15:31:41 +02:00
da38d8b585 Create Devise routes only when 'users' table exists
Closes #42
2025-07-25 15:30:26 +02:00
magicfixin
5ffc6974f0 Improve installation process 2025-07-23 23:42:41 +02:00
e12369cea1 Measurements#new form improvements 2025-05-13 22:30:58 +02:00
ef3484dfdf Update Measurements#new form pathnames on actions 2025-05-07 00:24:05 +02:00
9dbcfddf98 Merge corrections provided by Bambuch, cont. 2025-04-26 19:12:56 +02:00
cd9a64b5ad Merge corrections provided by Bambuch 2025-04-26 18:32:45 +02:00
f7e4fe2d38 Ignore .mysql_history 2025-04-25 14:27:53 +02:00
a1e17aee85 bundle update 2025-04-25 14:27:01 +02:00
e8a0768d97 Update Quantity.depth using WITH + UPDATE ALL 2025-04-25 14:25:13 +02:00
d1593df0e0 Use callbacks instead of attribute methods to update cached values 2025-04-24 18:59:36 +02:00
fe66522c21 Cached attribute definition (attr_cached) 2025-04-19 20:29:29 +02:00
1cddc794d2 Cleanup Quantity :pathname related code 2025-03-23 13:11:14 +01:00
3b30e58ff3 Persist Quantity :pathname 2025-03-23 12:56:57 +01:00
4c867daabb Patch ActiveRecord with PR 54658 2025-03-22 14:14:42 +01:00
8401424efa Partial refresh of Measurements#new form 2025-02-18 18:27:47 +01:00
c48bf290fd Implement Measurements#new 2025-02-18 11:25:32 +01:00
2f3c0e40a6 bundle update 2025-02-13 22:16:59 +01:00
72515b2aa2 Relax Ruby version requirement 2025-02-13 22:16:35 +01:00
9d60eee16b Add Measurements tab and #new form 2025-01-25 16:34:04 +01:00
3d7daa8944 Create Readout model 2025-01-22 00:14:57 +01:00
6300273186 Cleanup 2025-01-16 21:37:58 +01:00
2fdd770457 Center images in 'icon only' table columns 2025-01-16 21:29:10 +01:00
dada29d5e6 Fix table row indentation for hierarchy
Closes #57
2025-01-16 21:19:01 +01:00
5fff9adf4d Delete Units respecting foreign key constraint 2025-01-16 20:46:22 +01:00
7962cdf169 Simplify object and association checks
* check for <object> instead of <object>.nil?
* check for <association>_id? instead of <association>.nil? (avoids
  record loading)
2025-01-16 20:42:18 +01:00
c908063212 Persist Quantity :depth instead of computing it on the fly 2025-01-16 17:14:52 +01:00
30686dd1fc Cleanup of hierarchy related methods 2025-01-16 03:24:43 +01:00
cb69629276 Use associations in finders 2025-01-15 14:06:00 +01:00
2c0ae1530a Turn #ancestors into #with_ancestors scope 2025-01-14 23:27:32 +01:00
27038a74d0 Return Quantity progenies as a result of partial ordering
Separate scope only provided some optimisation by reducing the count of
records :numbered and should be unnecessary in future once numbering
can be merged with ordering into one recursive query
2025-01-14 23:25:26 +01:00
201359de3e Allow to reparent Quantity everywhere
Closes #61
2025-01-14 21:13:35 +01:00
8524beefdc Allow to drag all Quantities 2025-01-14 15:03:25 +01:00
644d1f4b9a Add Quantity #reparent action 2025-01-14 15:02:38 +01:00
4b453c1a82 Add :progenies as a scope to list ordered descendants of Quantity 2025-01-14 01:01:06 +01:00