Status report readable in dark mode and Back no longer breaks the theme; drop the Overview's Coming due card

The report layout now always loads as a full page (turbo-visit-control
reload) and without Turbo (an inline Print handler), so the app's dark theme
isn't carried onto the white report and the report's styles aren't left
behind on Back. Coming due repeated the Airworthiness card, so it's gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-11 21:45:54 -05:00
1 parent 31ac991bab
commit 7552e4a8a3
8 files changed
+21 -46

No files matched your search

-1
View File
@@ -14,7 +14,6 @@ class AircraftController < ApplicationController
@notes = @aircraft.notes.recent_first.includes(:user).limit(5)
@oil = ConsumptionStats.new(@aircraft, "oil")
@fuel = ConsumptionStats.new(@aircraft, "fuel")
@coming_due = DueList.new(@aircraft).soon
last = @aircraft.flight_logs.recent_first.first
@last_day = last && @aircraft.flight_logs.where(date: last.date).order(:created_at).to_a
end
-11
View File
@@ -9,10 +9,6 @@ class DueList
end
# Hours flown per day over the past year (nil when it hasn't flown).
# What counts as coming up soon (Overview).
SOON_DAYS = 30
SOON_HOURS = 10
def self.daily_rate(aircraft, today: Date.current)
hours = aircraft.flight_logs.where(date: (today - 365)..today).sum(:tach_time).to_f
hours.positive? ? hours / 365.0 : nil
@@ -30,13 +26,6 @@ class DueList
(inspections + ads + components + documents).compact.sort_by { [ _1.date, _1.title ] }
end
# Due in the next SOON_DAYS days or SOON_HOURS hours (or overdue).
def soon
horizon = @today + SOON_DAYS
hours_limit = @now_hours + SOON_HOURS
items.select { |i| i.date <= horizon || (i.due_hours && i.due_hours <= hours_limit) }
end
private
# The date it's due: the calendar date, or when the hours run out at the
-22
View File
@@ -1,22 +0,0 @@
<%# What's due in the next few weeks or hours (Overview). %>
<section class="card">
<div class="card-header">
<h2 class="card-title">Coming due</h2>
<span class="text-xs text-slate-500">next <%= DueList::SOON_DAYS %> days or <%= DueList::SOON_HOURS %> hrs</span>
</div>
<% if due.any? %>
<ul class="divide-y divide-slate-100">
<% due.each do |item| %>
<li class="flex items-baseline justify-between gap-3 px-4 py-2 text-sm">
<%= link_to item.title, item.path, class: [ "hover:underline", ("font-medium text-red-700" if item.overdue?) ] %>
<span class="shrink-0 text-right text-xs text-slate-500 tabular-nums">
<% if item.overdue? %>overdue<% else %><%= "~" if item.projected %><%= fmt_date(item.date) %><% end %><%= " · at #{hours(item.due_hours)} hrs" if item.due_hours %>
</span>
</li>
<% end %>
</ul>
<% if due.any?(&:projected) %><p class="hint px-4 pb-3">"~" dates are estimated from the last year's flying.</p><% end %>
<% else %>
<%= empty_state "Nothing coming due soon." %>
<% end %>
</section>
-2
View File
@@ -46,8 +46,6 @@
<% end %>
</section>
<%= render "aircraft/coming_due", aircraft: @aircraft, due: @coming_due %>
<section class="card">
<div class="card-header"><h2 class="card-title">Consumption</h2>
<%= link_to "Oil & fuel →", aircraft_consumable_records_path(@aircraft), class: "link text-sm" %></div>
+7 -1
View File
@@ -7,9 +7,15 @@
<meta name="robots" content="noindex, nofollow">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%# Always a full page load: a Turbo visit would keep the app's dark theme
on this white page, and leave this page's styles behind on Back. %>
<meta name="turbo-visit-control" content="reload">
<% unless @standalone %><link rel="icon" href="/favicon.svg" type="image/svg+xml"><% end %>
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
<%# No Turbo here (Back is then an ordinary page load); just the Print button. %>
<script nonce="<%= content_security_policy_nonce %>">
document.addEventListener("click", (e) => { if (e.target.closest?.("[data-print]")) window.print() })
</script>
<style>
html, body { background: #fff; }
@page { margin: 0.5in; }