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

55 lines
3.5 KiB
ERB

<%= form_with model: [aircraft, analysis], class: "card card-body space-y-5 max-w-4xl" do |f| %>
<%= f.errors_summary %>
<div class="grid gap-4 sm:grid-cols-3">
<%= f.field :sample_date, as: :date, required: true %>
<%= f.field :analysis_date, as: :date %>
<%= f.field :status, as: :select, label: t(".lab_s_verdict"), collection: [ [ t(".not_rated"), "" ] ] + OilAnalysis::STATUSES.invert.to_a %>
<%= f.field :component_id, as: :select, label: t(".engine"), collection: component_options(aircraft) %>
<%= f.field :lab, placeholder: t(".avlab_blackstone") %>
<%= f.field :sample_number, label: t(".sample_lab") %>
<%= f.field :oil_type, label: t(".oil"), placeholder: t(".aeroshell_w100"), wrapper: { class: "sm:col-span-2" } %>
</div>
<fieldset class="grid gap-4 sm:grid-cols-4">
<legend class="mb-2 text-sm font-semibold"><%= t(".hours") %></legend>
<%= f.field :engine_hours, as: :number, step: 0.1, label: t(".engine_tsn_tso") %>
<%= f.field :oil_hours, as: :number, step: 0.1, label: t(".on_oil") %>
<%= f.field :filter_hours, as: :number, step: 0.1, label: t(".on_filter") %>
<%= f.field :oil_added, as: :number, step: 0.25, label: t(".oil_added_qt") %>
</fieldset>
<fieldset>
<legend class="mb-2 text-sm font-semibold"><%= t(".results_ppm") %></legend>
<p class="hint mb-3"><%= t(".leave_blank_what_the_lab_html") %></p>
<div class="grid gap-x-4 gap-y-3 sm:grid-cols-2 lg:grid-cols-3">
<%= render partial: "element_input", collection: OilAnalysis::COMMON_ELEMENTS, as: :element, locals: { analysis: analysis } %>
</div>
<% extra = OilAnalysis::ELEMENTS.keys - OilAnalysis::COMMON_ELEMENTS %>
<details class="mt-3" <%= "open" if extra.any? { analysis.value(_1) || analysis.average(_1) } %>>
<summary class="cursor-pointer text-sm text-sky-700"><%= t(".more_elements_blackstone_and_other") %></summary>
<div class="mt-3 grid gap-x-4 gap-y-3 sm:grid-cols-2 lg:grid-cols-3">
<%= render partial: "element_input", collection: extra, as: :element, locals: { analysis: analysis } %>
</div>
</details>
</fieldset>
<details <%= "open" if analysis.oil_properties.any? %>>
<summary class="cursor-pointer text-sm font-semibold"><%= t(".oil_properties") %></summary>
<div class="mt-3 grid gap-x-4 gap-y-3 sm:grid-cols-3">
<% OilAnalysis::PROPERTIES.each do |key, label| %><% unit = OilAnalysis::PROPERTY_UNITS[key] %>
<div>
<%= label_tag "oil_analysis_oil_properties_#{key}", [ label, (unit.presence && "(#{unit})") ].compact.join(" "), class: "label" %>
<%= number_field_tag "oil_analysis[oil_properties][#{key}]", analysis.property(key), id: "oil_analysis_oil_properties_#{key}", step: "any", min: 0, class: "input" %>
</div>
<% end %>
</div>
</details>
<%= f.field :excluded_from_averages, as: :checkbox, label: t(".leave_out_of_trends"),
hint: t(".for_a_sample_that_isn") %>
<%= f.field :lab_comments, as: :textarea, rows: 2 %>
<%= f.field :notes, as: :textarea, rows: 2 %>
<%= f.field :report, as: :file, label: t(".lab_report_pdf"), accept: ".pdf,application/pdf,image/*" %>
<% if analysis.report.attached? %><p class="hint"><%= t(".current_choosing_a_file_replaces_html", filename: analysis.report.filename) %></p><% end %>
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), analysis.persisted? ? aircraft_oil_analysis_path(aircraft, analysis) : aircraft_oil_analyses_path(aircraft), class: "btn-secondary" %></div>
<% end %>