denny/ShinyCMS

View on GitHub
root/pages/cms-templates/homepage.tt

Summary

Maintainability
Test Coverage
[%-
    meta.title         = page.name;
    meta.menu_selected = page.name;
-%]

<div class="wrapper style1" style="padding: 50px;">
    <div class="inner">
        <img src="[% c.uri_for( '/static', 'images', elements.video_url ) %]" class="welcome-image" alt="Welcome to ShinyCMS">

        <h2>
            [% elements.heading1 | html %]
        </h2>

        [% elements.html1 %]
    </div>
</div>

<div class="wrapper style2" style="padding: 50px 0 20px 0;">
    <p style="text-align: center;">
        <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="/static/images/valid-css-blue.png" alt="Valid CSS"></a>
        &nbsp;
        <a href="http://validator.w3.org/check?uri=referer"><img src="/static/images/html5-black.png" alt="Valid HTML5"></a>
        &nbsp;
        <a href="http://feedvalidator.org/check"><img src="/static/images/valid-atom.png" alt="Valid Atom"></a>
    </p>
</div>

<div class="wrapper style3" style="padding: 100px;">
    <div class="inner">
        <section class="container">
            <div class="row">
                <div class="col-6 col-12-medium">
                    <section>
                        <h2 class="icon fa-newspaper-o">
                            News
                        </h2>
                        [%- news_items = c.controller( 'News' ).get_items( c, 5 ) %]
                        [%- IF news_items %]
                        <ul>
                        [%- FOREACH news_item IN news_items.all %]
                            <li>
                                <a href="[% c.uri_for( '/news', news_item.posted.year, news_item.posted.month, news_item.url_title ) %]">[% news_item.title | html %]</a> - [% news_item.posted.day %] [% news_item.posted.month_abbr %] [% news_item.posted.year %]
                            </li>
                        [%- END %]
                        </ul>
                        [%- END %]
                    </section>
                </div>

                <div class="col-6 col-12-medium">
                    <section>
                        <h2 class="icon fa-rss-square">
                            Blog
                        </h2>
                        [%- blog_posts = c.controller( 'Blog' ).get_posts( c, 5 ) %]
                        [%- IF blog_posts.count > 0 %]
                        <ul>
                        [%- FOREACH blog_post IN blog_posts.all %]
                            <li>
                                <a href="[% c.uri_for( '/blog', blog_post.posted.year, blog_post.posted.month, blog_post.url_title ) %]">[% blog_post.title | html %]</a>
                                ([% blog_post.comment_count %] comment[% 's' UNLESS blog_post.comment_count == 1 %])
                            </li>
                        [%- END %]
                        </ul>
                        [%- END %]
                    </section>
                </div>
            </div>

            <div class="row">
                <div class="col-6 col-12-medium">
                    <section class="test">
                        <h2 class="icon fa-calendar">
                            Events
                        </h2>
                        [%- events = c.controller( 'Events' ).get_events( c, 5 ) %]
                        [%- IF events %]
                        <ul>
                        [%- FOREACH event IN events %]
                            <li>    <a href="[% c.uri_for( '/events', event.start_date.year, event.start_date.month, event.url_name ) %]">[% event.name | html %]</a> - [% event.start_date.day %] [% event.start_date.month_abbr %] [% event.start_date.year %]
                            </li>
                        [%- END %]
                        </ul>
                        [%- END %]
                    </section>
                </div>

                <div class="col-6 col-12-medium">
                    <section class="test">
                        <h2 class="icon fa-comments-o">
                            Forums
                        </h2>
                        [%- most_recent = c.controller( 'Forums' ).most_recent_comment( c ) %]
                        <p>
                            <a href="[% c.uri_for( '/forums', most_recent.post.forum.section.url_name, most_recent.post.forum.url_name, most_recent.post.id, most_recent.post.url_title ) %]#comment-[% most_recent.id %]">[% most_recent.title || most_recent.body | remove( '<.+?>' ) | truncate | html %]</a> by [% IF most_recent.author_type == 'Site User' %]<a href="[% c.uri_for( '/user', most_recent.author.username ) %]">[% most_recent.author.display_name || most_recent.author.username %]</a>[% ELSIF most_recent.author_type == 'Unverified' %][% most_recent.author_name %][% ELSE %]Anonymous[% END %] at [% most_recent.posted.strftime('%H:%M') %] on [% most_recent.posted.day %] [% most_recent.posted.month_abbr %] [% most_recent.posted.year %]
                        </p>
                    </section>
                </div>
            </div>
        </section>
    </div>
</div>