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

69 lines
4.0 KiB
ERB

<% content_for :title, t(".bulk_upload", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% file_classes = "block w-full text-sm text-slate-600 file:mr-3 file:rounded-md file:border-0 file:bg-slate-100 file:px-3 file:py-1.5 file:text-sm file:font-medium hover:file:bg-slate-200" %>
<%= form_with url: bulk_aircraft_documents_path(@aircraft), multipart: true, class: "card card-body max-w-3xl space-y-4",
data: { controller: "bulk-upload", bulk_upload_url_value: rails_direct_uploads_path,
bulk_upload_max_bytes_value: UploadValidation.max_size, action: "submit->bulk-upload#submit" } do %>
<div>
<h2 class="card-title"><%= t(".bulk_upload_2") %></h2>
<p class="text-sm text-slate-500"><%= t(".each_file_becomes_its_own") %></p>
</div>
<% if @bulk_error %>
<div class="rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200" role="alert"><%= @bulk_error %></div>
<% end %>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<%= label_tag :doc_type, t(".type"), class: "label" %>
<%= select_tag :doc_type, options_for_select(Document::TYPES.invert, @bulk[:doc_type]), class: "input" %>
</div>
<div>
<%= label_tag :visibility, t(".share_link_visibility"), class: "label" %>
<%= select_tag :visibility, options_for_select([ [ t(".inherit_from_collection"), "" ] ] + DocumentCollection::VISIBILITIES.invert.to_a, @bulk[:visibility]), class: "input" %>
</div>
<div>
<%= label_tag :document_collection_id, t(".collection"), class: "label" %>
<%= select_tag :document_collection_id,
options_for_select([ [ t(".none"), "" ] ] + @aircraft.document_collections.ordered.map { [ _1.name, _1.id ] }, @bulk[:document_collection_id]), class: "input" %>
</div>
<div>
<%= label_tag :new_collection, t(".or_a_new_collection"), class: "label" %>
<%= text_field_tag :new_collection, @bulk[:new_collection], class: "input", placeholder: t(".e_g_2025_annual") %>
</div>
</div>
<div class="grid gap-4 sm:grid-cols-2">
<div>
<%= label_tag :files, t(".files"), class: "label" %>
<%= file_field_tag "files[]", id: "files", multiple: true, class: file_classes,
data: { bulk_upload_target: "input", action: "change->bulk-upload#add" } %>
</div>
<div data-bulk-upload-target="folderField" hidden>
<%= label_tag :folder, t(".or_a_whole_folder"), class: "label" %>
<input type="file" id="folder" webkitdirectory multiple class="<%= file_classes %>"
data-bulk-upload-target="folder" data-action="change->bulk-upload#add">
</div>
</div>
<p class="hint !mt-1"><%= t(".images_pdfs_or_text_up_html", max_upload_mb: Setting.max_upload_mb, max_files: (DocumentsController::MAX_BULK_FILES)) %></p>
<div data-bulk-upload-target="panel" hidden class="space-y-2">
<div class="flex flex-wrap items-center justify-between gap-2">
<p class="text-sm font-medium text-slate-700" data-bulk-upload-target="summary"></p>
<div class="flex flex-wrap items-center gap-3">
<label class="flex items-center gap-2 text-sm text-slate-700" data-bulk-upload-target="groupField" hidden>
<input type="checkbox" class="h-4 w-4 rounded border-slate-300" data-bulk-upload-target="group" data-action="bulk-upload#regroup">
<%= t(".one_document_per_folder") %>
</label>
<button type="button" class="btn-secondary btn-sm" data-action="bulk-upload#clear"><%= t(".clear") %></button>
</div>
</div>
<ul class="divide-y divide-slate-100 rounded-md ring-1 ring-slate-200" data-bulk-upload-target="list"></ul>
</div>
<div class="flex flex-wrap items-center gap-2">
<button type="submit" class="btn-primary" data-bulk-upload-target="submit"><%= t(".upload") %></button>
<%= link_to t(".cancel"), aircraft_documents_path(@aircraft), class: "btn-secondary" %>
<p class="text-sm text-slate-500" data-bulk-upload-target="status" role="status"></p>
</div>
<% end %>