Add nav-tree, auth-menu, cart-mini fragment slots to shared header
The shared _header.html template now checks for pre-fetched fragment HTML (nav_tree_html, auth_menu_html, cart_mini_html) before falling back to local includes. This lets consumer apps render cross-app UI via the fragment composition system. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,8 +9,12 @@
|
||||
{% call links.menu_row(id='root-row', oob=oob) %}
|
||||
<div class="w-full flex flex-row items-top">
|
||||
{# Cart mini #}
|
||||
{% from '_types/cart/_mini.html' import mini with context %}
|
||||
{{mini()}}
|
||||
{% if cart_mini_html %}
|
||||
{{ cart_mini_html | safe }}
|
||||
{% else %}
|
||||
{% from '_types/cart/_mini.html' import mini with context %}
|
||||
{{mini()}}
|
||||
{% endif %}
|
||||
|
||||
{# Site title #}
|
||||
<div class="font-bold text-5xl flex-1">
|
||||
@@ -20,11 +24,19 @@
|
||||
|
||||
{# Desktop nav #}
|
||||
<nav class="hidden md:flex gap-4 text-sm ml-2 justify-end items-center flex-0">
|
||||
{% include '_types/root/_nav.html' %}
|
||||
{% if not g.user %}
|
||||
{% include '_types/root/_sign_in.html' %}
|
||||
{% if nav_tree_html %}
|
||||
{{ nav_tree_html | safe }}
|
||||
{% else %}
|
||||
{% include '_types/root/_full_user.html' %}
|
||||
{% include '_types/root/_nav.html' %}
|
||||
{% endif %}
|
||||
{% if auth_menu_html %}
|
||||
{{ auth_menu_html | safe }}
|
||||
{% else %}
|
||||
{% if not g.user %}
|
||||
{% include '_types/root/_sign_in.html' %}
|
||||
{% else %}
|
||||
{% include '_types/root/_full_user.html' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include "_types/root/_nav_panel.html"%}
|
||||
</nav>
|
||||
@@ -33,10 +45,14 @@
|
||||
{% endcall %}
|
||||
{# Mobile user info #}
|
||||
<div class="block md:hidden text-md font-bold">
|
||||
{% if g.user %}
|
||||
{% include '_types/root/mobile/_full_user.html' %}
|
||||
{% if auth_menu_html %}
|
||||
{{ auth_menu_html | safe }}
|
||||
{% else %}
|
||||
{% include '_types/root/mobile/_sign_in.html' %}
|
||||
{% if g.user %}
|
||||
{% include '_types/root/mobile/_full_user.html' %}
|
||||
{% else %}
|
||||
{% include '_types/root/mobile/_sign_in.html' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
Reference in New Issue
Block a user