diff options
4 files changed, 42 insertions, 0 deletions
| diff --git a/archaeological_finds/templates/ishtar/sheet_findbasket.html b/archaeological_finds/templates/ishtar/sheet_findbasket.html index 4a101d8f2..52b53df2a 100644 --- a/archaeological_finds/templates/ishtar/sheet_findbasket.html +++ b/archaeological_finds/templates/ishtar/sheet_findbasket.html @@ -15,6 +15,8 @@      {% field_flex "Comment" item.comment %}      {% field_flex_multiple_full "Shared (read) with" item.shared_with %}      {% field_flex_multiple_full "Shared (read/edit) with" item.shared_write_with %} +    {% trans "Associated treatment files" as treatment_label %} +    {% field_flex_detail_multiple_full treatment_label item.treatment_files %}  </div>  <h3>{% trans "Content" %}</h3> 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 %} +<dl class="col-12 {% if size == 2 %}col-lg-6{% else %}col-md-6 col-lg-3{% endif %} flex-wrap"> +    <dt>{% trans caption %}</dt> +    <dd>{% for d in data %} +        {% if forloop.counter0 %} ; {% endif %}{{d.link}} {{ d.item }} +    {% endfor %}</dd> +</dl> +{% 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 %} +<dl class="col-12"> +    <dt>{% trans caption %}</dt> +    <dd>{% for d in data %} +        {% if forloop.counter0 %} ; {% endif %}{{d.link}} {{ d.item }} +        {% endfor %}</dd> +</dl> +{% 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) | 
