PageRenderTime 122ms CodeModel.GetById 61ms app.highlight 1ms RepoModel.GetById 59ms app.codeStats 0ms

/kai/templates/pasties/index.mako

https://bitbucket.org/bbangert/kai/
Mako | 60 lines | 57 code | 3 blank | 0 comment | 14 complexity | 4cce3804b1d451077a1486970b4682f0 MD5 | raw file
 1<%
 2results = list(c.pasties)
 3if c.reverse:
 4    results.reverse()
 5total = c.total or c.pasties.total_rows
 6%>
 7
 8% if results:
 9${widgets.pager(c.start, results, total, 'created')}
10% endif
11<h1>Pastes\
12% if c.tag:
13 <span class="subtle">(Viewing tag: ${c.tag})</span>\
14% endif
15</h1>
16
17% for paste in results[:10]:
18<div class="pastie">
19    <h2 class="pastie">${h.link_to(paste.title, url=url('paste', id=paste.old_id or paste.id))}</h2>
20    <div class="pastedata">
21        <div class="language">Language: \
22        % if paste.language:
23        <span class="lang">${h.langdict[paste.language]}</span>\
24        % else:
25        No language provided\
26        % endif
27        </div>
28        % if paste.tags:
29        <div class="tags"><span class="tagheader">Tags: </span>\
30            % for tag in paste.tags:
31                % if tag:
32                ${h.link_to(tag, url=url('pasties_tag', tag=tag))} 
33                % endif
34            % endfor
35        </div>
36        % endif
37    </div>
38    % if paste.old_poster or not paste.email:
39    ${widgets.user_post(paste.old_poster, 'anonymous', paste.created, extra_classes='pastelist')}
40    % else:
41    ${widgets.user_post(paste.displayname, paste.email, paste.created, extra_classes='pastelist')}
42    % endif
43    <div class="clearfix">&nbsp;</div>
44</div>
45% endfor
46% if not results:
47<p>No pasties found</p>
48% endif
49
50<%namespace name="widgets" file="/widgets.mako" />
51<%def name="title()">${parent.title()} - ${_('Pastebin')}</%def>
52<%inherit file="layout.mako" />
53<%def name="styles()">
54% if c.tag:
55${h.auto_discovery_link(url('formatted_pasties_tag', tag=c.tag, format='atom', qualified=True), feed_type='atom', title='PylonsHQ Pasties Feed')}
56% else:
57${h.auto_discovery_link(url('formatted_pasties', format='atom', qualified=True), feed_type='atom', title='PylonsHQ Pasties Feed')}
58% endif
59${parent.styles()}
60</%def>