{% extends "1-col-sidebar.html.twig" %}
{# forum list #}
{% block column %}
{% if site_code == constant("App\\Entity\\Content::SITE_RCS") %}
{% include "includes/curtain-ads/newForum.html.twig" %}
<div style="width:100%;"><img src="https://www.rooferscoffeeshop.com/uploads/media/2022/02/rcs-forum-website.png" loading='lazy'></div>
{% else %}
<h1 class="page-title" >Forums</h1>
{% endif %}
{% if forums is defined and forums is not empty %}
{% if site_code == constant("App\\Entity\\Content::SITE_RCS") %}
<a style="float: left;" href="/rcs-forum-code-conduct" class="group-append button">Code of Conduct</a>
{% else %}
<a style="float: left;" href="https://www.rooferscoffeeshop.com/rcs-forum-code-conduct" class="group-append button">Code of Conduct</a>
{% endif %}
<span class="float-right forum-search">{% include "includes/forum-search-box.html.twig" %}</span>
<table class="table forum-body" style="margin-top:65px; margin-bottom: 50px;">
<thead>
<tr class="forum-header">
<th scope="col">Forum</th>
<th scope="col" style="text-align: center;">Topics</th>
<th scope="col" style="text-align: center;">Posts</th>
<th scope="col" style="text-align: center;">Most Recent Reply</th>
</tr>
</thead>
<tbody>
{% for forum in forums %}
{% if (forum.forum.getMembersOnly() and app.user and app.user.isMember()) or (not forum.forum.getMembersOnly()) %}
<tr {% if forum.forum.getMembersOnly() %}class="featured" {% endif %}>
<td><a href="/forum/{{forum.forum.slug}}">{{forum.forum.title|raw}}</a></td>
<td style="text-align: center;">{{forum.num_topics|number_format}}</td>
<td style="text-align: center;">{{forum.num_posts|number_format}}</td>
<td class="recentpostdate" style="text-align: center;">
{% if forum.recent_topic is not empty %}
{% set recent_reply = (forum.recent_topic.getActiveChildren().first() ? forum.recent_topic.getActiveChildren().first() : forum.recent_topic ) %}
{{ post_age_format(date(recent_reply.publishedat|date).diff(date("now")))}}<br><span class="topic-meta">
{% if recent_reply.author is not empty %}
<img style="border: 3px double #ddd;" src="{{ recent_reply.author.getAvatarURL() }}" width="14px" height="14px" loading='lazy' />
{% else %}
<img style="border: 3px double #ddd;" src="/assets/img/default-user.jpg" width="14px" height="14px" loading='lazy' />
{% endif %}
{% if recent_reply.author is not empty %}
{{recent_reply.author}}
{% else %}
Anonymous
{% endif %}
</span></td>
{% else %}
No Topics
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
{% else %}
<h4 style="margin:50px 0;text-align:center;">No forums are available at this time. Please check back soon!</h4>
{% endif %}
{% endblock %}