diff --git a/README.md b/README.md
index 734d7d4..a5e7aa0 100644
--- a/README.md
+++ b/README.md
@@ -120,7 +120,7 @@ The app also makes a verified copy of the main database every night in `storage/
For an off-site copy without extra tools, **Admin → Off-site Backup** connects a Google Drive account: each night the verified database copy and any new uploaded files are copied there, and a restore test checks them. Setup and restoring are in the [administration guide](docs/guide/administration.md#off-site-backup-to-google-drive). Keep `SECRET_KEY_BASE` somewhere safe off the server: stored secrets (API keys, the Drive connection) and electronic signature seals depend on it.
-To back up or move a single aircraft with all its files, use **Access & Sharing → Download .sam.zip** (or `bin/rails "sam:export[N12345]"`). Import it from **Fleet → Import** (or `bin/rails "sam:import[file.sam.zip,owner@example.com]"`). The archive format is the original Simple Aircraft Manager's, so archives move between the two apps.
+To back up or move a single aircraft with all its files, use **More → Download .sam.zip** on the aircraft (or `bin/rails "sam:export[N12345]"`). Import it from **Fleet → More → Import from a .sam.zip archive** (or `bin/rails "sam:import[file.sam.zip,owner@example.com]"`). The archive format is the original Simple Aircraft Manager's, so archives move between the two apps.
## Features
diff --git a/app/assets/tailwind/application.css b/app/assets/tailwind/application.css
index be43df4..232e4c1 100644
--- a/app/assets/tailwind/application.css
+++ b/app/assets/tailwind/application.css
@@ -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; }
diff --git a/app/helpers/aircraft_helper.rb b/app/helpers/aircraft_helper.rb
index fd66ca8..20258f0 100644
--- a/app/helpers/aircraft_helper.rb
+++ b/app/helpers/aircraft_helper.rb
@@ -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)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index fcf3c05..7dfe7f9 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -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)
diff --git a/app/javascript/application.js b/app/javascript/application.js
index 344b302..93cb62d 100644
--- a/app/javascript/application.js
+++ b/app/javascript/application.js
@@ -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()
})
diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js
deleted file mode 100644
index 5975c07..0000000
--- a/app/javascript/controllers/hello_controller.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { Controller } from "@hotwired/stimulus"
-
-export default class extends Controller {
- connect() {
- this.element.textContent = "Hello World!"
- }
-}
diff --git a/app/views/admin/about/show.html.erb b/app/views/admin/about/show.html.erb
index 5d40993..fae612b 100644
--- a/app/views/admin/about/show.html.erb
+++ b/app/views/admin/about/show.html.erb
@@ -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 %>
<% check.problems.each do |p| %>- <%= p %>
<% end %>
diff --git a/app/views/admin/audits/index.html.erb b/app/views/admin/audits/index.html.erb
index 660fc6f..fee993b 100644
--- a/app/views/admin/audits/index.html.erb
+++ b/app/views/admin/audits/index.html.erb
@@ -11,7 +11,7 @@
<% @audits.each do |a| %>
-
- <%= link_to a.performed_at.to_date, admin_audit_path(a), class: "link" %> · <%= a.performed_by&.display_name %>
+ <%= link_to fmt_date(a.performed_at.to_date), admin_audit_path(a), class: "link" %> · <%= a.performed_by&.display_name %>
<%= a.passed ? "Passed" : "Items not passed" %>
<% end %>
diff --git a/app/views/air_trail_connections/show.html.erb b/app/views/air_trail_connections/show.html.erb
index 5d10b29..217e423 100644
--- a/app/views/air_trail_connections/show.html.erb
+++ b/app/views/air_trail_connections/show.html.erb
@@ -62,7 +62,7 @@
<% @failed.each do |s| f = s.flight_log %>
- | <%= link_to f.date, aircraft_flight_log_path(f.aircraft, f), class: "link" %> |
+
| <%= link_to fmt_date(f.date), aircraft_flight_log_path(f.aircraft, f), class: "link" %> |
<%= f.route_summary %> | <%= s.last_error %> |
<% end %>
diff --git a/app/views/aircraft/index.html.erb b/app/views/aircraft/index.html.erb
index 553ac34..2e8fd81 100644
--- a/app/views/aircraft/index.html.erb
+++ b/app/views/aircraft/index.html.erb
@@ -2,7 +2,7 @@
Fleet
- <%= 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" %>
diff --git a/app/views/aircraft/show.html.erb b/app/views/aircraft/show.html.erb
index c94e68f..55470bc 100644
--- a/app/views/aircraft/show.html.erb
+++ b/app/views/aircraft/show.html.erb
@@ -8,7 +8,6 @@
Airworthiness
<%= link_to "Status report", aircraft_report_path(@aircraft), class: "btn-secondary btn-sm", title: "Printable maintenance status (91.417)" %>
- <%= airworthiness_badge(@airworthiness, large: true) %>
diff --git a/app/views/aircraft_roles/index.html.erb b/app/views/aircraft_roles/index.html.erb
index 20f738c..0afe1fd 100644
--- a/app/views/aircraft_roles/index.html.erb
+++ b/app/views/aircraft_roles/index.html.erb
@@ -1,5 +1,6 @@
<% content_for :title, "#{@aircraft.tail_number} Access" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
+
Access & sharing
diff --git a/app/views/airworthiness_directives/index.html.erb b/app/views/airworthiness_directives/index.html.erb
index 97069dc..96e85c5 100644
--- a/app/views/airworthiness_directives/index.html.erb
+++ b/app/views/airworthiness_directives/index.html.erb
@@ -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" %>
<% end %>
diff --git a/app/views/consumable_records/index.html.erb b/app/views/consumable_records/index.html.erb
index 03e7425..3d33e3a 100644
--- a/app/views/consumable_records/index.html.erb
+++ b/app/views/consumable_records/index.html.erb
@@ -1,5 +1,6 @@
<% content_for :title, "#{@aircraft.tail_number} Oil & Fuel" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
+<%= render "shared/oil_subnav", aircraft: @aircraft %>
<% [@oil, @fuel].each do |stats| %>
diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb
index 4acdea1..2173fd6 100644
--- a/app/views/documents/index.html.erb
+++ b/app/views/documents/index.html.erb
@@ -2,8 +2,10 @@
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% 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 %>
diff --git a/app/views/flight_logs/_stats.html.erb b/app/views/flight_logs/_stats.html.erb
index 932391b..318261b 100644
--- a/app/views/flight_logs/_stats.html.erb
+++ b/app/views/flight_logs/_stats.html.erb
@@ -1,8 +1,8 @@
<%# Flying metrics. "Flight time" = Hobbs where recorded, else tach. %>
<% periods = stats.periods %>
-
+
<% [ [ "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| %>
-
+
<%= title %>
<%= hours(p.flight) %> hrs
<%= pluralize(p.flights, "flight") %> · <%= hours(p.tach) %> tach · <%= number_with_delimiter(p.fuel) %> gal
@@ -40,8 +40,9 @@
-
-
+<% if stats.by_year.size > 1 %>
+
+
| Year | Flights | Flight hrs | Tach hrs | Fuel (gal) | Avg flight |
@@ -59,3 +60,4 @@
Flight time is Hobbs time where recorded, otherwise tach time.
+<% end %>
diff --git a/app/views/flight_logs/index.html.erb b/app/views/flight_logs/index.html.erb
index bcbc9c2..c193b5b 100644
--- a/app/views/flight_logs/index.html.erb
+++ b/app/views/flight_logs/index.html.erb
@@ -2,7 +2,14 @@
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% if @stats.any? %><%= render "flight_logs/stats", stats: @stats %><% end %>
-
+
<% if @days.any? %>
DateRouteTachHobbsFuel (gal)Oil (qt)
diff --git a/app/views/inspections/index.html.erb b/app/views/inspections/index.html.erb
index e0364dd..0277917 100644
--- a/app/views/inspections/index.html.erb
+++ b/app/views/inspections/index.html.erb
@@ -2,7 +2,7 @@
<%= render "shared/aircraft_header", aircraft: @aircraft %>
+ <% if owner? %><%= 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" %>
<% end %>
<% if @rows.any? %>
diff --git a/app/views/logbook_entries/index.html.erb b/app/views/logbook_entries/index.html.erb
index cf0f9ba..3d5e21d 100644
--- a/app/views/logbook_entries/index.html.erb
+++ b/app/views/logbook_entries/index.html.erb
@@ -6,14 +6,17 @@
<%= 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 %>
-
+
<% end %>
- <%= f.submit "Filter", class: "btn-secondary" %>
+ <%= f.submit "Filter", class: "sr-only" %>
+ <% end %>
+ <% if @entries.any? %><% 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? %><% 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 %>
<% if @entries.any? %>
@@ -24,7 +27,7 @@
<% @entries.each do |e| %>
- | <%= link_to e.date, aircraft_logbook_entry_path(@aircraft, e), class: "link" %> |
+ <%= link_to fmt_date(e.date), aircraft_logbook_entry_path(@aircraft, e), class: "link" %> |
<%= LogbookEntry::LOG_TYPES[e.log_type] %> |
<%= LogbookEntry::ENTRY_TYPES[e.entry_type] %> |
<%= hours(e.aircraft_hours_at_entry) %> |
diff --git a/app/views/logbook_entries/show.html.erb b/app/views/logbook_entries/show.html.erb
index 075d93e..65c17d7 100644
--- a/app/views/logbook_entries/show.html.erb
+++ b/app/views/logbook_entries/show.html.erb
@@ -3,14 +3,17 @@