From 6c52cc81572564022379a3147fdc901218817b4f Mon Sep 17 00:00:00 2001 From: Mira Date: Fri, 11 Oct 2024 11:11:08 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Richard Schreiber --- doc/api/resources/categories.rst | 3 ++- src/pretix/base/models/items.py | 2 +- src/pretix/base/services/cart.py | 1 + src/pretix/control/forms/item.py | 2 +- src/pretix/static/pretixcontrol/scss/_forms.scss | 8 ++++++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/api/resources/categories.rst b/doc/api/resources/categories.rst index 87ff1d831c..715907698e 100644 --- a/doc/api/resources/categories.rst +++ b/doc/api/resources/categories.rst @@ -28,10 +28,11 @@ cross_selling_mode string If ``null``, cr step. If ``"both"``, it is visible on the normal index page as well. + Only available if ``is_addon`` is ``false``. cross_selling_condition string Only relevant if ``cross_selling_mode`` is not ``null``. If ``"always"``, always show in cross-selling step. If ``"products"``, only show if the cart contains one of - these products. + the products listed in ``cross_selling_match_products``. If ``"discounts"``, only show products that qualify for a discount according to discount rules. cross_selling_match_products list of integer Only relevant if ``cross_selling_condition`` is diff --git a/src/pretix/base/models/items.py b/src/pretix/base/models/items.py index e871dbba43..402e5e9268 100644 --- a/src/pretix/base/models/items.py +++ b/src/pretix/base/models/items.py @@ -122,8 +122,8 @@ class ItemCategory(LoggedModel): ) CROSS_SELLING_CONDITION = ( ('always', _('Always show in cross-selling step')), - ('products', _('Only if the cart contains one of these products')), ('discounts', _('Only show products that qualify for a discount according to discount rules')), + ('products', _('Only show if the cart contains one of the following products')), ) cross_selling_condition = models.CharField( verbose_name=_("Cross-selling condition"), diff --git a/src/pretix/base/services/cart.py b/src/pretix/base/services/cart.py index 4e87c134cb..3e8e5aada5 100644 --- a/src/pretix/base/services/cart.py +++ b/src/pretix/base/services/cart.py @@ -1617,6 +1617,7 @@ def set_cart_addons(self, event: Event, addons: List[dict], add_to_cart_items: L ensure the requested addon state. :param event: The event ID in question :param addons: A list of dicts with the keys addon_to, item, variation + :param add_to_cart_items: A list of dicts with the keys item, variation, count, custom_price, voucher, seat ID :param cart_id: The cart ID of the cart to modify """ with language(locale), time_machine_now_assigned(override_now_dt): diff --git a/src/pretix/control/forms/item.py b/src/pretix/control/forms/item.py index ce8dc9f7fc..2223475d87 100644 --- a/src/pretix/control/forms/item.py +++ b/src/pretix/control/forms/item.py @@ -102,7 +102,7 @@ class CategoryForm(I18nModelForm): _('Cross-selling category'), _('Products in this category are regular products, but are only shown ' 'in the cross-selling step, according to the configuration below.'))),), ('both', mark_safe('{}   {}'.format( - _('Combined category'), _('Products in this category are regular products displayed on the front page, ' + _('Normal + cross-selling category'), _('Products in this category are regular products displayed on the front page, ' 'but are additionally shown in the cross-selling step, according to the configuration below.'))),), )) self.fields['category_type'].initial = self.instance.category_type diff --git a/src/pretix/static/pretixcontrol/scss/_forms.scss b/src/pretix/static/pretixcontrol/scss/_forms.scss index ad628cca0f..fbe1e1de26 100644 --- a/src/pretix/static/pretixcontrol/scss/_forms.scss +++ b/src/pretix/static/pretixcontrol/scss/_forms.scss @@ -588,8 +588,16 @@ table td > .checkbox input[type="checkbox"] { border-bottom: 1px solid #ccc; } } +.form-horizontal .control-label:has(+.big-radio-wrapper), +.form-horizontal .control-label:has(+div > .big-radio) { + padding-top: 16px; +} +.form-horizontal .big-radio-wrapper .radio label { + font-weight: bold; +} .form-horizontal .big-radio-wrapper .radio label > span { display: block; + font-weight: normal; } .accordion-radio { display: block;