Replace browser confirm() dialogs with custom modal; add live label preview on battery add form
- base.html: add CSS/HTML/JS for styled in-app confirmation modal (dark-mode compatible via CSS vars) - device_list, battery_detail: convert onsubmit confirm() to declarative data-confirm attributes - dashboard: convert bulk Delete/Install buttons to use modal helpers (submitWithAction pattern) - app.py: pass brand_counts dict to battery_add template - battery_add.html: show live "Will create: Brand 001 → Brand 003" preview as brand/quantity change - tests: add two tests covering brand_counts server-side rendering
This commit is contained in:
@@ -95,8 +95,14 @@ def create_app(config_object="config"):
|
||||
.filter(Battery.storage_location.isnot(None))
|
||||
.distinct().order_by(Battery.storage_location).all()
|
||||
]
|
||||
brand_counts = {
|
||||
r[0]: r[1]
|
||||
for r in db.query(Battery.brand, func.count(Battery.id))
|
||||
.group_by(Battery.brand).all()
|
||||
}
|
||||
return render_template("battery_add.html", form_count=1, brands=brands,
|
||||
storage_locations=storage_locations)
|
||||
storage_locations=storage_locations,
|
||||
brand_counts=brand_counts)
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
# Battery — detail
|
||||
|
||||
Reference in New Issue
Block a user