diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-05 11:39:14 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-05 11:39:14 +0200 |
commit | 0a5e73b2e889b5ff057cebe01990859b0d933a3a (patch) | |
tree | 29447abfbe714d04b1d616f3af64a508cb3f8e30 /ishtar_common | |
parent | 2c721d268fa474f2efe838b6ec111bae1b64e20b (diff) | |
download | Ishtar-0a5e73b2e889b5ff057cebe01990859b0d933a3a.tar.bz2 Ishtar-0a5e73b2e889b5ff057cebe01990859b0d933a3a.zip |
Source sheet: author link to persons (refs #3180)
Diffstat (limited to 'ishtar_common')
4 files changed, 18 insertions, 3 deletions
diff --git a/ishtar_common/templates/ishtar/blocks/window_field_multiple.html b/ishtar_common/templates/ishtar/blocks/window_field_multiple.html index d1ee25c7b..cc817490c 100644 --- a/ishtar_common/templates/ishtar/blocks/window_field_multiple.html +++ b/ishtar_common/templates/ishtar/blocks/window_field_multiple.html @@ -1,6 +1,6 @@ {% load i18n %}{% if data.count %}{% if li %}<li>{% else %}<p>{% endif %}<label>{% trans caption %}{% trans ":"%}</label> <span class='value'>{% for d in data.all %} - {% if forloop.counter0 %}, {% endif %}{{ d }} + {% if forloop.counter0 %} ; {% endif %}{{ d }} {% endfor %}</span> {% if li %}</li>{% else %}</p>{% endif %} {% endif %} diff --git a/ishtar_common/templates/ishtar/blocks/window_field_url.html b/ishtar_common/templates/ishtar/blocks/window_field_url.html index 637366d1d..d63ebdca9 100644 --- a/ishtar_common/templates/ishtar/blocks/window_field_url.html +++ b/ishtar_common/templates/ishtar/blocks/window_field_url.html @@ -1,3 +1,3 @@ {% load i18n %}{% if link %}{% if li %}<li>{% else %}<p>{% endif %}<p><label>{% trans caption %}{% trans ":"%}</label> -<span class='value'><a target="_blank" href='{{link|safe}}'>{% if link_name %}{{link_name}}{% else %}{% trans "link" %}{% endif %}</a></span>{% if li %}</li>{% else %}</p>{% endif %} +<span class='value'><a target="_blank" href='{{link|safe}}'>{% if link_name %}{{link_name}}{% else %}{{link}}{% endif %}</a></span>{% if li %}</li>{% else %}</p>{% endif %} {% endif%} diff --git a/ishtar_common/templates/ishtar/sheet_source.html b/ishtar_common/templates/ishtar/sheet_source.html index 653087753..7d291f37f 100644 --- a/ishtar_common/templates/ishtar/sheet_source.html +++ b/ishtar_common/templates/ishtar/sheet_source.html @@ -10,7 +10,7 @@ {% field "Format type" item.format_type %} {% field "Scale" item.scale %} {% field_url "Web link" item.associated_url %} -{% field_multiple "Authors" item.authors %} +{% field "Authors" item.authors|add_links:'person' %} {% field "Item number" item.item_number %} {% field "Ref." item.reference %} {% field "Internal ref." item.internal_reference %} diff --git a/ishtar_common/templatetags/link_to_window.py b/ishtar_common/templatetags/link_to_window.py index 79666eba8..288bfcd8a 100644 --- a/ishtar_common/templatetags/link_to_window.py +++ b/ishtar_common/templatetags/link_to_window.py @@ -34,6 +34,21 @@ def link_to_modify(item): return reverse(item.MODIFY_URL, args=[item.pk]) +@register.filter +def add_links(items, extra_attr=''): + html = [] + if hasattr(items, 'all'): + items = list(items.all()) + if not items: + return [] + for item in items: + item_lnk = item + if extra_attr: + item_lnk = getattr(item, extra_attr) + html.append(u"{} {}".format(unicode(item), link_to_window(item_lnk))) + return mark_safe(u" ; ".join(html)) + + @register.inclusion_tag('ishtar/blocks/modify_toolbar.html', takes_context=True) def modify_toolbar(context, item, action): |