From 1a9f6e49d4465350c65f80c0a8b8fb06c5377563 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Wed, 22 May 2019 09:48:07 +0200 Subject: [PATCH] Refactor product list into own template --- .../event/fragment_product_list.html | 282 ++++++++++++++++++ .../templates/pretixpresale/event/index.html | 276 +---------------- 2 files changed, 283 insertions(+), 275 deletions(-) create mode 100644 src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html new file mode 100644 index 000000000..c440ce4fc --- /dev/null +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_product_list.html @@ -0,0 +1,282 @@ +{% load i18n %} +{% load l10n %} +{% load eventurl %} +{% load money %} +{% load thumb %} +{% load eventsignal %} +{% load rich_text %} +{% for tup in items_by_category %} +
+ {% if tup.0 %} +

{{ tup.0.name }}

+ {% if tup.0.description %} +

{{ tup.0.description|localize|rich_text }}

+ {% endif %} + {% endif %} + {% for item in tup.1 %} + {% if item.has_variations %} +
+ +
+ {% if item.picture %} + + {{ item.name }} + + {% endif %} +
+

+ + {{ item.name }} + +

+ {% if item.description %} +
+ {{ item.description|localize|rich_text }} +
+ {% endif %} + {% if item.min_per_order and item.min_per_order > 1 %} +

+ + {% blocktrans trimmed with num=item.min_per_order %} + minimum amount to order: {{ num }} + {% endblocktrans %} + +

+ {% endif %} +
+
+
+ {% if item.min_price != item.max_price or item.free_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" %} + {% else %} + {{ item.min_price|money:event.currency }} + {% endif %} +
+
+ {% if not event.settings.show_variations_expanded %} + + {% trans "Show variants" %} + + {% endif %} +
+
+
+
+ {% for var in item.available_variations %} +
+
+
+ +
+ {% if var.description %} +
+ {{ var.description|localize|rich_text }} +
+ {% endif %} + {% if event.settings.show_quota_left %} + {% include "pretixpresale/event/fragment_quota_left.html" with avail=var.cached_availability %} + {% endif %} +
+
+ {% if var.original_price %} + {% if event.settings.display_net_prices %} + {{ var.original_price.net|money:event.currency }} + {% else %} + {{ var.original_price.gross|money:event.currency }} + {% endif %} + + {% endif %} + {% if item.free_price %} +
+ {{ event.currency }} + +
+ {% elif not var.display_price.gross %} + {% trans "FREE" context "price" %} + {% elif event.settings.display_net_prices %} + {{ var.display_price.net|money:event.currency }} + {% else %} + {{ var.display_price.gross|money:event.currency }} + {% endif %} + {% if item.original_price or var.original_price %} +
+ {% endif %} + {% if item.includes_mixed_tax_rate %} + {% if event.settings.display_net_prices %} + {% trans "plus taxes" %} + {% else %} + {% trans "incl. taxes" %} + {% endif %} + {% elif var.display_price.rate and var.display_price.gross and event.settings.display_net_prices %} + {% blocktrans trimmed with rate=var.display_price.rate|floatformat:-2 name=var.display_price.name %} + plus {{ rate }}% {{ name }} + {% endblocktrans %} + {% elif var.display_price.rate and var.display_price.gross %} + {% blocktrans trimmed with rate=var.display_price.rate|floatformat:-2 name=var.display_price.name %} + incl. {{ rate }}% {{ name }} + {% endblocktrans %} + {% endif %} +
+ {% if item.require_voucher %} +
+ + {% trans "Enter a voucher code below to buy this ticket." %} + +
+ {% elif var.cached_availability.0 == 100 %} +
+ {% if item.max_per_order == 1 %} + + {% else %} + + {% endif %} +
+ {% else %} + {% include "pretixpresale/event/fragment_availability.html" with avail=var.cached_availability.0 event=event item=item var=var %} + {% endif %} +
+
+ {% endfor %} +
+
+ {% else %} +
+
+ {% if item.picture %} + + {{ item.name }} + + {% endif %} +
+

+ +

+ {% if item.description %} +
+ {{ item.description|localize|rich_text }} +
+ {% endif %} + {% if event.settings.show_quota_left %} + {% include "pretixpresale/event/fragment_quota_left.html" with avail=item.cached_availability %} + {% endif %} + {% if item.min_per_order and item.min_per_order > 1 %} +

+ + {% blocktrans trimmed with num=item.min_per_order %} + minimum amount to order: {{ num }} + {% endblocktrans %} + +

+ {% endif %} +
+
+
+ {% if item.original_price %} + {% if event.settings.display_net_prices %} + {{ item.original_price.net|money:event.currency }} + {% else %} + {{ item.original_price.gross|money:event.currency }} + {% endif %} + + {% endif %} + {% if item.free_price %} +
+ {{ event.currency }} + +
+ {% elif not item.display_price.gross %} + {% trans "FREE" context "price" %} + {% elif event.settings.display_net_prices %} + {{ item.display_price.net|money:event.currency }} + {% else %} + {{ item.display_price.gross|money:event.currency }} + {% endif %} + {% if item.original_price %} +
+ {% endif %} + {% if item.includes_mixed_tax_rate %} + {% if event.settings.display_net_prices %} + {% trans "plus taxes" %} + {% else %} + {% trans "incl. taxes" %} + {% endif %} + {% elif item.display_price.rate and item.display_price.gross and event.settings.display_net_prices %} + {% blocktrans trimmed with rate=item.display_price.rate|floatformat:-2 name=item.display_price.name %} + plus {{ rate }}% {{ name }} + {% endblocktrans %} + {% elif item.display_price.rate and item.display_price.gross %} + {% blocktrans trimmed with rate=item.display_price.rate|floatformat:-2 name=item.display_price.name %} + incl. {{ rate }}% {{ name }} + {% endblocktrans %} + {% endif %} +
+ {% if item.require_voucher %} +
+ + {% trans "Enter a voucher code below to buy this ticket." %} + +
+ {% elif item.cached_availability.0 == 100 %} +
+ {% if item.max_per_order == 1 %} + + {% else %} + + {% endif %} +
+ {% else %} + {% include "pretixpresale/event/fragment_availability.html" with avail=item.cached_availability.0 event=event item=item var=0 %} + {% endif %} +
+
+ {% endif %} + {% endfor %} +
+{% endfor %} diff --git a/src/pretix/presale/templates/pretixpresale/event/index.html b/src/pretix/presale/templates/pretixpresale/event/index.html index 1aa3bc8d1..96e3ce29a 100644 --- a/src/pretix/presale/templates/pretixpresale/event/index.html +++ b/src/pretix/presale/templates/pretixpresale/event/index.html @@ -203,281 +203,7 @@ action="{% eventurl request.event "presale:event.cart.add" cart_namespace=cart_namespace %}?next={{ cart_redirect|urlencode }}"> {% csrf_token %} - {% for tup in items_by_category %} -
- {% if tup.0 %} -

{{ tup.0.name }}

- {% if tup.0.description %} -

{{ tup.0.description|localize|rich_text }}

- {% endif %} - {% endif %} - {% for item in tup.1 %} - {% if item.has_variations %} -
- -
- {% if item.picture %} - - {{ item.name }} - - {% endif %} -
-

- - {{ item.name }} - -

- {% if item.description %} -
- {{ item.description|localize|rich_text }} -
- {% endif %} - {% if item.min_per_order and item.min_per_order > 1 %} -

- - {% blocktrans trimmed with num=item.min_per_order %} - minimum amount to order: {{ num }} - {% endblocktrans %} - -

- {% endif %} -
-
-
- {% if item.min_price != item.max_price or item.free_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" %} - {% else %} - {{ item.min_price|money:event.currency }} - {% endif %} -
-
- {% if not event.settings.show_variations_expanded %} - - {% trans "Show variants" %} - - {% endif %} -
-
-
-
- {% for var in item.available_variations %} -
-
-
- -
- {% if var.description %} -
- {{ var.description|localize|rich_text }} -
- {% endif %} - {% if event.settings.show_quota_left %} - {% include "pretixpresale/event/fragment_quota_left.html" with avail=var.cached_availability %} - {% endif %} -
-
- {% if var.original_price %} - {% if event.settings.display_net_prices %} - {{ var.original_price.net|money:event.currency }} - {% else %} - {{ var.original_price.gross|money:event.currency }} - {% endif %} - - {% endif %} - {% if item.free_price %} -
- {{ event.currency }} - -
- {% elif not var.display_price.gross %} - {% trans "FREE" context "price" %} - {% elif event.settings.display_net_prices %} - {{ var.display_price.net|money:event.currency }} - {% else %} - {{ var.display_price.gross|money:event.currency }} - {% endif %} - {% if item.original_price or var.original_price %} -
- {% endif %} - {% if item.includes_mixed_tax_rate %} - {% if event.settings.display_net_prices %} - {% trans "plus taxes" %} - {% else %} - {% trans "incl. taxes" %} - {% endif %} - {% elif var.display_price.rate and var.display_price.gross and event.settings.display_net_prices %} - {% blocktrans trimmed with rate=var.display_price.rate|floatformat:-2 name=var.display_price.name %} - plus {{ rate }}% {{ name }} - {% endblocktrans %} - {% elif var.display_price.rate and var.display_price.gross %} - {% blocktrans trimmed with rate=var.display_price.rate|floatformat:-2 name=var.display_price.name %} - incl. {{ rate }}% {{ name }} - {% endblocktrans %} - {% endif %} -
- {% if item.require_voucher %} -
- - {% trans "Enter a voucher code below to buy this ticket." %} - -
- {% elif var.cached_availability.0 == 100 %} -
- {% if item.max_per_order == 1 %} - - {% else %} - - {% endif %} -
- {% else %} - {% include "pretixpresale/event/fragment_availability.html" with avail=var.cached_availability.0 event=event item=item var=var %} - {% endif %} -
-
- {% endfor %} -
-
- {% else %} -
-
- {% if item.picture %} - - {{ item.name }} - - {% endif %} -
-

- -

- {% if item.description %} -
- {{ item.description|localize|rich_text }} -
- {% endif %} - {% if event.settings.show_quota_left %} - {% include "pretixpresale/event/fragment_quota_left.html" with avail=item.cached_availability %} - {% endif %} - {% if item.min_per_order and item.min_per_order > 1 %} -

- - {% blocktrans trimmed with num=item.min_per_order %} - minimum amount to order: {{ num }} - {% endblocktrans %} - -

- {% endif %} -
-
-
- {% if item.original_price %} - {% if event.settings.display_net_prices %} - {{ item.original_price.net|money:event.currency }} - {% else %} - {{ item.original_price.gross|money:event.currency }} - {% endif %} - - {% endif %} - {% if item.free_price %} -
- {{ event.currency }} - -
- {% elif not item.display_price.gross %} - {% trans "FREE" context "price" %} - {% elif event.settings.display_net_prices %} - {{ item.display_price.net|money:event.currency }} - {% else %} - {{ item.display_price.gross|money:event.currency }} - {% endif %} - {% if item.original_price %} -
- {% endif %} - {% if item.includes_mixed_tax_rate %} - {% if event.settings.display_net_prices %} - {% trans "plus taxes" %} - {% else %} - {% trans "incl. taxes" %} - {% endif %} - {% elif item.display_price.rate and item.display_price.gross and event.settings.display_net_prices %} - {% blocktrans trimmed with rate=item.display_price.rate|floatformat:-2 name=item.display_price.name %} - plus {{ rate }}% {{ name }} - {% endblocktrans %} - {% elif item.display_price.rate and item.display_price.gross %} - {% blocktrans trimmed with rate=item.display_price.rate|floatformat:-2 name=item.display_price.name %} - incl. {{ rate }}% {{ name }} - {% endblocktrans %} - {% endif %} -
- {% if item.require_voucher %} -
- - {% trans "Enter a voucher code below to buy this ticket." %} - -
- {% elif item.cached_availability.0 == 100 %} -
- {% if item.max_per_order == 1 %} - - {% else %} - - {% endif %} -
- {% else %} - {% include "pretixpresale/event/fragment_availability.html" with avail=item.cached_availability.0 event=event item=item var=0 %} - {% endif %} -
-
- {% endif %} - {% endfor %} -
- {% endfor %} + {% include "pretixpresale/event/fragment_product_list.html" %} {% if ev.presale_is_running and display_add_to_cart %}