mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15: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>
58 lines
4.0 KiB
ERB
58 lines
4.0 KiB
ERB
<%# Signing form: review, certificate, re-authentication, confirm. Locals: entry, url, cancel_path. %>
|
|
<section class="card max-w-3xl">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".sign_this_entry") %></h2></div>
|
|
<div class="card-body space-y-4">
|
|
<p class="text-sm text-slate-600"><%= t(".review_the_entry_your_signature_html", link: (link_to t(".how_signing_works"), records_help_path, class: "link", target: "_blank")) %></p>
|
|
<%= render "logbook_entries/content", entry: entry %>
|
|
<% if @signing_error %>
|
|
<div class="rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200" role="alert"><%= @signing_error %></div>
|
|
<% end %>
|
|
<% if @certificates.empty? %>
|
|
<p class="rounded-md bg-amber-50 p-3 text-sm text-amber-900 ring-1 ring-amber-200">
|
|
<%= t(".to_sign_add_your_certificate_html", link: (link_to t(".your_profile"), edit_profile_path(anchor: "certificates"), class: "link")) %>
|
|
</p>
|
|
<% else %>
|
|
<%= form_with url: url, method: :post, class: "space-y-4" do %>
|
|
<fieldset class="space-y-2">
|
|
<legend class="label"><%= t(".sign_with") %></legend>
|
|
<% @certificates.each_with_index do |c, i| %>
|
|
<% problems = entry.signing_problems(c) %>
|
|
<label class="flex items-start gap-2 rounded-md p-2 text-sm ring-1 ring-slate-200 <%= 'opacity-60' if problems.any? %>">
|
|
<%= radio_button_tag :certificate_id, c.id, params[:certificate_id].to_s == c.id.to_s || (params[:certificate_id].blank? && i.zero? && problems.empty?),
|
|
disabled: problems.any?, class: "mt-1" %>
|
|
<span><strong><%= current_user.display_name %>, <%= c.kind_label %> <%= c.number %></strong>
|
|
<% if problems.any? %><span class="block text-xs text-red-700"><%= t(".can_t_sign_html", to_sentence: problems.to_sentence) %></span>
|
|
<% else %><span class="block text-slate-600"><%= EntrySignature.label %>: “<%= entry.certification_statement(c.kind) %>”</span><% end %></span>
|
|
</label>
|
|
<% end %>
|
|
</fieldset>
|
|
<% if Sso.password_login? || !current_user.sso_uid? %>
|
|
<div class="max-w-xs">
|
|
<%= label_tag :password, t(".your_password"), class: "label" %>
|
|
<%= password_field_tag :password, nil, class: "input", autocomplete: "current-password" %>
|
|
<p class="hint"><%= t(".proves_it_s_you_signing_html", sso_uid: (t(".or_sign_in_again_with_2", so: Sso.label) if Sso.enabled? && current_user.sso_uid?)) %></p>
|
|
</div>
|
|
<% if current_user.otp_enabled? %>
|
|
<div class="max-w-xs">
|
|
<%= label_tag :otp_code, t(".authenticator_code"), class: "label" %>
|
|
<%= text_field_tag :otp_code, nil, class: "input w-32 tracking-widest", autocomplete: "one-time-code", inputmode: "numeric", maxlength: 20 %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% if Sso.enabled? && current_user.sso_uid? %>
|
|
<% fresh = session[:reauthenticated_at] && Time.zone.at(session[:reauthenticated_at]) > EntrySigner::REAUTH_WINDOW.ago %>
|
|
<p class="text-sm <%= fresh ? 'text-emerald-700' : 'text-slate-600' %>"><%= fresh ? t(".signed_in_again_with_you", so: Sso.label) : t(".or_sign_in_again_with", so: Sso.label) %></p>
|
|
<% end %>
|
|
<label class="flex items-start gap-2 text-sm">
|
|
<%= check_box_tag :confirm, "1", false, class: "mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300" %>
|
|
<span><%= t(".i_am_signing_this_entry") %></span>
|
|
</label>
|
|
<div class="flex gap-2"><%= submit_tag t(".sign_entry"), class: "btn-primary" %><%= link_to t(".cancel"), cancel_path, class: "btn-secondary" %></div>
|
|
<% end %>
|
|
<% if Sso.enabled? && current_user.sso_uid? %>
|
|
<%= button_to t(".sign_in_again_with", so: Sso.label), "/auth/#{Sso::PROVIDER}", params: { prompt: "login" }, class: "btn-secondary btn-sm", data: { turbo: false } %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</section>
|