From d97a0b19418f48a9fb2d31d3b666f6a4fe761a78 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 24 Jul 2019 15:12:46 +0200 Subject: [PATCH] Consistent display of price ranges --- .../pretixpresale/event/fragment_product_list.html | 6 +++++- src/pretix/static/pretixpresale/js/widget/widget.js | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) 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 62b6527551..2b0780b545 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html @@ -50,7 +50,11 @@
- {% if item.min_price != item.max_price or item.free_price %} + {% if item.free_price %} + {% blocktrans trimmed with price=item.min_price|money:event.currency %} + from {{ price }} + {% endblocktrans %} + {% elif item.min_price != item.max_price %} {{ item.min_price|money:event.currency }} – {{ item.max_price|money:event.currency }} {% elif not item.min_price and not item.max_price %} {% trans "FREE" context "price" %} diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index b46ea768f1..b7fdbdebeb 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -421,11 +421,14 @@ Vue.component('item', { return this.item.has_variations && !this.$root.show_variations_expanded; }, pricerange: function () { - if (this.item.min_price !== this.item.max_price || this.item.free_price) { + if (this.item.free_price) { return django.interpolate(strings.price_from, { 'currency': this.$root.currency, 'price': floatformat(this.item.min_price, 2) }, true); + } else if (this.item.min_price !== this.item.max_price) { + return this.$root.currency + " " + floatformat(this.item.min_price, 2) + " – " + + floatformat(this.item.max_price, 2); } else if (this.item.min_price === "0.00" && this.item.max_price === "0.00") { return strings.free; } else {