PageRenderTime 71ms CodeModel.GetById 30ms app.highlight 1ms RepoModel.GetById 19ms app.codeStats 0ms

/kai/templates/articles/index.mako

https://bitbucket.org/bbangert/kai/
Mako | 39 lines | 38 code | 1 blank | 0 comment | 7 complexity | a32765b9deb6c00d59cd30eb24552586 MD5 | raw file
 1<div class="yui-b content">
 2    <h1>${_('Recent Blog Postings')}\
 3% if c.user and c.user.in_group('admin'):
 4 <span class="subtle">(${h.link_to('Add Posting', url=url('new_article'))})</span>\
 5% endif
 6</h1>
 7    <%
 8    if c.articles:
 9        results = list(c.articles)
10    if c.reverse:
11        results.reverse()
12    %>
13    
14    ${widgets.pager(c.start, results, c.articles.total_rows, 'published')}
15    % for article in results[:10]:
16    ${display_article(article)}
17    % endfor
18</div>
19<%def name="display_article(article)" cached="True" cache_timeout="600" cache_key="${article.id}" cache_type="ext:memcached" cache_url="127.0.0.1:11211">
20<div class="atomentry" id="article-${article.slug}">
21    <h2 class="title">${h.link_to(article.title, url=url('article_archives', article=article))}</h2>
22    <%
23        author = '<cite>%s</cite>' % article.author
24        date = '<span class="date">%s</span>' % format.date(article.published, "long")
25        post_dict = dict(author=author, date=date)
26    %>
27    <p class="author">${_('Posted by %(author)s on %(date)s' % post_dict) | n}</p>
28    <div class="articlecontent">
29        ${h.textilize(article.body)}
30    </div>
31</div>
32</%def>
33<%namespace name="widgets" file="/widgets.mako"/>
34<%def name="title()">${parent.title()} - ${_('Blog')}</%def>
35<%inherit file="/layout.mako" />
36<%def name="styles()">
37${h.auto_discovery_link(url.current(format='atom', qualified=True), feed_type='atom', title='News Feed')}
38${parent.styles()}
39</%def>