Files
simple-aircraft-manager-rails/app/views/flight_logs/new.html.erb
T
rickyandClaude Opus 5.5 8d5f57da81 Installed app: offline squawks and pre-flight pages, push notifications, shortcuts
Offline
- Flights and squawks saved offline are tagged with their user and only sent
  while that user is signed in; storage is made persistent; Background Sync
  sends them with the app closed (Chromium); unsent count on the app badge
- Report Squawk works offline (photos included, one-time key like flights)
- The Fleet page and, for each of your aircraft, the Overview, W&B, Log
  Flight and Report Squawk pages and photo are saved ahead of time, so the
  app opens and works without signal; copies say when they were saved
- Sign-out clears saved forms, pages and photos (asks first if items wait)
- Offline page rendered by Rails (localized, follows the theme, no inline
  script); service worker version follows the build

Install and notify
- Web Push (web-push gem, VAPID keys from env or storage/vapid_keys.json):
  grounding squawks, newly overdue items (daily, once each), signing
  requests; per-device on/off and test in Profile -> This device; only
  browser push service endpoints accepted
- Manifest shortcuts (Log Flight, Report Squawk via /go/...), lang and
  localized description; install help on Profile; reload notice after a
  release

Also
- Dockerfile: libssl-dev in the build stage (openssl gem); lockfile checksums
- Leftover English and %{_} interpolation names from the localization pass
- Guide and README updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:39:42 -05:00

44 lines
3.2 KiB
ERB

<% content_for :title, t(".log_flight") %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= form_with model: [@aircraft, @flight_log], class: "card card-body space-y-5 max-w-3xl",
data: { controller: "offline-form", offline_form_kind_value: "flight", offline_form_tail_value: @aircraft.tail_number,
action: "submit->offline-form#submit turbo:submit-start->offline-form#remember turbo:fetch-request-error->offline-form#networkFailed turbo:before-fetch-response->offline-form#gatewayFailed" } do |f| %>
<%= f.hidden_field :client_key, data: { offline_form_target: "key" } %>
<div class="hidden rounded-md bg-sky-50 px-3 py-2 text-sm text-sky-900 ring-1 ring-sky-200" data-offline-form-target="notice" role="status"></div>
<%= f.errors_summary %>
<div class="grid gap-4 sm:grid-cols-3">
<%= f.field :date, as: :date, required: true %>
<%= render "shared/airport_field", f: f, attribute: :departure_location, label: t(".from"), aircraft: @aircraft, placeholder: t(".koqu") %>
<%= render "shared/airport_field", f: f, attribute: :destination_location, label: t(".to"), aircraft: @aircraft, placeholder: t(".code_or_name") %>
</div>
<fieldset class="grid gap-4 sm:grid-cols-3">
<legend class="mb-2 text-sm font-semibold"><%= t(".tach_required") %></legend>
<%= f.field :tach_out, as: :number, step: 0.1, label: t(".tach_out") %>
<%= f.field :tach_in, as: :number, step: 0.1, label: t(".tach_in") %>
<%= f.field :tach_time, as: :number, step: 0.1, label: t(".or_duration"), hint: t(".calculated_from_out_in_if") %>
</fieldset>
<fieldset class="grid gap-4 sm:grid-cols-3">
<legend class="mb-2 text-sm font-semibold"><%= t(".hobbs_optional") %></legend>
<%= f.field :hobbs_out, as: :number, step: 0.1, label: t(".hobbs_out") %>
<%= f.field :hobbs_in, as: :number, step: 0.1, label: t(".hobbs_in") %>
<%= f.field :hobbs_time, as: :number, step: 0.1, label: t(".or_duration") %>
</fieldset>
<fieldset class="grid gap-4 sm:grid-cols-3">
<legend class="mb-2 text-sm font-semibold"><%= t(".oil_fuel_added") %></legend>
<%= f.field :oil_added, as: :number, step: 0.25, label: t(".oil_added_qt") %>
<%= f.field :oil_level_after, as: :number, step: 0.25, label: t(".oil_level_after_qt") %>
<%= f.field :oil_added_type, label: t(".oil_type"), placeholder: t(".aeroshell_w100") %>
<%= f.field :fuel_added, as: :number, step: 0.1, label: t(".fuel_added_gal") %>
<%= f.field :fuel_level_after, as: :number, step: 0.1, label: t(".fuel_level_after_gal") %>
<%= f.field :fuel_added_type, label: t(".fuel_type"), placeholder: t(".n100ll") %>
</fieldset>
<%= f.field :route, as: :textarea, rows: 2 %>
<%= f.field :notes, as: :textarea, rows: 2 %>
<div class="grid gap-4 sm:grid-cols-2">
<%= f.field :track_log, as: :file, label: t(".track_log_gpx_kml_csv") %>
<%= f.field :engine_data, as: :file, label: t(".engine_monitor_data"), hint: t(".cgr_30p_cgr_30c_flight"), accept: ".csv,text/csv" %>
</div>
<p class="hint"><%= t(".saving_adds_the_tach_time") %></p>
<div class="flex gap-2"><%= f.submit t(".log_flight") %><%= link_to t(".cancel"), aircraft_flight_logs_path(@aircraft), class: "btn-secondary" %></div>
<% end %>