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

58 lines
3.4 KiB
ERB

<%= form_with model: [aircraft, component], class: "card card-body space-y-5 max-w-4xl" do |f| %>
<%= f.errors_summary %>
<div class="grid gap-4 sm:grid-cols-3">
<div>
<%= f.field :component_type_id, as: :select, label: t(".type"),
collection: ComponentType.ordered.map { [_1.name, _1.id] }, include_blank: t(".select") %>
<%= text_field_tag :new_component_type, params[:new_component_type], class: "input mt-2", placeholder: t(".or_type_a_new_one") %>
</div>
<%= f.field :manufacturer, required: true %>
<%= f.field :model, required: true %>
<%= f.field :serial_number %>
<%= f.field :install_location, hint: t(".e_g_left_mag_3") %>
<%= f.field :status, as: :select, collection: Component::STATUSES.invert %>
<%= f.field :parent_component_id, as: :select, label: t(".parent_component"),
collection: [[t(".none"), nil]] + aircraft.components.where.not(id: component.id).includes(:component_type).map { [_1.to_s, _1.id] } %>
</div>
<fieldset class="grid gap-4 sm:grid-cols-4">
<legend class="mb-2 text-sm font-semibold text-slate-900"><%= t(".time") %></legend>
<%= f.field :date_in_service, as: :date, required: true %>
<%= f.field :hours_in_service, as: :number, step: 0.1, label: t(".total_time_hours") %>
<%= f.field :overhaul_date, as: :date, label: t(".last_overhaul_service") %>
<%= f.field :hours_since_overhaul, as: :number, step: 0.1, label: t(".hours_since_oh_service") %>
<%= f.field :overhaul_kind, as: :select, label: t(".overhaul_type"), include_blank: "—", collection: Component::OVERHAUL_KINDS.invert,
wrapper: { class: "sm:col-span-2" }, hint: t(".for_engines_and_propellers_printed") %>
</fieldset>
<fieldset class="grid gap-4 sm:grid-cols-3">
<legend class="mb-2 text-sm font-semibold text-slate-900"><%= t(".limits") %></legend>
<%= f.field :replacement_hours, as: :number, label: t(".replace_every_hrs") %>
<%= f.interval :replacement, label: t(".replace_every") %>
<%= f.field :replacement_from_install, as: :select, label: t(".replacement_counts_from"),
collection: [ [ t(".last_service"), false ], [ t(".installation_life_limit"), true ] ],
hint: t(".installation_for_a_part_that") %>
<%= f.field :replacement_critical, as: :checkbox, label: t(".replacement_critical"), hint: t(".overdue_replacement_or_expiry_grounds") %>
<%= f.field :expires_on, as: :date, label: t(".expires_on"),
hint: t(".the_date_marked_on_the") %>
<%= f.field :tbo_hours, as: :number, label: t(".tbo_hrs") %>
<%= f.interval :tbo, label: t(".tbo_calendar") %>
<div class="space-y-2">
<%= f.field :tbo_critical, as: :checkbox, label: t(".treat_tbo_as_a_hard"),
hint: t(".under_part_91_tbo_is") %>
<%= f.field :on_condition, as: :checkbox, label: t(".on_condition_part_91"),
hint: t(".run_past_tbo_based_on") %>
</div>
<p class="hint sm:col-span-3"><%= t(".recurring_inspections_of_this_part") %></p>
</fieldset>
<%= f.field :notes, as: :textarea, rows: 3 %>
<div class="flex gap-2">
<%= f.submit component.new_record? ? t(".add_component") : t(".save") %>
<%= link_to t(".cancel"), aircraft_components_path(aircraft), class: "btn-secondary" %>
</div>
<% end %>
<% if component.persisted? %>
<div class="mt-4"><%= delete_button t(".delete_component"), aircraft_component_path(aircraft, component), confirm: t(".delete_and_its_sub_components", component: component) %></div>
<% end %>