diff --git a/app/views/documents/index.html.erb b/app/views/documents/index.html.erb
index 82d495c..4acdea1 100644
--- a/app/views/documents/index.html.erb
+++ b/app/views/documents/index.html.erb
@@ -12,11 +12,14 @@
<% end %>
<% @collections.each do |col| %>
-
-
diff --git a/docs/guide/documents.md b/docs/guide/documents.md
index 5016f34..6d54fd9 100644
--- a/docs/guide/documents.md
+++ b/docs/guide/documents.md
@@ -4,7 +4,7 @@ The **Documents** tab keeps scans and files: registration, airworthiness certifi
- **+ Upload Document**: a name, type, collection, description, and one or more files (images, PDFs or text). Each file is a page in the viewer.
- **Bulk upload**: many files at once. Each becomes its own document named after the file; files with the same name are combined, in order, as pages of one document.
-- **+ Collection** groups documents (for example *Engine logbook* or *Annual 2026*).
+- **+ Collection** groups documents (for example *Engine logbook* or *Annual 2026*). Collections start collapsed, showing how many documents they hold; click one to open it.
## Expiry
diff --git a/test/integration/document_bulk_upload_test.rb b/test/integration/document_bulk_upload_test.rb
index 60e1490..07d0316 100644
--- a/test/integration/document_bulk_upload_test.rb
+++ b/test/integration/document_bulk_upload_test.rb
@@ -15,6 +15,18 @@ class DocumentBulkUploadTest < ActionDispatch::IntegrationTest
ActiveStorage::Blob.create_and_upload!(io: StringIO.new("bytes"), filename: name, content_type: type)
end
+ test "collections are collapsed on the documents page, with their document count" do
+ sign_in @owner
+ @a.document_collections.create!(name: "Engine logbook").documents.create!(aircraft: @a, name: "Scan", doc_type: "LOG")
+ @a.documents.create!(name: "Loose receipt", doc_type: "INVOICE")
+ get aircraft_documents_path(@a)
+ assert_select "details.document-collection", 2
+ assert_select "details.document-collection[open]", 0 # collapsed until clicked
+ assert_select "details.document-collection summary h2", text: /Engine logbook\s*\(1\)/
+ assert_select "details.document-collection summary h2", text: /Uncollected\s*\(1\)/
+ assert_select "details.document-collection a", text: "Scan" # still in the page, just closed
+ end
+
test "owner sees the bulk page; pilots and outsiders can't use it" do
sign_in @owner
get aircraft_documents_path(@a)