Commit Graph

146 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
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
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
1cddc794d2 Cleanup Quantity :pathname related code 2025-03-23 13:11:14 +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
9d60eee16b Add Measurements tab and #new form 2025-01-25 16:34:04 +01:00
dada29d5e6 Fix table row indentation for hierarchy
Closes #57
2025-01-16 21:19:01 +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
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
2c0d5af022 Merge Unit and Quantity drag&drop js
Closes #55
2025-01-13 02:23:51 +01:00
421515e5ce ancestors() sets depth for self, instead of returning new instance 2025-01-12 18:09:34 +01:00
d5e7ccacf5 Add Quantity #edit and #update 2025-01-11 22:51:49 +01:00
57f10c94a4 Add Quantity #new, #create, #destroy actions 2025-01-11 17:01:34 +01:00
23e2f6a062 Move :base_id hidden field to form tag 2025-01-08 14:36:32 +01:00
aa862f0e90 Quantities index WIP 2025-01-05 20:47:49 +01:00
d86e38a3ec Hide input[type=number] spin buttons and fix text alignment 2025-01-04 16:54:27 +01:00
ed0234f158 Allow only positive Unit multiplier
Closes #51
2025-01-04 15:32:07 +01:00
af152c5e8b Disable links instead of hiding
Closes #49
2025-01-03 14:41:18 +01:00
42aaf39f14 Remove unused turbo_stream index 2025-01-02 19:21:01 +01:00
5dd3303019 Disable Turbo in User forms/links 2025-01-02 19:20:08 +01:00
afc4f5cee0 Hide page only during tests 2025-01-02 19:04:14 +01:00
8b1a186467 Disable Turbo prefetch 2025-01-02 03:01:30 +01:00
a6e3833fd0 Extend custom FormBuilder to DRY in forms
Closes #8
Closes #45
2025-01-01 16:26:58 +01:00
c8c8d8cd70 Hide actions for restricted users
Closes #43
2024-12-30 00:44:21 +01:00
8552571526 Disable Unit destuction for base units with subunits
Closes #40
2024-12-28 23:57:47 +01:00
a9307ad455 Form uses button instead of input to display SVG 2024-12-23 00:47:44 +01:00
0659c1e1c1 Don't render index on Unit actions 2024-12-22 01:31:14 +01:00
d726e92445 Allow opening multiple new/edit forms
Closes #30
2024-12-21 17:52:45 +01:00
e5cf3dc0ae Avoid refreshing whole index on create 2024-12-19 03:46:29 +01:00
ba8ac5d2fa Remove unnecessary link_id 2024-12-17 02:44:52 +01:00
f0dab7a5f9 Fix Units new/edit display on validation errors
Add test_new_and_edit_on_validation_error
Closes #41
2024-12-17 01:53:25 +01:00
d5719b1e9d Fill multiplier field, confirm Add button disabled 2024-12-12 00:44:26 +01:00
0b201606c2 Replace #columns_hash with #type_for_attribute for limits 2024-12-08 13:47:30 +01:00
15a5515c99 Extend NumericalityValidator to check precision and scale
Use new checks on Unit.multiplier
Closes #28
2024-12-07 20:41:19 +01:00
7e5f873cde Change helper into BigDecimal method 2024-12-06 15:24:25 +01:00
2cbae12fa2 Implement Units default destroy 2024-11-30 16:11:31 +01:00
1fedd70fe5 Fix defaults listing
Base symbol was displayed twice when it existed as default and
non-default and both of them had at least one subunit.
Also: sorting by base_id yielded non-alphabetic order in such case.
2024-11-27 19:54:50 +01:00
3711251656 Unit: limit symbol length, change name:string -> description:text
Closes #11
Closes #12
2024-11-24 15:13:59 +01:00
f4ca1e91fa Mark redirecting buttons with trailing '...'
Closes #2
2024-11-23 23:26:08 +01:00
e75391ae18 Display User name using #to_s 2024-11-23 14:55:29 +01:00