masonry - on topics too #106

This commit is contained in:
rimu 2024-04-24 19:41:12 +12:00
parent 4f79d3a349
commit 5c1da0a0be

View file

@ -29,13 +29,20 @@
{% endif %} {% endif %}
{% include "community/_community_nav.html" %} {% include "community/_community_nav.html" %}
{% if post_layout == 'masonry' or post_layout == 'masonry_wide' %} {% if post_layout == 'masonry' or post_layout == 'masonry_wide' %}
<div class="post_list_{{ post_layout }}"> <div class="masonry" id="masonry">
{% for post in posts.items %} <!-- Masonry columns will be added here -->
{% include 'post/_post_teaser_masonry.html' %}
{% else %}
<p>{{ _('No posts in this topic yet.') }}</p>
{% endfor %}
</div> </div>
<script nonce="{{ session['nonce'] }}">
document.addEventListener("DOMContentLoaded", function() {
const masonry = document.getElementById('masonry');
const htmlSnippets = [
{% for post in posts.items %}
{% raw %}`{% endraw %}{% include 'post/_post_teaser_masonry.html' %}{% raw %}`{% endraw %},
{% endfor %}
];
renderMasonry(masonry, htmlSnippets);
});
</script>
{% else %} {% else %}
<div class="post_list"> <div class="post_list">
{% for post in posts.items %} {% for post in posts.items %}