Files
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

88 lines
4.4 KiB
ERB

<% content_for :title, t(".airports") %>
<div class="mb-4 flex items-center justify-between">
<h1 class="text-2xl font-bold"><%= t(".airports") %></h1>
<%= link_to t(".custom_airport"), new_admin_airport_path, class: "btn-primary" %>
</div>
<div class="grid gap-5 lg:grid-cols-3">
<section class="card lg:col-span-2">
<div class="card-header">
<h2 class="card-title"><%= t(".airport_database") %></h2>
<% if @running %>
<span class="badge-blue"><%= t(".updating") %></span>
<% else %>
<%= button_to t(".update_from_ourairports"), refresh_admin_airports_path, class: "btn-secondary",
form: { data: { turbo_confirm: t(".download_the_latest_airport_data") } } %>
<% end %>
</div>
<div class="card-body space-y-3 text-sm">
<div class="grid grid-cols-3 gap-3 text-center">
<div><div class="text-2xl font-semibold"><%= number_with_delimiter(@total) %></div><div class="text-xs text-slate-500"><%= t(".airports_2") %></div></div>
<div><div class="text-2xl font-semibold"><%= @custom.size %></div><div class="text-xs text-slate-500"><%= t(".custom") %></div></div>
<div><div class="text-sm font-semibold"><%= @last_success ? "#{time_ago_in_words(@last_success.finished_at)} ago" : "never" %></div><div class="text-xs text-slate-500"><%= t(".last_updated") %></div></div>
</div>
<% if @total.zero? %>
<p class="rounded-md bg-amber-50 px-3 py-2 text-amber-900 ring-1 ring-amber-200"><%= t(".no_airport_data_yet_it") %></p>
<% end %>
<p class="hint"><%= t(".airport_data_comes_from_ourairports_html") %></p>
<% if @updates.any? %>
<table class="table">
<thead><tr><th><%= t(".started") %></th><th><%= t(".by") %></th><th><%= t(".status") %></th><th><%= t(".result") %></th></tr></thead>
<tbody>
<% @updates.each do |u| %>
<tr>
<td class="whitespace-nowrap text-xs"><%= fmt_time(u.created_at) %></td>
<td class="text-xs"><%= u.requested_by&.display_name || t(".startup") %></td>
<td><%= tag.span u.status.capitalize, class: { "done" => "badge-green", "failed" => "badge-red" }.fetch(u.status, "badge-blue") %></td>
<td class="text-xs"><%= u.done? ? u.summary : u.error %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
</section>
<section class="card">
<div class="card-header"><h2 class="card-title"><%= t(".look_up") %></h2></div>
<div class="card-body space-y-2">
<%= form_with url: admin_airports_path, method: :get, class: "flex gap-2" do |f| %>
<%= f.search_field :q, value: @query, class: "input", placeholder: t(".code_or_name") %>
<%= f.submit t(".search"), class: "btn-secondary" %>
<% end %>
<% if @query.present? %>
<% if @results.any? %>
<ul class="divide-y divide-slate-100 text-sm">
<% @results.each do |a| %>
<li class="py-1.5"><span class="font-mono font-semibold"><%= a.code %></span> <%= a.name %>
<div class="text-xs text-slate-500"><%= [a.place, t(".airtrail", airtrail_code: a.airtrail_code), (a.custom? ? "custom" : nil), Airport::KIND_LABELS[a.kind]].compact_blank.join(" · ") %></div></li>
<% end %>
</ul>
<% else %>
<p class="text-sm text-slate-600"><%= t(".no_match_for_html", query: @query, link: (link_to t(".add_it_as_a_custom"), new_admin_airport_path(ident: @query.upcase), class: "link")) %></p>
<% end %>
<% end %>
</div>
</section>
</div>
<section class="card mt-5">
<div class="card-header"><h2 class="card-title"><%= t(".custom_airports") %></h2></div>
<% if @custom.any? %>
<table class="table">
<thead><tr><th><%= t(".code") %></th><th><%= t(".name") %></th><th><%= t(".location") %></th><th><%= t(".type") %></th><th></th></tr></thead>
<tbody>
<% @custom.each do |a| %>
<tr>
<td class="font-mono font-semibold"><%= a.ident %></td><td><%= a.name %></td><td class="text-xs"><%= a.place %></td>
<td class="text-xs"><%= a.kind.to_s.humanize %></td>
<td class="text-right"><%= link_to t(".edit"), edit_admin_airport_path(a), class: "btn-secondary btn-sm" %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<%= empty_state t(".none_add_private_strips_or") %>
<% end %>
</section>