Collapse optional article search on filament forms

This commit is contained in:
Mikei386 committed 2026-11-14 17:24:29 +01:00
1 parent b69e1d37bd
commit 0287643b97
3 files changed
+38 -18

No files matched your search

+15
View File
@@ -589,6 +589,21 @@ td.quantity {
.variant-panel {
overflow: visible;
}
.article-search {
margin-bottom: 16px;
border-bottom: 1px solid var(--line);
}
.article-search summary {
padding: 0 0 12px;
color: var(--green);
cursor: pointer;
font-size: 13px;
font-weight: 650;
}
.article-search summary .muted {
font-size: inherit;
font-weight: 500;
}
.article-lookup {
display: flex;
align-items: center;
+2
View File
@@ -144,6 +144,7 @@ class CatalogTests(CatalogTestCase):
url = f"/{path}/hinzufuegen/"
response = self.client.get(url)
article_input = response.context["lookup"]["article_number"].as_widget()
self.assertContains(response, '<details class="article-search">')
self.assertIn('name="article_number"', article_input)
self.assertNotIn("required", article_input)
self.assertRedirects(
@@ -151,6 +152,7 @@ class CatalogTests(CatalogTestCase):
)
self.assertEqual(model.objects.get(variant=self.spool).quantity, 1)
response = self.client.post(url, {"action": "lookup", "article_number": ""})
self.assertContains(response, '<details class="article-search" open>')
self.assertContains(response, "Bitte gib eine Artikelnummer ein.")
def test_article_lookup_prefills_both_forms_and_preserves_quantity(self):