Remove cross-domain template copies, use shared macros
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 56s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 56s
- Cart mini: use macros/cart_icon.html for ticket OOB updates
- 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,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 }}"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{# Response for ticket adjust — buy form + OOB cart-mini update #}
|
{# Response for ticket adjust — buy form + OOB cart-mini update #}
|
||||||
{% from '_types/cart/_mini.html' import mini %}
|
{% from 'macros/cart_icon.html' import cart_icon %}
|
||||||
{{ mini(oob='true', count=cart_count) }}
|
{{ cart_icon(count=cart_count, oob='true') }}
|
||||||
{% include '_types/tickets/_buy_form.html' %}
|
{% include '_types/tickets/_buy_form.html' %}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{# Shown after ticket purchase — replaces the buy form #}
|
{# Shown after ticket purchase — replaces the buy form #}
|
||||||
{# OOB: refresh cart badge to reflect new ticket count #}
|
{# OOB: refresh cart badge to reflect new ticket count #}
|
||||||
{% from '_types/cart/_mini.html' import mini with context %}
|
{% from 'macros/cart_icon.html' import cart_icon %}
|
||||||
{{ mini(oob='true') }}
|
{{ cart_icon(count=cart_count|default(0), oob='true') }}
|
||||||
|
|
||||||
<div id="ticket-buy-{{ entry.id }}" class="rounded-xl border border-emerald-200 bg-emerald-50 p-4">
|
<div id="ticket-buy-{{ entry.id }}" class="rounded-xl border border-emerald-200 bg-emerald-50 p-4">
|
||||||
<div class="flex items-center gap-2 mb-3">
|
<div class="flex items-center gap-2 mb-3">
|
||||||
|
|||||||
Reference in New Issue
Block a user