Secondary actions behind More menus; tidier aircraft header and tabs

- more_menu helper (menu / menu-item styles): each section keeps its main
  action as a button; imports, exports, printing and tools move under More
  (flights, logbook, logbook entry, documents, inspections, fleet)
- Aircraft header: More with status report and, for owners, access &
  sharing, edit, .sam.zip and records package; Access & Sharing and Oil
  Analysis tabs removed (oil analysis is under Oil & Fuel with a switch)
- Logbook: Print selected appears once an entry is ticked; filters apply on
  change; dates use fmt_date (also AirTrail, notes, audits, About)
- Header shows the role on the aircraft and hides the usual Available badge;
  no second Grounded badge on the Overview; AD DRS import listed once
- Flights: stat cards 2x2 on phones; By year opens visibly, only with more
  than one year; duplicate + Log Flight removed
- Remove unused hello_controller.js; guide and README updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-13 21:21:57 -05:00
1 parent bff6a05173
commit 3f45b557c2
38 files changed
+159 -63

No files matched your search

+3
View File
@@ -15,6 +15,9 @@
@utility btn-danger { @apply btn bg-surface text-red-700 ring-1 ring-red-300 ring-inset hover:bg-red-50; }
@utility btn-sm { @apply px-2 py-1 text-xs; }
@utility link { @apply text-sky-700 hover:underline; }
/* The "More" menu (ApplicationHelper#more_menu): secondary actions, one per row. */
@utility menu { @apply absolute right-0 z-30 mt-2 w-60 rounded-md bg-surface py-1 shadow-lg ring-1 ring-slate-200; }
@utility menu-item { @apply block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-100 cursor-pointer; }
@utility card { @apply rounded-lg bg-surface shadow-sm ring-1 ring-slate-200; }
@utility card-header { @apply flex flex-wrap items-center justify-between gap-3 border-b border-slate-200 px-4 py-3; }
+3 -5
View File
@@ -6,8 +6,7 @@ module AircraftHelper
[ "Components", aircraft_components_path(aircraft), %w[components] ],
[ "Squawks", aircraft_squawks_path(aircraft), %w[squawks] ],
[ "Flights", aircraft_flight_logs_path(aircraft), %w[flight_logs flight_imports air_trail_exports airport_codes] ],
[ "Oil & Fuel", aircraft_consumable_records_path(aircraft), %w[consumable_records] ],
[ "Oil Analysis", aircraft_oil_analyses_path(aircraft), %w[oil_analyses] ],
[ "Oil & Fuel", aircraft_consumable_records_path(aircraft), %w[consumable_records oil_analyses] ],
[ "Logbook", aircraft_logbook_entries_path(aircraft), %w[logbook_entries] ],
[ "Inspections", aircraft_inspections_path(aircraft), %w[inspections inspection_types inspection_records] ],
[ "ADs", aircraft_airworthiness_directives_path(aircraft), %w[airworthiness_directives ad_compliances ad_imports] ],
@@ -15,9 +14,8 @@ module AircraftHelper
[ "Major Records", aircraft_major_records_path(aircraft), %w[major_records] ],
[ "W&B", aircraft_weight_balance_records_path(aircraft), %w[weight_balance_records loading_setups] ],
[ "Notes", aircraft_notes_path(aircraft), %w[notes] ],
[ "Activity", aircraft_events_path(aircraft), %w[events record_versions] ],
([ "Access & Sharing", aircraft_aircraft_roles_path(aircraft), %w[aircraft_roles share_tokens] ] if owner?)
].compact
[ "Activity", aircraft_events_path(aircraft), %w[events record_versions] ]
]
end
def component_options(aircraft, include_blank: true)
+11
View File
@@ -14,6 +14,17 @@ module ApplicationHelper
value ? value.in_time_zone.strftime("%b %-d, %Y %H:%M") : "—"
end
# Secondary actions (imports, exports, printing, tools) behind one "More"
# button, so each section shows only its main action. The block gives the
# items: links or button_to forms with class "menu-item".
def more_menu(label = "More", small: false, &block)
tag.details(class: "relative", data: { controller: "dropdown", action: "click@window->dropdown#closeOutside keydown.esc@window->dropdown#close" }) do
tag.summary(class: [ "btn-secondary list-none [&::-webkit-details-marker]:hidden", ("btn-sm" if small) ], title: "More actions") do
safe_join([ label, tag.span("▾", class: "text-xs", "aria-hidden": true) ], " ")
end + tag.div(capture(&block), class: "menu")
end
end
AIRWORTHINESS_COLORS = { "RED" => "red", "LIMITED" => "blue", "ORANGE" => "orange", "GREEN" => "green", "INFO" => "gray" }.freeze
def airworthiness_badge(status, large: false)
+10
View File
@@ -51,8 +51,18 @@ document.addEventListener("click", (event) => {
if (target.matches("[data-check-all]")) {
target.closest("table")?.querySelectorAll("tbody input[type=checkbox]").forEach((box) => { box.checked = target.checked })
}
if (target.type === "checkbox") showSelectionActions()
})
// Actions on ticked rows (e.g. "Print selected") appear once a row is ticked:
// data-needs-selection names the form the row checkboxes belong to.
function showSelectionActions() {
document.querySelectorAll("[data-needs-selection]").forEach((el) => {
el.hidden = !document.querySelector(`input[form="${el.dataset.needsSelection}"]:checked`)
})
}
document.addEventListener("turbo:load", showSelectionActions)
document.addEventListener("change", (event) => {
if (event.target.matches?.("[data-submit-on-change]")) event.target.form?.requestSubmit()
})
@@ -1,7 +0,0 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
this.element.textContent = "Hello World!"
}
}
+2 -2
View File
@@ -96,8 +96,8 @@
[ "Backups kept", "#{Setting.integer('backups_kept')} (in storage/backups)" ],
[ "Off-site backup", OffsiteConnection.connected? ? ((o = OffsiteRun.latest_backup) ? tag.span("#{o.ok ? 'OK' : 'FAILED'} #{fmt_date(o.created_at.to_date)}", class: (o.ok && o.recent? ? nil : "badge-orange")) + " · Google Drive (#{OffsiteConnection.current.account_email})" : "Google Drive connected, none yet") : link_to("not set up", admin_offsite_backup_path, class: "badge-orange") ],
[ "Procedures", (r = ProceduresRevision.current) ? "Revision #{r.number}, adopted #{fmt_date(r.adopted_at.to_date)}" : tag.span("not adopted", class: "badge-orange") ],
[ "Last audit", AuditRun.latest ? "#{AuditRun.latest.performed_at.to_date} · #{AuditRun.latest.passed ? 'passed' : 'items not passed'}" : "none yet" ],
[ "Next audit due", AuditRun.due_soon? ? tag.span(AuditRun.next_due.to_s, class: "badge-orange") : AuditRun.next_due.to_s ]
[ "Last audit", AuditRun.latest ? "#{fmt_date(AuditRun.latest.performed_at.to_date)} · #{AuditRun.latest.passed ? 'passed' : 'items not passed'}" : "none yet" ],
[ "Next audit due", AuditRun.due_soon? ? tag.span(fmt_date(AuditRun.next_due), class: "badge-orange") : fmt_date(AuditRun.next_due) ]
] %>
<% if check && !check.ok %>
<ul class="list-disc space-y-1 px-8 pb-3 text-sm text-red-700"><% check.problems.each do |p| %><li><%= p %></li><% end %></ul>
+1 -1
View File
@@ -11,7 +11,7 @@
<ul class="divide-y divide-slate-100 text-sm">
<% @audits.each do |a| %>
<li class="flex items-center justify-between px-4 py-2">
<span><%= link_to a.performed_at.to_date, admin_audit_path(a), class: "link" %> · <%= a.performed_by&.display_name %></span>
<span><%= link_to fmt_date(a.performed_at.to_date), admin_audit_path(a), class: "link" %> · <%= a.performed_by&.display_name %></span>
<span class="<%= a.passed ? 'badge-green' : 'badge-orange' %>"><%= a.passed ? "Passed" : "Items not passed" %></span>
</li>
<% end %>
@@ -62,7 +62,7 @@
<div class="card-header"><h2 class="card-title">Flights that didn't sync</h2></div>
<table class="table"><tbody>
<% @failed.each do |s| f = s.flight_log %>
<tr><td class="whitespace-nowrap"><%= link_to f.date, aircraft_flight_log_path(f.aircraft, f), class: "link" %></td>
<tr><td class="whitespace-nowrap"><%= link_to fmt_date(f.date), aircraft_flight_log_path(f.aircraft, f), class: "link" %></td>
<td><%= f.route_summary %></td><td class="text-xs text-red-700"><%= s.last_error %></td></tr>
<% end %>
</tbody></table>
+1 -1
View File
@@ -2,7 +2,7 @@
<div class="mb-5 flex items-center justify-between">
<h1 class="text-2xl font-bold tracking-tight">Fleet</h1>
<div class="flex gap-2">
<%= link_to "Import", new_aircraft_import_path, class: "btn-secondary", title: "Import an aircraft from a .sam.zip archive" %>
<%= more_menu do %><%= link_to "Import from a .sam.zip archive", new_aircraft_import_path, class: "menu-item" %><% end %>
<%= link_to "+ Add Aircraft", new_aircraft_path, class: "btn-primary" %>
</div>
</div>
-1
View File
@@ -8,7 +8,6 @@
<h2 class="card-title">Airworthiness</h2>
<div class="flex items-center gap-2">
<%= link_to "Status report", aircraft_report_path(@aircraft), class: "btn-secondary btn-sm", title: "Printable maintenance status (91.417)" %>
<%= airworthiness_badge(@airworthiness, large: true) %>
</div>
</div>
<div class="card-body">
+1
View File
@@ -1,5 +1,6 @@
<% content_for :title, "#{@aircraft.tail_number} Access" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<h2 class="mb-4 text-lg font-semibold">Access &amp; sharing</h2>
<div class="grid gap-5 lg:grid-cols-2">
<section class="card">
<div class="card-header"><h2 class="card-title">People</h2></div>
@@ -11,7 +11,6 @@
<%= f.submit "Link existing", class: "btn-secondary" %>
<% end %>
<% end %>
<%= link_to "Import from FAA DRS", new_aircraft_ad_import_path(@aircraft), class: "btn-secondary" %>
<%= link_to "+ New AD", new_aircraft_airworthiness_directive_path(@aircraft), class: "btn-primary" %>
</div>
<% end %>
@@ -1,5 +1,6 @@
<% content_for :title, "#{@aircraft.tail_number} Oil & Fuel" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= render "shared/oil_subnav", aircraft: @aircraft %>
<div class="grid gap-5 lg:grid-cols-2">
<% [@oil, @fuel].each do |stats| %>
<section class="card">
+4 -2
View File
@@ -2,8 +2,10 @@
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<div class="mb-4 flex flex-wrap justify-end gap-2">
<% if owner? %>
<%= link_to "+ Collection", new_aircraft_document_collection_path(@aircraft), class: "btn-secondary" %>
<%= link_to "Bulk Upload", new_bulk_aircraft_documents_path(@aircraft), class: "btn-secondary" %>
<%= more_menu do %>
<%= link_to "Upload several files", new_bulk_aircraft_documents_path(@aircraft), class: "menu-item" %>
<%= link_to "New collection", new_aircraft_document_collection_path(@aircraft), class: "menu-item" %>
<% end %>
<%= link_to "+ Upload Document", new_aircraft_document_path(@aircraft), class: "btn-primary" %>
<% end %>
</div>
+6 -4
View File
@@ -1,8 +1,8 @@
<%# Flying metrics. "Flight time" = Hobbs where recorded, else tach. %>
<% periods = stats.periods %>
<div class="mb-5 grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
<div class="mb-5 grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4">
<% [ [ "Past 30 days", periods[0] ], [ "This year", periods[2] ], [ "Past 12 months", periods[1] ], [ "Since #{fmt_date(stats.first_date)}", periods[4] ] ].each do |title, p| %>
<section class="card card-body">
<section class="card p-3 sm:p-4">
<div class="text-xs font-medium uppercase tracking-wide text-slate-500"><%= title %></div>
<div class="mt-1 text-2xl font-semibold tabular-nums"><%= hours(p.flight) %> <span class="text-sm font-normal text-slate-500">hrs</span></div>
<div class="mt-1 text-xs text-slate-600"><%= pluralize(p.flights, "flight") %> · <%= hours(p.tach) %> tach · <%= number_with_delimiter(p.fuel) %> gal</div>
@@ -40,8 +40,9 @@
</section>
</div>
<details class="card mb-5">
<summary class="card-header cursor-pointer"><span class="card-title">By year</span></summary>
<% if stats.by_year.size > 1 %>
<details class="card group mb-5">
<summary class="card-header cursor-pointer list-none [&::-webkit-details-marker]:hidden"><span class="card-title">By year</span><span aria-hidden="true" class="text-slate-500 transition group-open:rotate-180">▾</span></summary>
<table class="table">
<thead><tr><th>Year</th><th class="text-right">Flights</th><th class="text-right">Flight hrs</th><th class="text-right">Tach hrs</th><th class="text-right">Fuel (gal)</th><th class="text-right">Avg flight</th></tr></thead>
<tbody>
@@ -59,3 +60,4 @@
</table>
<p class="px-4 pb-3 hint">Flight time is Hobbs time where recorded, otherwise tach time.</p>
</details>
<% end %>
+8 -1
View File
@@ -2,7 +2,14 @@
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% if @stats.any? %><%= render "flight_logs/stats", stats: @stats %><% end %>
<section class="card">
<div class="card-header"><h2 class="card-title">Flight Log</h2><div class="flex gap-2"><%= link_to "Export for AirTrail", new_aircraft_air_trail_export_path(@aircraft), class: "btn-secondary" %><% if owner? %><%= link_to "Standardize airport codes", aircraft_airport_codes_path(@aircraft), class: "btn-secondary" %><%= link_to "Import from spreadsheet", new_aircraft_flight_import_path(@aircraft), class: "btn-secondary" %><% end %><%= link_to "+ Log Flight", new_aircraft_flight_log_path(@aircraft), class: "btn-primary" %></div></div>
<div class="card-header">
<h2 class="card-title">Flight Log</h2>
<%= more_menu do %>
<% if owner? %><%= link_to "Import from spreadsheet", new_aircraft_flight_import_path(@aircraft), class: "menu-item" %><% end %>
<%= link_to "Export for AirTrail", new_aircraft_air_trail_export_path(@aircraft), class: "menu-item" %>
<% if owner? %><%= link_to "Standardize airport codes", aircraft_airport_codes_path(@aircraft), class: "menu-item" %><% end %>
<% end %>
</div>
<% if @days.any? %>
<div class="hidden grid-cols-[9.5rem_1fr_repeat(4,5rem)_1.25rem] gap-3 border-b border-slate-200 bg-slate-50 px-4 py-2 text-xs font-semibold uppercase tracking-wide text-slate-500 sm:grid">
<span>Date</span><span>Route</span><span class="text-right">Tach</span><span class="text-right">Hobbs</span><span class="text-right">Fuel (gal)</span><span class="text-right">Oil (qt)</span><span></span>
+1 -1
View File
@@ -2,7 +2,7 @@
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<section class="card">
<div class="card-header"><h2 class="card-title">Inspection Status</h2>
<% if owner? %><div class="flex flex-wrap gap-2"><%= link_to "Standard inspections", new_aircraft_standard_inspections_path(@aircraft), class: "btn-secondary" %><%= link_to "+ Inspection Type", new_aircraft_inspection_type_path(@aircraft), class: "btn-primary" %></div><% end %></div>
<% if owner? %><div class="flex flex-wrap gap-2"><%= more_menu do %><%= link_to "Add standard inspections", new_aircraft_standard_inspections_path(@aircraft), class: "menu-item" %><% end %><%= link_to "+ Inspection Type", new_aircraft_inspection_type_path(@aircraft), class: "btn-primary" %></div><% end %></div>
<% if @rows.any? %>
<div class="overflow-x-auto">
<table class="table">
+9 -6
View File
@@ -6,14 +6,17 @@
<div class="flex flex-wrap items-center gap-2">
<%= form_with url: aircraft_logbook_entries_path(@aircraft), method: :get, class: "flex w-full flex-wrap gap-2 sm:w-auto" do |f| %>
<%= f.search_field :q, value: @query, placeholder: "Search entries…", class: "input min-w-0 flex-1 sm:w-48 sm:flex-none" %>
<%= f.select :log_type, LogbookEntry::LOG_TYPES.invert, { include_blank: "All logs", selected: @log_type }, class: "input w-32" %>
<%= f.select :log_type, LogbookEntry::LOG_TYPES.invert, { include_blank: "All logs", selected: @log_type }, class: "input w-32", data: { submit_on_change: true } %>
<% if @unverified_count.positive? || @unverified_only %>
<label class="flex items-center gap-1 text-sm text-slate-700"><%= f.check_box :unverified, { checked: @unverified_only }, "1", nil %> Unverified (<%= @unverified_count %>)</label>
<label class="flex items-center gap-1 text-sm text-slate-700"><%= f.check_box :unverified, { checked: @unverified_only, data: { submit_on_change: true } }, "1", nil %> Unverified (<%= @unverified_count %>)</label>
<% end %>
<%= f.submit "Filter", class: "btn-secondary" %>
<%= f.submit "Filter", class: "sr-only" %>
<% end %>
<% if @entries.any? %><button type="submit" form="print-entries" class="btn-secondary" hidden data-needs-selection="print-entries" title="Print the ticked entries on labels or pages for the paper logbook">Print selected</button><% end %>
<% if owner? %>
<%= more_menu do %><%= link_to "Import scans", new_aircraft_logbook_import_path(@aircraft), class: "menu-item" %><% end %>
<%= link_to "+ New Entry", new_aircraft_logbook_entry_path(@aircraft), class: "btn-primary" %>
<% end %>
<% if @entries.any? %><button type="submit" form="print-entries" class="btn-secondary" title="Print the ticked entries on labels or pages for the paper logbook">Print selected</button><% end %>
<% if owner? %><%= link_to "Import scans", new_aircraft_logbook_import_path(@aircraft), class: "btn-secondary" %><%= link_to "+ New Entry", new_aircraft_logbook_entry_path(@aircraft), class: "btn-primary" %><% end %>
</div>
</div>
<% if @entries.any? %>
@@ -24,7 +27,7 @@
<tbody>
<% @entries.each do |e| %>
<tr>
<td class="whitespace-nowrap"><input type="checkbox" name="ids[]" value="<%= e.id %>" form="print-entries" class="mr-1 align-middle" aria-label="Select the <%= fmt_date(e.date) %> entry"><%= link_to e.date, aircraft_logbook_entry_path(@aircraft, e), class: "link" %></td>
<td class="whitespace-nowrap"><input type="checkbox" name="ids[]" value="<%= e.id %>" form="print-entries" class="mr-1 align-middle" aria-label="Select the <%= fmt_date(e.date) %> entry"><%= link_to fmt_date(e.date), aircraft_logbook_entry_path(@aircraft, e), class: "link" %></td>
<td><span class="badge-gray"><%= LogbookEntry::LOG_TYPES[e.log_type] %></span></td>
<td class="text-xs"><%= LogbookEntry::ENTRY_TYPES[e.entry_type] %></td>
<td class="text-right tabular-nums"><%= hours(e.aircraft_hours_at_entry) %></td>
+8 -5
View File
@@ -3,14 +3,17 @@
<div class="card-header">
<h2 class="card-title"><%= LogbookEntry::LOG_TYPES[@entry.log_type] %> log — <%= fmt_date(@entry.date) %></h2>
<div class="flex gap-2">
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
<% if @entry.signed? %>
<% if owner? && !@entry.superseded? && !@entry.superseded_by %><%= link_to "Correct this entry", new_aircraft_logbook_entry_path(@aircraft, supersedes: @entry.id), class: "btn-secondary btn-sm" %><% end %>
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
<% if owner? && !@entry.superseded? && !@entry.superseded_by %>
<%= more_menu(small: true) do %><%= link_to "Correct this entry", new_aircraft_logbook_entry_path(@aircraft, supersedes: @entry.id), class: "menu-item" %><% end %>
<% end %>
<% else %>
<%= link_to "Sign", new_aircraft_logbook_entry_signature_path(@aircraft, @entry), class: "btn-primary btn-sm" %>
<% if owner? %>
<%= link_to "Ask someone to sign", new_aircraft_logbook_entry_signing_invitation_path(@aircraft, @entry), class: "btn-secondary btn-sm" %>
<%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %>
<% if owner? %><%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
<%= more_menu(small: true) do %>
<% if owner? %><%= link_to "Ask someone to sign", new_aircraft_logbook_entry_signing_invitation_path(@aircraft, @entry), class: "menu-item" %><% end %>
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "menu-item" %>
<% end %>
<% end %>
</div>
+1 -1
View File
@@ -9,7 +9,7 @@
<div class="min-w-0 flex-1">
<div class="text-sm"><%= markdown note.text %></div>
<div class="mt-1 text-xs text-slate-500">
<%= note.user&.display_name || "Unknown" %> · <%= l note.created_at, format: :short %>
<%= note.user&.display_name || "Unknown" %> · <%= fmt_time(note.created_at) %>
<%= "· edited" if note.edited_at %>
<% if note.public? %><span class="badge-green ml-1">Visible on share links</span><% end %>
</div>
+1
View File
@@ -1,5 +1,6 @@
<% content_for :title, "#{@aircraft.tail_number} Oil Analysis" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= render "shared/oil_subnav", aircraft: @aircraft %>
<% recent = @analyses.first(OilAnalysesController::COMPARE_SAMPLES) %>
<div class="space-y-5">
<section class="card">
+13 -4
View File
@@ -12,15 +12,24 @@
</h1>
<div class="mt-1 flex flex-wrap items-center gap-2 text-sm">
<%= airworthiness_badge(aw) %>
<%= aircraft_status_badge(aircraft) %>
<%= aircraft_status_badge(aircraft) unless aircraft.status == "AVAILABLE" %>
<span class="text-slate-500">Tach <%= hours(aircraft.tach_time) %> · Hobbs <%= hours(aircraft.hobbs_time) %></span>
<span class="badge-gray"><%= current_role.capitalize %></span>
<span class="badge-gray" title="Your access to this aircraft"><%= (current_user.aircraft_roles.find_by(aircraft: aircraft)&.role || current_role).capitalize %></span>
</div>
</div>
</div>
<div class="flex w-full gap-2 sm:w-auto [&>*]:flex-1 [&>*]:justify-center [&>*]:whitespace-nowrap max-sm:[&>*]:px-2 sm:[&>*]:flex-none">
<div class="flex w-full gap-2 sm:w-auto [&>a]:flex-1 [&>a]:justify-center [&>a]:whitespace-nowrap max-sm:[&>a]:px-2 sm:[&>a]:flex-none">
<%= link_to "Log Flight", new_aircraft_flight_log_path(aircraft), class: "btn-primary" %>
<%= link_to "Report Squawk", new_aircraft_squawk_path(aircraft), class: "btn-secondary" %>
<%= more_menu do %>
<%= link_to "Status report", aircraft_report_path(aircraft), class: "menu-item" %>
<% if owner? %>
<%= link_to "Access & sharing", aircraft_aircraft_roles_path(aircraft), class: "menu-item" %>
<%= link_to "Edit aircraft", edit_aircraft_path(aircraft), class: "menu-item" %>
<%= link_to "Download .sam.zip", aircraft_export_path(aircraft), class: "menu-item", data: { turbo: false } %>
<%= link_to "Download records package", aircraft_records_package_path(aircraft), class: "menu-item", data: { turbo: false } %>
<% end %>
<% end %>
</div>
</div>
<% tabs = aircraft_tabs(aircraft) %>
@@ -28,7 +37,7 @@
<%# Phones: the current section, with every section a tap away. %>
<details class="relative mb-5 md:hidden" data-controller="dropdown" data-action="click@window->dropdown#closeOutside keydown.esc@window->dropdown#close">
<summary class="flex cursor-pointer list-none items-center justify-between rounded-md bg-surface px-4 py-3 font-medium shadow-sm ring-1 ring-slate-200 [&::-webkit-details-marker]:hidden">
<span><span class="text-xs font-normal text-slate-500">Section</span><br><%= current_tab&.first || "Overview" %></span>
<span><span class="text-xs font-normal text-slate-500">Section</span><br><%= current_tab&.first || "Choose a section" %></span>
<span aria-hidden="true" class="text-slate-500">▾</span>
</summary>
<nav class="absolute inset-x-0 z-30 mt-2 grid grid-cols-2 gap-1 rounded-md bg-surface p-2 shadow-lg ring-1 ring-slate-200" aria-label="Aircraft sections">
+7
View File
@@ -0,0 +1,7 @@
<%# Oil & Fuel tab: consumption and oil analysis are two pages under one tab. %>
<nav class="mb-4 inline-flex rounded-md bg-surface p-1 text-sm shadow-sm ring-1 ring-slate-200" aria-label="Oil and fuel">
<% [ [ "Consumption", aircraft_consumable_records_path(aircraft), "consumable_records" ], [ "Oil analysis", aircraft_oil_analyses_path(aircraft), "oil_analyses" ] ].each do |label, path, name| %>
<%= link_to label, path, class: [ "rounded px-3 py-1.5", (controller_name == name ? "bg-slate-100 font-semibold text-sky-700" : "text-slate-600 hover:text-slate-900") ],
aria: { current: (controller_name == name ? "page" : nil) } %>
<% end %>
</nav>