Files
simple-aircraft-manager-rails/app/views/shared/_aircraft_header.html.erb
T
rickyandClaude Opus 5.5 3f45b557c2 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>
2026-11-13 21:21:57 -05:00

55 lines
3.5 KiB
ERB

<%# Header + tab bar shown on every aircraft page. %>
<% aw = aircraft.airworthiness %>
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
<div class="flex items-center gap-3">
<% if aircraft.picture.attached? %>
<%= image_tag aircraft.picture, class: "h-12 w-12 rounded-md object-cover", alt: "" %>
<% end %>
<div>
<h1 class="text-2xl font-bold tracking-tight">
<%= link_to aircraft.tail_number, aircraft_path(aircraft) %>
<span class="ml-1 text-base font-normal text-slate-500"><%= [aircraft.make, aircraft.model].compact_blank.join(" ") %></span>
</h1>
<div class="mt-1 flex flex-wrap items-center gap-2 text-sm">
<%= airworthiness_badge(aw) %>
<%= 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" 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 [&>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) %>
<% current_tab = tabs.find { |_, _, names| names.include?(controller_name) } %>
<%# 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 || "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">
<% tabs.each do |label, path, names| %>
<%= link_to label, path, class: [ "rounded px-3 py-2.5 text-sm hover:bg-slate-100", (names.include?(controller_name) ? "bg-slate-100 font-semibold text-sky-700" : "text-slate-700") ],
aria: { current: (names.include?(controller_name) ? "page" : nil) } %>
<% end %>
</nav>
</details>
<nav class="mb-5 hidden flex-wrap border-b border-slate-200 md:flex" aria-label="Aircraft sections">
<% tabs.each do |label, path, names| %>
<%= nav_tab label, path, names.include?(controller_name) %>
<% end %>
</nav>