Some layout tweaks.

This commit is contained in:
Yaro Kasear 2025-10-09 10:25:23 -05:00
parent 3c07741500
commit 9181ba660f
5 changed files with 80 additions and 65 deletions

View file

@ -15,11 +15,19 @@ def _fields_for_model(model: str):
layout = []
if model == "inventory":
fields = []
fields = [
"label",
"name",
"serial",
"barcode",
"model",
"condition",
"notes",
]
fields_spec = [
{"name": "label", "type": "display", "label": "", "row": "label",
"attrs": {"class": "display-6 mb-3"}, "wrap": {"class": "col"}},
{"name": "submit", "label": "", "row": "label", "type": "template", "template": "submit_button.html",
{"name": "submit", "label": "", "row": "label", "type": "template", "template": "entry_buttons.html",
"wrap": {"class": "col-auto text-end me-2"}, "attrs": {"data-model": model}},
{"name": "name", "row": "names", "label": "Name", "wrap": {"class": "col-3"},
"attrs": {"class": "form-control"}, "label_attrs": {"class": "form-label"}},
@ -70,11 +78,18 @@ def _fields_for_model(model: str):
]
elif model.lower() == 'user':
fields = []
fields = [
"label",
"first_name",
"last_name",
"title",
"active",
"staff"
]
fields_spec = [
{"name": "label", "row": "label", "label": "", "type": "display",
"attrs": {"class": "display-6 mb-3"}, "wrap": {"class": "col"}},
{"name": "submit", "label": "", "row": "label", "type": "template", "template": "submit_button.html",
{"name": "submit", "label": "", "row": "label", "type": "template", "template": "entry_buttons.html",
"wrap": {"class": "col-auto text-end me-2"}, "attrs": {"data-model": model}},
{"name": "last_name", "label": "Last Name", "label_attrs": {"class": "form-label"},
"attrs": {"placeholder": "Doe", "class": "form-control"}, "row": "name", "wrap": {"class": "col-3"}},
@ -119,7 +134,7 @@ def _fields_for_model(model: str):
fields_spec = [
{"name": "id", "label": "", "type": "display", "label_spec": "Work Item #{id}",
"attrs": {"class": "display-6 mb-3"}, "row": "label", "wrap": {"class": "col"}},
{"name": "submit", "label": "", "row": "label", "type": "template", "template": "submit_button.html",
{"name": "submit", "label": "", "row": "label", "type": "template", "template": "entry_buttons.html",
"wrap": {"class": "col-auto text-end me-2"}, "attrs": {"data-model": model}},
{"name": "contact", "row": "ownership", "wrap": {"class": "col"}, "label": "Contact",
"label_spec": "{label}", "attrs": {"class": "form-control"}, "label_attrs": {"class": "form-label"}},
@ -139,6 +154,7 @@ def _fields_for_model(model: str):
{"name": "ownership", "order": 10, "attrs": {"class": "row mb-2"}},
{"name": "timestamps", "order": 20, "attrs": {"class": "row d-flex align-items-center"}},
{"name": "updates", "order": 30, "attrs": {"class": "row"}},
{"name": "buttons"},
]
return (fields, fields_spec, layout)