Remove cross-domain template copies, use shared macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m11s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m11s
- Blog hamburger: removed (inlined in shared layout.html)
- Cart mini: use macros/cart_icon.html for add-to-cart OOB
- Post header: use blog_url() instead of url_for('blog.post.post_detail')
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2
shared
2
shared
Submodule shared updated: 5518c95237...cf2e2ba1db
@@ -1,13 +0,0 @@
|
|||||||
<div class="md:hidden mx-2 bg-stone-200 rounded">
|
|
||||||
|
|
||||||
|
|
||||||
<span class="flex items-center justify-center text-stone-600 text-lg h-12 w-12 transition-transform group-open/filter:hidden self-start">
|
|
||||||
<i class="fa-solid fa-filter"></i>
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
<svg aria-hidden="true" viewBox="0 0 24 24"
|
|
||||||
class="w-12 h-12 rotate-180 transition-transform group-open/filter:block hidden self-start">
|
|
||||||
<path d="M6 9l6 6 6-6" fill="currentColor"/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
{% macro mini(oob=False, count=None) %}
|
|
||||||
<div id="cart-mini" {% if oob %}hx-swap-oob="{{oob}}"{% endif %} >
|
|
||||||
{# cart_count is set by the context processor in all apps.
|
|
||||||
Cart app computes it from g.cart + calendar_cart_entries;
|
|
||||||
other apps get it from the cart internal API.
|
|
||||||
count param allows explicit override when macro is imported without context. #}
|
|
||||||
{% if count is not none %}
|
|
||||||
{% set _count = count %}
|
|
||||||
{% elif cart_count is defined and cart_count is not none %}
|
|
||||||
{% set _count = cart_count %}
|
|
||||||
{% elif cart is defined and cart is not none %}
|
|
||||||
{% set _count = (cart | sum(attribute="quantity")) + ((calendar_cart_entries | length) if calendar_cart_entries else 0) %}
|
|
||||||
{% else %}
|
|
||||||
{% set _count = 0 %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if _count == 0 %}
|
|
||||||
<div class="h-12 w-12 rounded-full overflow-hidden border border-stone-300 flex-shrink-0">
|
|
||||||
<a
|
|
||||||
href="{{ blog_url('/') }}"
|
|
||||||
class="h-full w-full font-bold text-5xl flex-shrink-0 flex flex-row items-center gap-1"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src="{{ site().logo }}"
|
|
||||||
class="h-full w-full rounded-full object-cover border border-stone-300 flex-shrink-0"
|
|
||||||
>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
<a
|
|
||||||
href="{{ cart_url('/') }}"
|
|
||||||
class="relative inline-flex items-center justify-center text-stone-700 hover:text-emerald-700"
|
|
||||||
>
|
|
||||||
<i class="fa fa-shopping-cart text-5xl" aria-hidden="true"></i>
|
|
||||||
|
|
||||||
<span
|
|
||||||
class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 inline-flex items-center justify-center rounded-full bg-emerald-600 text-white text-sm w-5 h-5"
|
|
||||||
>
|
|
||||||
{{ _count }}
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endmacro %}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{% import 'macros/links.html' as links %}
|
{% import 'macros/links.html' as links %}
|
||||||
{% macro header_row(oob=False) %}
|
{% macro header_row(oob=False) %}
|
||||||
{% call links.menu_row(id='post-row', oob=oob) %}
|
{% call links.menu_row(id='post-row', oob=oob) %}
|
||||||
{% call links.link(url_for('blog.post.post_detail', slug=post.slug), hx_select_search ) %}
|
{% call links.link(blog_url('/' + post.slug + '/'), hx_select_search ) %}
|
||||||
{% if post.feature_image %}
|
{% if post.feature_image %}
|
||||||
<img
|
<img
|
||||||
src="{{ post.feature_image }}"
|
src="{{ post.feature_image }}"
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
{% import '_types/product/_cart.html' as _cart %}
|
{% import '_types/product/_cart.html' as _cart %}
|
||||||
|
|
||||||
{# 1. Update mini cart directly — handler already has the cart data #}
|
{# 1. Update mini cart directly — handler already has the cart data #}
|
||||||
{% from '_types/cart/_mini.html' import mini with context %}
|
{% from 'macros/cart_icon.html' import cart_icon %}
|
||||||
{{ mini(count=cart | sum(attribute="quantity")) }}
|
{{ cart_icon(count=cart | sum(attribute="quantity")) }}
|
||||||
|
|
||||||
{# 2. Update add/remove buttons on the product #}
|
{# 2. Update add/remove buttons on the product #}
|
||||||
{{ _cart.add(d.slug, cart, oob='true') }}
|
{{ _cart.add(d.slug, cart, oob='true') }}
|
||||||
|
|||||||
Reference in New Issue
Block a user