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>
46 lines
3.4 KiB
ERB
46 lines
3.4 KiB
ERB
<% content_for :title, t(".records_audit") %>
|
|
<h1 class="mb-1 text-2xl font-bold"><%= t(".records_audit") %></h1>
|
|
<p class="mb-5 text-sm text-slate-600"><%= t(".work_through_each_item_the") %></p>
|
|
<%= form_with url: admin_audits_path, class: "space-y-5" do %>
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".checked_by_the_app") %></h2></div>
|
|
<ul class="divide-y divide-slate-100 text-sm">
|
|
<% @audit.auto_items.each do |item| %>
|
|
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= item.passed ? 'badge-green' : 'badge-red' %>"><%= item.passed ? t(".pass") : t(".fail") %></span>
|
|
<span><span class="font-medium"><%= item.title %></span><span class="block text-xs text-slate-500"><%= item.detail %></span></span></li>
|
|
<% end %>
|
|
</ul>
|
|
</section>
|
|
|
|
<% sample = @audit.sample %>
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".confirmed_by_you") %></h2></div>
|
|
<div class="space-y-4 p-4">
|
|
<% RecordsAudit::MANUAL.each do |key, title| %>
|
|
<div class="space-y-2 rounded-md p-3 ring-1 ring-slate-200">
|
|
<label class="flex items-start gap-2 text-sm font-medium"><%= check_box_tag "answers[#{key}][passed]", "1", false, class: "mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300" %><span><%= title %></span></label>
|
|
<% if key == "restore_test" && OffsiteConnection.connected? %>
|
|
<p class="ml-6 text-xs text-slate-600">
|
|
<% if (rt = @audit.restore_test) %><%= t(".last_automatic_restore_test_html", to_date: (fmt_date(rt.created_at.to_date))) %> <span class="<%= rt.ok ? 'badge-green' : 'badge-red' %>"><%= rt.ok ? "OK" : t(".failed") %></span> <%= rt.message %><% else %><%= t(".no_automatic_restore_test_yet") %><% end %>
|
|
<%= t(".admin_off_site_backup_test_html", link: (link_to t(".run_one"), admin_offsite_backup_path, class: "link", target: "_blank")) %>
|
|
</p>
|
|
<% end %>
|
|
<% if key == "sample" %>
|
|
<ul class="ml-6 list-disc text-xs text-slate-600">
|
|
<% sample.each do |e| %><li><%= hidden_field_tag "sample_ids[]", e.id, id: nil %><%= link_to "#{e.aircraft.tail_number} · #{fmt_date(e.date)} · #{e.text.truncate(80)}", aircraft_logbook_entry_path(e.aircraft, e), class: "link", target: "_blank" %><%= t(".signed") if e.signature %></li><% end %>
|
|
<% if sample.empty? %><li><%= t(".no_entries_since_the_last") %></li><% end %>
|
|
</ul>
|
|
<% elsif key == "users" %>
|
|
<ul class="ml-6 list-disc text-xs text-slate-600">
|
|
<% @audit.users.each do |u| %><li><%= t(".last_sign_in_html", display_name: u.display_name, email_address: u.email_address, admin: (t(".admin") if u.admin?), any: (" · #{u.aircraft_roles.map { "#{AircraftRole::ROLES[_1.role]} #{_1.aircraft.tail_number}" }.join(', ')}" if u.aircraft_roles.any?), never: (u.last_signed_in_at ? t(".ago", time: time_ago_in_words(u.last_signed_in_at)) : t(".never")), disabled: (t(".disabled") if u.disabled?)) %></li><% end %>
|
|
</ul>
|
|
<% end %>
|
|
<%= text_field_tag "answers[#{key}][note]", nil, class: "input", placeholder: t(".note_what_was_checked_or") %>
|
|
</div>
|
|
<% end %>
|
|
<div><%= label_tag :notes, t(".overall_notes"), class: "label" %><%= text_area_tag :notes, nil, rows: 3, class: "input" %></div>
|
|
<%= submit_tag t(".record_audit"), class: "btn-primary" %>
|
|
</div>
|
|
</section>
|
|
<% end %>
|