Commit 888dc99f authored by gijs's avatar gijs
Browse files

Better display of tags and produsers on items.

parent fe78900b
......@@ -25,18 +25,7 @@
{{ event.location }}<br />
{% endif %}
</p>
{% if event.participant or event.produser %}
<h4>Participants</h4>
<p>
{% for produser in event.produser.targets %}
<a href="{{ produser.link }}" class="produser">{{ produser }}</a>
{% endfor %}
{% for produser in event.produser.targets %}
<a href="{{ produser.link }}" class="produser">
{{ produser }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</p>
{% endif %}
{% with item=event %}{% include "snippets/metadata.html" %}{% endwith %}
</section>
{{ event.summary }}
{{ event.content }}
......@@ -79,21 +68,9 @@
{% endfor %}
</ul>
{% endif %}
{% with item=item %}{% include "snippets/metadata.html" %}{% endwith %}
</li>
{% endfor %}
{% if item.participant or item.produser %}
<h4>Participants</h4>
<p>
{% for produser in item.participant %}
<a href="{{ produser.link }}" class="produser">
{{ produser }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
{% for produser in item.participant %}
<a href="{{ produser.link }}" class="produser">
{{ produser }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</p>
{% endif %}
{% endfor %}
</ul>
{% endblock %}
\ No newline at end of file
......@@ -29,18 +29,7 @@
{% endfor %}
{% endif %}
</p>
{% if event.participant or event.produser %}
<h4>Participants</h4>
<p>
{% for produser in event.produser.targets %}
<a href="{{ produser.link }}" class="produser">{{ produser }}</a>
{% endfor %}
{% for produser in event.produser.targets %}
<a href="{{ produser.link }}" class="produser">
{{ produser }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</p>
{% endif %}
{% with item=event %}{% include "snippets/metadata.html" %}{% endwith %}
</section>
{{ event.summary }}
{{ event.content }}
......
......@@ -2,6 +2,10 @@
{% block title %}Caveat → events → {{ event.title|striptags }}{% endblock %}
{% if page.image %}
{% block sidebar_image %}{{ page.image }}{% endblock %}
{% endif %}
{% block content %}
<section class="long-text">
<h1>{{ page.title }}</h1>
......
{% if item.tags and item.tags.targets %}
{% load generator_utils %}
{% combine_linkfields item.produser item.participant as produser_combined %}
{% if item.tags and item.tags|without_inline_links %}
<section class="item--metadata item--tags">
<h4>Tags</h4>
<ul class="inlinelist">
{% for tag in item.tags.targets %}
{% for tag in item.tags|without_inline_links|link_target_iterator %}
<li><a href="{{ tag.link }}" class="tag">{{ tag }}</a></li>
{% endfor %}
</ul>
</section>
{% endif %}
{% if item.produser and item.produser.targets %}
<section class="item--produsers item--metadata ">
{% if produser_combined %}
<section class="item--produsers item--metadata">
<h4>Produsers</h4>
<ul class="inlinelist">
{% for produser in item.produser.targets %}
{% for produser in produser_combined|link_target_iterator %}
<li><a class="produser" href="{{ produser.link }}">{{ produser }}</a></li>
{% endfor %}
{% if item.participant %}
{% for participant in item.participant.targets %}
<li><a class="produser" href="{{ participant.link }}">{{ participant }}</a></li>
{% endfor %}
{% endif %}
</ul>
</section>
{% endif %}
\ No newline at end of file
......@@ -861,7 +861,6 @@ div.footnote > ol > li {
}
sup:target,
.footnote :target:marker,
.footnote :target::marker {
color: var(--orange-karel);
}
......
......@@ -3,6 +3,11 @@
{% block title %}
Caveat → {{ tag.tag|striptags }}
{% endblock %}
{% if tag.image %}
{% block sidebar_image %}{{ tag.image }}{% endblock %}
{% endif %}
{% block content %}
<nav class="breadcrumbs">
<ul>
......
......@@ -30,4 +30,24 @@ def link_target_iterator (field):
def cut_from_start (value, arg):
print(value)
print('should be removed', arg)
return re.sub('^' + str(arg), '', re.I)
\ No newline at end of file
return re.sub('^' + str(arg), '', re.I)
@register.filter
def without_inline_links (field):
return list(filter(lambda l: not l.inline, field))
@register.simple_tag
def combine_linkfields (*fields):
combined = []
targets = []
for field in fields:
if field:
for link in field:
if link.target not in targets:
combined.append(link)
targets.append(link.target)
return combined
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment