denny/ShinyCMS

View on GitHub
root/blog/view_year.tt

Summary

Maintainability
Test Coverage
[%-    meta.title = 'Posts from ' _ year -%]

[%- UNLESS months %]
<p>
    No blog posts to display for this year.
</p>
[%- END %]

[%- FOREACH month IN months %]
<h2>
    [% month.first.posted.month_name %]
</h2>
<ul>
[%- FOREACH blog_post IN month %]
    <li>    <a href="[% c.uri_for( '/blog', blog_post.posted.year, blog_post.posted.month, blog_post.url_title ) | url %]">[% blog_post.title | html %]</a>
    by <a href="[% c.uri_for( '/user', blog_post.author.username ) %]">[% blog_post.author.display_name || blog_post.author.username %]</a>
    [%- IF blog_post.discussion %]
    ([% blog_post.comment_count %] comment[% 's' UNLESS blog_post.comment_count == 1 %])
    [%- ELSE %]
    <!-- <i>(comments disabled)</i> -->
    [%- END %]
    </li>
[%- END %]
</ul>
[%- END %]

<p>
    <a href="[% c.uri_for( year - 1 ) %]">&laquo; [% year - 1 %]</a>
    &nbsp; &nbsp; &nbsp;
    <a href="[% c.uri_for( year + 1 ) %]">[% year + 1 %] &raquo;</a>
</p>