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