Files
simple-aircraft-manager-rails/app/views/consumable_records/index.html.erb
T
rickyandClaude Opus 5.5 89ed0a76f9 Move all user-facing text into config/locales/en.yml for localization
- Views use lazy t(".key") lookups; sentences with values or links stay
  whole (interpolation, _html keys); counts use one/other plurals
- Stored-value labels (statuses, types, priorities...) are LabelSets read
  from labels: in the current locale; field names and validation messages
  under activerecord:; flash and activity text under flash:
- Services, models, helpers, mailer subjects, the logbook PDF, procedures
  templates, records package README and transcription warnings localized;
  the PDF reuses LogbookEntry#certification_statement instead of a copy
- Scripts read js: strings from a JSON tag via app/javascript/i18n.js
- Dates through I18n.l (app, weekday, month_year, long formats); html lang
  follows the locale
- APP_LOCALE picks the language (falls back to English); missing
  translations raise in development and tests
- README: Translating section and APP_LOCALE

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

36 lines
2.1 KiB
ERB

<% content_for :title, t(".oil_fuel", tail_number: @aircraft.tail_number) %>
<%= 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">
<div class="card-header">
<h2 class="card-title"><%= stats.oil? ? t(".oil_consumption") : t(".fuel_burn") %></h2>
<%= link_to t(stats.oil? ? ".add_oil" : ".add_fuel"), new_aircraft_consumable_record_path(@aircraft, type: stats.record_type), class: "btn-secondary btn-sm" %>
</div>
<div class="card-body">
<div class="mb-3 flex flex-wrap gap-x-6 gap-y-1 text-sm">
<div><span class="text-2xl font-semibold"><%= stats.recent || "—" %></span> <span class="text-slate-500"><%= t(".last_hrs_html", metric_label: stats.metric_label, recent_window_hours: stats.recent_window_hours) %></span></div>
<div><span class="text-lg"><%= stats.lifetime || "—" %></span> <span class="text-slate-500"><%= t(".lifetime") %></span></div>
</div>
<% if stats.points.size >= 2 %>
<%= line_chart stats.chart_data, xtitle: "Tach hours", ytitle: stats.metric_label, height: "220px", curve: false, points: false,
library: { scales: { x: { type: "linear" } } }, colors: [stats.oil? ? "#b45309" : "#0369a1"] %>
<p class="hint"><%= t(".rolling_hour_window_total_added_html", chart_window_hours: stats.chart_window_hours, fuel: (stats.oil? ? "oil" : "fuel"), oil: (t(".higher_is_better") if stats.oil?)) %></p>
<% else %>
<%= empty_state t(".not_enough_history_yet_need", chart_window_hours: stats.chart_window_hours) %>
<% end %>
</div>
</section>
<% end %>
</div>
<section class="card mt-5">
<div class="card-header"><h2 class="card-title"><%= t(".records") %></h2></div>
<% if @records.any? %>
<%= render "consumable_records/records", records: @records, page: @page, more: @more %>
<% else %>
<%= empty_state t(".no_oil_or_fuel_records") %>
<% end %>
</section>