From 3e5d896662ec56968818f5f68927c1ceb92c24ff Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Sun, 15 Nov 2026 17:58:47 -0500 Subject: [PATCH] Locked flight readings look locked The tach and Hobbs fields of an earlier flight were disabled but looked like any other field. Disabled fields now look it everywhere (grey, muted text, a not-allowed cursor), and the flight form marks its locked readings "Locked". Co-Authored-By: Claude Opus 5.5 --- app/assets/tailwind/application.css | 2 +- app/views/flight_logs/_fields.html.erb | 4 ++-- config/locales/en.yml | 1 + test/integration/flight_edit_test.rb | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/tailwind/application.css b/app/assets/tailwind/application.css index a59fc06..87e453a 100644 --- a/app/assets/tailwind/application.css +++ b/app/assets/tailwind/application.css @@ -26,7 +26,7 @@ @utility card-body { @apply p-4; } @utility label { @apply block text-sm font-medium text-slate-700 mb-1; } -@utility input { @apply block w-full rounded-md border-0 px-2.5 py-1.5 text-sm text-slate-900 shadow-sm ring-1 ring-slate-300 ring-inset placeholder:text-slate-400 focus:ring-2 focus:ring-sky-600 focus:outline-none bg-surface; } +@utility input { @apply block w-full rounded-md border-0 px-2.5 py-1.5 text-sm text-slate-900 shadow-sm ring-1 ring-slate-300 ring-inset placeholder:text-slate-400 focus:ring-2 focus:ring-sky-600 focus:outline-none bg-surface disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500 disabled:shadow-none disabled:ring-slate-200; } @utility hint { @apply mt-1 text-xs text-slate-500; } @utility field-error { @apply mt-1 text-xs text-red-600; } diff --git a/app/views/flight_logs/_fields.html.erb b/app/views/flight_logs/_fields.html.erb index a705148..0da5162 100644 --- a/app/views/flight_logs/_fields.html.erb +++ b/app/views/flight_logs/_fields.html.erb @@ -10,13 +10,13 @@

<%= t("flight_logs.fields.meters_locked_html", link: link_to(t("flight_logs.fields.update_hours"), aircraft_path(@aircraft), class: "link")) %>

<% end %> <%= tag.fieldset class: "grid gap-4 sm:grid-cols-3", disabled: meters_locked do %> - <%= t("flight_logs.new.tach_required") %> + <%= t("flight_logs.new.tach_required") %><% if meters_locked %> <%= t("flight_logs.fields.locked") %><% end %> <%= f.field :tach_out, as: :number, step: 0.1, label: t("flight_logs.new.tach_out") %> <%= f.field :tach_in, as: :number, step: 0.1, label: t("flight_logs.new.tach_in") %> <%= f.field :tach_time, as: :number, step: 0.1, label: t("flight_logs.new.or_duration"), hint: t("flight_logs.new.calculated_from_out_in_if") %> <% end %> <%= tag.fieldset class: "grid gap-4 sm:grid-cols-3", disabled: meters_locked do %> - <%= t("flight_logs.new.hobbs_optional") %> + <%= t("flight_logs.new.hobbs_optional") %><% if meters_locked %> <%= t("flight_logs.fields.locked") %><% end %> <%= f.field :hobbs_out, as: :number, step: 0.1, label: t("flight_logs.new.hobbs_out") %> <%= f.field :hobbs_in, as: :number, step: 0.1, label: t("flight_logs.new.hobbs_in") %> <%= f.field :hobbs_time, as: :number, step: 0.1, label: t("flight_logs.new.or_duration") %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 7176584..c44f146 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2386,6 +2386,7 @@ en: fields: meters_locked_html: The readings can be corrected only on the latest flight, before the hours change again. To correct the hours, use %{link} on the Overview. update_hours: Update Hours + locked: Locked days: gps_track_attached: GPS track attached engine_data_attached: Engine data attached diff --git a/test/integration/flight_edit_test.rb b/test/integration/flight_edit_test.rb index 5f069d3..c82a054 100644 --- a/test/integration/flight_edit_test.rb +++ b/test/integration/flight_edit_test.rb @@ -45,6 +45,7 @@ class FlightEditTest < ActionDispatch::IntegrationTest get edit_aircraft_flight_log_path(@a, first) assert_select "fieldset[disabled]", 2 + assert_select "fieldset[disabled] legend .badge-gray", text: "Locked", count: 2 assert_select ".hint a[href=?]", aircraft_path(@a), text: "Update Hours" patch aircraft_flight_log_path(@a, first), params: { flight_log: { tach_in: 1009, tach_time: 9, destination_location: "kbos" } }