denny/ShinyCMS

View on GitHub
root/shop/view_categories.tt

Summary

Maintainability
Test Coverage
[%-    meta.wrapper          = 'shop/wrapper.tt';
    meta.title            = 'Shop Categories';
%]

<h3>
    [% meta.title %]
</h3>

[%- IF categories > 0 %]

[%- VIEW category_list %]
    [%- BLOCK ShinyCMS_Model_DB_ShopCategory %]
    [%- END %]
    [%- BLOCK list %]
        [%- FOREACH category IN item %]
        <ul class="disc">
            <li>
                <span class="big"><a href="[% c.uri_for( 'category', category.url_name ) %]">[% category.name | html %]</a></span> - [% category.description | html %]
                [%- IF category.shop_categories %]
                [%- FOREACH category.shop_categories %]
                    [% view.print([category.shop_categories]) %]
                [%- END %]
                [%- END %]
            </li>
        </ul>
        [%- END %]
    [%- END %]
[%- END %]

[% category_list.print(categories.all) %]

[%- ELSE %]
<p>
    There are currently no shop categories available to view.
    Please come back later.
</p>
[%- END %]