from __future__ import annotations from quart import ( render_template, make_response, Blueprint ) from suma_browser.app.authz import require_admin def register(): bp = Blueprint("admin", __name__, url_prefix='/admin') # ---------- Pages ---------- @bp.get("/") @require_admin async def admin(entry_id: int, **kwargs): from suma_browser.app.utils.htmx import is_htmx_request # Determine which template to use based on request type if not is_htmx_request(): # Normal browser request: full page with layout html = await render_template("_types/entry/admin/index.html") else: html = await render_template("_types/entry/admin/_oob_elements.html") return await make_response(html) return bp