mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- 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>
54 lines
3.2 KiB
ERB
54 lines
3.2 KiB
ERB
<% content_for :title, t(".components", tail_number: @aircraft.tail_number) %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<section class="card">
|
|
<div class="card-header">
|
|
<h2 class="card-title"><%= t(".components_2") %></h2>
|
|
<div class="flex items-center gap-3">
|
|
<%= link_to (@show_disposed ? t(".hide_disposed") : t(".show_disposed")),
|
|
aircraft_components_path(@aircraft, disposed: (@show_disposed ? nil : 1)), class: "link text-sm" %>
|
|
<% if owner? %><%= link_to t(".add_component"), new_aircraft_component_path(@aircraft), class: "btn-primary" %><% end %>
|
|
</div>
|
|
</div>
|
|
<% if @rows.empty? %>
|
|
<%= empty_state t(".no_components_yet_add_the") %>
|
|
<% else %>
|
|
<div class="overflow-x-auto">
|
|
<table class="table">
|
|
<thead><tr>
|
|
<th><%= t(".component") %></th><th><%= t(".make_model") %></th><th><%= t(".status") %></th>
|
|
<th class="text-right"><%= t(".in_service") %></th><th class="text-right"><%= t(".since_oh_svc") %></th>
|
|
<th><%= t(".limit") %></th><th><%= t(".life") %></th><th></th>
|
|
</tr></thead>
|
|
<tbody>
|
|
<% @rows.each do |c, depth| %>
|
|
<tr>
|
|
<td style="padding-left: <%= 0.75 + depth * 1.25 %>rem">
|
|
<%= "↳ " if depth > 0 %><%= link_to c.component_type.name, aircraft_component_path(@aircraft, c), class: "link font-medium" %>
|
|
<% if c.install_location.present? %><div class="text-xs text-slate-500"><%= c.install_location %></div><% end %>
|
|
</td>
|
|
<td><%= c.manufacturer %> <%= c.model %><% if c.serial_number.present? %><div class="text-xs text-slate-500">S/N <%= c.serial_number %></div><% end %></td>
|
|
<td><%= tag.span c.status_label, class: { "IN-USE" => "badge-green", "SPARE" => "badge-gray", "DISPOSED" => "badge-gray" }[c.status] %></td>
|
|
<td class="text-right tabular-nums"><%= hours(c.hours_in_service) %></td>
|
|
<td class="text-right tabular-nums"><%= hours(c.hours_since_overhaul) %></td>
|
|
<td class="text-xs text-slate-600">
|
|
<% if c.replacement_critical? && (c.replacement_hours || c.replacement_calendar?) %>
|
|
<%= t(".replace_html", interval: ([c.replacement_hours && "#{c.replacement_hours} h", c.replacement_interval_label].compact.join(" / ")), installed: (t(".since_installed") if c.replacement_from_install?)) %>
|
|
<% end %>
|
|
<% if c.tbo_critical? && c.tbo_hours %><%= t(".tbo_h_html", tbo_hours: c.tbo_hours, on_condition: (t(".on_condition") if c.on_condition?)) %><% end %>
|
|
<% if c.expires_on %><%= t(".expires_html", expires_on: (fmt_date(c.expires_on))) %><% end %>
|
|
</td>
|
|
<td><%= life_badge(c.life_status) %></td>
|
|
<td class="whitespace-nowrap text-right">
|
|
<% if owner? %>
|
|
<%= link_to t(".edit"), edit_aircraft_component_path(@aircraft, c), class: "btn-secondary btn-sm" %>
|
|
<%= link_to t(".service"), aircraft_component_path(@aircraft, c, anchor: "service"), class: "btn-secondary btn-sm" %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% end %>
|
|
</section>
|