Hello again!
I’ve worked on a guest list lately. I came up with this:
{# @contributors/podcast-contributor-list.twig #}
<table class="podlove-global-contributors">
{% if option.title %}
<thead>
<tr>
<th colspan="2">{{ option.title }}</th>
</tr>
</thead>
{% endif %}
<tbody>
{% for contributor in podcast.contributors({role: "Gast"}) %}
{% if contributor.visible %}
<tr>
<td rowspan="2" class="avatar-cell" width="60">
{{ contributor.image.html({width: 60, height: 60, class: "avatar avatar-" ~ size ~ " photo", alt: "avatar" }) }}
</td>
<td class="social-cell">
<strong class="contributor-name" style="font-family: sans-serif;">{{ contributor.name }}</strong>
<div class="social-icons">
{% for service in contributor.socialServices %}
<a target="_blank" title="{{ service.title }}" href="{{ service.profileUrl }}">
{{
service.image.html({
width: 32,
class: "podlove-contributor-button",
alt: service.title ~ " Icon"
})
}}
</a>
{% endfor %}
</div>
</td>
</tr>
<tr class="episode-row">
<td class="episodes-cell" style="font-family: sans-serif;">
<ul>
{% for episode in contributor.episodes %}
<li>
<a href="{{ episode.url }}">{{ episode.title }}</a>
</li>
{% endfor %}
</ul>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<script type="text/javascript">
(function ($) {
$(document).ready(function() {
$(".podlove-global-contributors .episodes-cell").each(function() {
var items = $("li", this);
if (items.length > 3) {
$("li:gt(2)", this).hide();
$('<span class="show-all-episodes" style="font-size: 85%;"><a href="#">… alle anzeigen</a><span>').insertAfter($("ul", this));
}
});
$(".podlove-global-contributors").on("click", ".show-all-episodes a", function(e) {
e.preventDefault();
$(this).closest(".episodes-cell")
.find("li").show().end()
.find(".show-all-episodes").hide();
});
});
}(jQuery));
</script>
<style type="text/css">
.podlove-global-contributors td {
vertical-align: top;
line-height: 1.3em;
}
.podlove-global-contributors .avatar-cell {
max-width: 100px;
text-align: center;
}
.podlove-global-contributors td {
border-top-width: 0px;
}
.podlove-global-contributors .episode-row {
/*margin-bottom: 10px;*/
}
.podlove-global-contributors td ul {
margin: 0;
}
.podlove-global-contributors .social-cell li {
margin: 0;
}
.podlove-global-contributors .social-cell {
border-bottom-width: 0px;
}
.podlove-global-contributors .episodes-cell {
padding-top: 0px;
}
.podlove-global-contributors .episodes-cell li {
display: inline-block;
margin: 0;
}
.podlove-global-contributors .episodes-cell li a {
background: #eee;
padding: 2px 10px;
line-height: 170%;
border-radius: 10px;
}
</style>
Feel free to copy and improve. Most of it is taken from here. I’m a total noob when it comes to coding. Therefore I’m sure people will be able to make this better.
I only have one problem with that list: The list will not be fully alphabetical. Two of my guests (one named exe
, the other named moep0r
) will appear at the bottom of the list.
Why?