From 0aa9dda90a00d60d177b8e7cb4802b62399a56fb Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 29 Oct 2024 09:53:36 +0100 Subject: [PATCH] Cross-selling: Use different label if there are no add-on products (#4577) * Cross-selling: Use different label if there are no add-on products * Update src/pretix/presale/templates/pretixpresale/event/checkout_addons.html Co-authored-by: Richard Schreiber * Fix a11y problem * Fix headline order --------- Co-authored-by: Richard Schreiber --- .../pretixpresale/event/checkout_addons.html | 29 ++++++++++++++----- .../event/fragment_product_list.html | 12 ++++---- .../static/pretixpresale/scss/_checkout.scss | 7 +++-- .../static/pretixpresale/scss/_event.scss | 4 +-- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html b/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html index 57ab3d045..4cd1e54d9 100644 --- a/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html +++ b/src/pretix/presale/templates/pretixpresale/event/checkout_addons.html @@ -57,16 +57,29 @@ {% if cross_selling_data %} -
- -

- {% trans "More recommendations" %} -

-
+ {% if forms %} +
+ +

+ {% trans "More recommendations" %} +

+
+ {% else %} +
+
+

+ {% trans "Our recommendations" %} +

+
+ {% endif %}
- {% include "pretixpresale/event/fragment_product_list.html" with items_by_category=cross_selling_data ev=event %} + {% include "pretixpresale/event/fragment_product_list.html" with items_by_category=cross_selling_data ev=event headline_level=4 %}
-
+ {% if forms %} +
+ {% else %} + + {% endif %} {% endif %}
diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html index 750d8c678..e6a947354 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html @@ -8,7 +8,7 @@ {% for tup in items_by_category %}{% with category=tup.0 items=tup.1 form_prefix=tup.2 %} {% if category %}
-

{{ category.name }} + {{ category.name }} {% if category.subevent_name %} {{ category.subevent_name }} {% endif %} @@ -19,13 +19,13 @@ {% trans "Your order qualifies for a discount" %} {% endif %} -

+ {% if category.description %}
{{ category.description|localize|rich_text }}
{% endif %} {% else %}
-

{% trans "Uncategorized items" %}

+ {% trans "Uncategorized items" %} {% endif %} {% for item in items %} {% if item.has_variations %} @@ -43,7 +43,7 @@ {% endif %}
-

{{ item.name }}

+ {{ item.name }} {% if item.description %}
{{ item.description|localize|rich_text }} @@ -117,7 +117,7 @@ data-price="{% if event.settings.display_net_prices %}{{ var.display_price.net|unlocalize }}{% else %}{{ var.display_price.gross|unlocalize }}{% endif %}" {% endif %}>
-
{{ var }}
+ {{ var }} {% if var.description %}
{{ var.description|localize|rich_text }} @@ -261,7 +261,7 @@ {% endif %}
-

{{ item.name }}

+ {{ item.name }} {% if item.description %}
{{ item.description|localize|rich_text }} diff --git a/src/pretix/static/pretixpresale/scss/_checkout.scss b/src/pretix/static/pretixpresale/scss/_checkout.scss index b0cd8a0fa..ebd909cc2 100644 --- a/src/pretix/static/pretixpresale/scss/_checkout.scss +++ b/src/pretix/static/pretixpresale/scss/_checkout.scss @@ -102,15 +102,16 @@ } } } -.cross-selling .panel-body h3 { +.cross-selling .panel-body h3, .cross-selling .panel-body .h3 { font-size: 21px; line-height: inherit; margin-top: 20px; } -.cross-selling .panel-body > *:first-child > h3:first-child { +.cross-selling .panel-body > *:first-child > h3:first-child, +.cross-selling .panel-body > *:first-child > .h3:first-child { margin-top: 0; } -.cross-selling .panel-body h3 small { +.cross-selling .panel-body h3 small, .cross-selling .panel-body .h3 small { padding-left: 20px; } diff --git a/src/pretix/static/pretixpresale/scss/_event.scss b/src/pretix/static/pretixpresale/scss/_event.scss index 2710a941d..a56294e2d 100644 --- a/src/pretix/static/pretixpresale/scss/_event.scss +++ b/src/pretix/static/pretixpresale/scss/_event.scss @@ -53,7 +53,7 @@ &.variation label { font-weight: normal; } - h4 { + h4, .h4 { font-size: inherit; margin: 0; line-height: inherit; @@ -62,7 +62,7 @@ font-weight: bold; } } - h5 { + h5, .h5 { font-size: inherit; font-weight: inherit; margin: 0;