{# LOTUSGUILD TERMINAL DESIGN SYSTEM — Flask/Jinja2 Base Template Extend this in every page template: {% extends "base.html" %} {% block title %}Dashboard{% endblock %} {% block active_nav %}dashboard{% endblock %} {% block content %} … your page HTML … {% endblock %} {% block scripts %} {% endblock %} Required Flask setup (app.py): - Pass `nonce` into every render_template() call via a context processor - Pass `user` dict from _get_user() helper - Pass `config` dict with APP_NAME, APP_SUBTITLE, etc. - Pass `nav_links` list of dicts defining navigation Context processor example: @app.context_processor def inject_globals(): import base64, os nonce = base64.b64encode(os.urandom(16)).decode() return dict(nonce=nonce, user=_get_user(), config=_config()) nav_links format (pass from route or context processor): nav_links = [ {'href': url_for('index'), 'key': 'dashboard', 'label': 'Dashboard'}, {'href': url_for('settings'), 'key': 'settings', 'label': 'Settings'}, # Admin-only dropdown: {'label': 'Admin', 'key': 'admin', 'admin_only': True, 'children': [ {'href': url_for('admin_users'), 'label': 'Users'}, ]}, ] #} {% block title %}Dashboard{% endblock %} — {{ config.get('app_name', 'LotusGuild') }}
{{ config.get('app_name', 'APP') | upper }} {{ config.get('app_subtitle', 'LotusGuild Infrastructure') }}
{% if user.name or user.username %} {{ user.name or user.username }} {% endif %} {% if 'admin' in user.groups %} admin {% endif %}
{% block content %}{% endblock %}
{% block scripts %}{% endblock %} {# --------------------------------------------------------------- active_nav block — override in each page template: {% block active_nav %}dashboard{% endblock %} Value must match a 'key' in your nav_links list. --------------------------------------------------------------- #} {% block active_nav %}{% endblock %}