Files
simple-aircraft-manager-rails/app/views/ad_imports/show.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

55 lines
3.3 KiB
ERB

<% content_for :title, t(".ad_import_preview") %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% rows = @import.rows %>
<%= form_with url: confirm_aircraft_ad_import_path(@aircraft), class: "space-y-5" do |f| %>
<%= hidden_field_tag :token, @token %>
<%= hidden_field_tag :filename, @filename %>
<section class="card">
<div class="card-header">
<h2 class="card-title"><%= t(".preview_html", filename: @filename) %></h2>
<span class="text-xs text-slate-500"><%= t(".found_with_drs_links_html", rows: (t("counts.ad", count: rows.size)), url: (rows.count(&:url))) %></span>
</div>
<div class="card-body space-y-3 text-sm">
<% if rows.none?(&:url) %><p class="rounded-md bg-amber-50 px-3 py-2 text-amber-900 ring-1 ring-amber-200"><%= t(".this_file_has_no_links_html") %></p><% end %>
<p><%= t(".choose_what_to_do_with_html", model: (@aircraft.model.presence || t(".not_set"))) %></p>
<ul class="list-disc space-y-1 pl-5 text-xs text-slate-600">
<li><%= t(".track_adds_the_ad_until_html", tail_number: @aircraft.tail_number) %> <span class="badge-red"><%= t(".grounded") %></span> <%= t(".while_any_tracked_ad_has") %></li>
<li><%= t(".not_applicable_adds_the_ad_html") %></li>
<li><%= t(".update_ads_already_tracked_refreshes_html") %></li>
<li><%= t(".skip_not_imported_or_left_html") %></li>
</ul>
</div>
</section>
<section class="card">
<div class="overflow-x-auto">
<table class="table">
<thead><tr><th><%= t(".ad") %></th><th><%= t(".subject") %></th><th><%= t(".effective") %></th><th><%= t(".notes") %></th><th class="w-44"><%= t(".action") %></th></tr></thead>
<tbody>
<% rows.each do |r| %>
<tr>
<td class="whitespace-nowrap font-medium"><%= r.number %><%= link_to " 🔗", r.url, target: "_blank", rel: "noopener noreferrer", title: t(".link_found_in_file") if r.url %>
<% if r.product_type %><div class="text-xs font-normal text-slate-500"><%= r.product_type %></div><% end %></td>
<td class="max-w-md">
<%= r.subject %>
<% if r.summary %><details class="mt-1 text-xs text-slate-600"><summary class="cursor-pointer text-sky-700"><%= t(".summary") %></summary><%= r.summary %></details><% end %>
</td>
<td class="whitespace-nowrap text-xs"><%= fmt_date(r.effective_date) %></td>
<td class="text-xs">
<% r.notes.each do |n| %><div class="<%= n.start_with?(t(".already"), t(".matches")) ? 'text-slate-500' : 'text-amber-800' %>">• <%= n %></div><% end %>
</td>
<td><% choices = r.tracked ? [ [ t(".update"), "track" ], [ t(".not_applicable"), "na" ], [ t(".skip_leave_as_is"), "skip" ] ] : AdImport::ACTIONS.invert %>
<%= select_tag "decisions[#{r.number}]", options_for_select(choices, r.suggested), class: "input" %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</section>
<div class="flex gap-2">
<%= f.submit t(".import_ads"), class: "btn-primary", data: { turbo_confirm: t(".import_these_ads_to", tail_number: @aircraft.tail_number) } %>
<%= link_to t(".upload_a_different_file"), new_aircraft_ad_import_path(@aircraft), class: "btn-secondary" %>
</div>
<% end %>