root/forums/view_section.tt
[%- meta.title = section.name _ ' - Forums' -%]
[% INCLUDE 'includes/loggedout.tt' %]
[%- IF section.sorted_forums %]
<div class="forums">
<div class="header">
<div class="column1 top">
<a href="[% c.uri_for( section.url_name ) %]">[% section.name | html %]</a>
</div>
<div class="column2 top">Most recent comment</div >
<div class="column3 top">Threads</div>
<div class="column4 top">Posts</div>
</div>
[%- FOREACH forum IN section.sorted_forums %]
<div class="row">
<div class="forum [% IF forum.url_name == section.sorted_forums.first.url_name %]first[% END %]">
<a href="[% c.uri_for( section.url_name, forum.url_name ) %]" class="forum-name">[% forum.name | html %]</a>
<br /><span class="description">[% forum.description %]</span>
</div>
<div class="comment [% IF forum.url_name == section.sorted_forums.first.url_name %]first[% END %]">
[%- most_recent = forum.most_recent_comment %]
[%- mrc = most_recent.comment %]
[%- mrp = most_recent.post %]
[%- IF mrc %]
<a href="[% c.uri_for( section.url_name, forum.url_name, mrp.id, mrp.url_title ) %]#comment-[% mrc.id %]">[% mrc.title || mrc.body | remove( '<.+?>' ) | truncate | html %]</a><br />
by <a href="[% c.uri_for( '/user', mrc.author.username ) %]">[% mrc.author.display_name || mrc.author.username | html %]</a> on <a href="[% c.uri_for( section.url_name, forum.url_name, mrp.id, mrp.url_title ) %]">[% mrp.title | html %]</a> at [% mrc.posted.strftime('%H:%M') %] on [% mrc.posted.day %] [% mrc.posted.month_abbr %] [% mrc.posted.year %]
[%- END %]
</div>
<div class="threads [% IF forum.url_name == section.sorted_forums.first.url_name %]first[% END %]">
[% forum.post_count %]
</div>
<div class="posts [% IF forum.url_name == section.sorted_forums.first.url_name %]first[% END %]">
[% forum.comment_count %]
</div>
</div>
[%- END %]
</div>
[%- ELSE %]
<p>
No forum sections have been defined yet.
</p>
[%- END %]
[% INCLUDE 'includes/loggedout.tt' %]