From 479d50a4c39d97329467d8ce7ba8fe8ac929f65c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 22 May 2019 16:03:07 +0200 Subject: Find basket window: display related treatments files --- .../blocks/window_field_flex_detail_multiple.html | 8 ++++++++ .../window_field_flex_detail_multiple_full.html | 9 +++++++++ ishtar_common/templatetags/window_field.py | 23 ++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple.html create mode 100644 ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple_full.html (limited to 'ishtar_common') diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple.html new file mode 100644 index 000000000..b6faa0cc1 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple.html @@ -0,0 +1,8 @@ +{% load i18n %}{% if data %} +
+
{% trans caption %}
+
{% for d in data %} + {% if forloop.counter0 %} ; {% endif %}{{d.link}} {{ d.item }} + {% endfor %}
+
+{% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple_full.html b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple_full.html new file mode 100644 index 000000000..12ab9d524 --- /dev/null +++ b/ishtar_common/templates/ishtar/blocks/window_field_flex_detail_multiple_full.html @@ -0,0 +1,9 @@ +{% load i18n %}{% if data %} +
+
{% trans caption %}
+
{% for d in data %} + {% if forloop.counter0 %} ; {% endif %}{{d.link}} {{ d.item }} + {% endfor %}
+
+{% endif %} + diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py index 051540a19..7aaf62397 100644 --- a/ishtar_common/templatetags/window_field.py +++ b/ishtar_common/templatetags/window_field.py @@ -175,6 +175,29 @@ def field_flex_detail_full(context, caption, item, small=False): return field_detail(context, caption, item, size=size) +@register.inclusion_tag('ishtar/blocks/window_field_flex_detail_multiple.html', + takes_context=True) +def field_flex_detail_multiple(context, caption, items, small=False, size=None): + if small: + size = 2 + data = [] + if hasattr(items, "all"): + items = items.distinct().all() + for item in items: + link = link_to_window(item, context) + data.append({"item": item, "link": link}) + dct = {'caption': caption, 'data': data, "size": size} + return dct + + +@register.inclusion_tag( + 'ishtar/blocks/window_field_flex_detail_multiple_full.html', + takes_context=True) +def field_flex_detail_multiple_full(context, caption, items): + size = "full" + return field_flex_detail_multiple(context, caption, items, size=size) + + @register.filter def m2m_listing(item, key): return item.m2m_listing(key) -- cgit v1.2.3