/kai/templates/docs/view.mako

https://bitbucket.org/bbangert/kai/ · Mako · 67 lines · 65 code · 2 blank · 0 comment · 10 complexity · db35df40df269783857102fcf6e91c3b MD5 · raw file

  1. <%!
  2. from webob.exc import strip_tags
  3. %>
  4. <div class="yui-b content">
  5. ${show_nav()}
  6. % if c.doc.get('prev', False):
  7. ${display_toc(c.doc)}
  8. % endif
  9. ${c.doc['body'] | n}
  10. ${show_nav()}
  11. ${widgets.show_comments(c.doc.id, message="Suggest an addition to the docs, or report errors. Note that we will delete documentation fixes as they're applied.")}
  12. </div>
  13. <%def name="title()">${parent.title()} - Documentation - ${strip_tags(c.doc['title'])|n}</%def>
  14. <%inherit file="../layout.mako" />
  15. <%def name="styles()">
  16. ${parent.styles()}
  17. ${h.stylesheet_link('/css/sphinx.css')}
  18. </%def>
  19. <%def name="show_nav()">
  20. <div class="relnav">
  21. % if c.doc.get('prev'):
  22. <a href="${c.doc['prev']['link']}">&laquo; ${c.doc['prev']['title']|n}</a> |
  23. % endif
  24. <a href="">${c.doc['title']|n}</a>
  25. % if c.doc.get('next'):
  26. | <a href="${c.doc['next']['link']}">${c.doc['next']['title']|n} &raquo;</a>
  27. % endif
  28. </div>
  29. </%def>
  30. <%namespace name="widgets" file="/widgets.mako"/>
  31. <%def name="javascript()">
  32. ${parent.javascript()}
  33. <script>
  34. $(function() {
  35. var
  36. toc = $('#toc').show(),
  37. items = $('#toc > ul').hide();
  38. ${widgets.comment_js(c.doc.id)}
  39. $('#toc h3')
  40. .click(function() {
  41. if (items.is(':visible')) {
  42. items.animate({
  43. height: 'hide',
  44. opacity: 'hide'
  45. }, 300, function() {
  46. toc.removeClass('expandedtoc');
  47. });
  48. }
  49. else {
  50. items.animate({
  51. height: 'show',
  52. opacity: 'show'
  53. }, 400);
  54. toc.addClass('expandedtoc');
  55. }
  56. });
  57. });
  58. </script>
  59. </%def>
  60. <%def name="display_toc(doc)">
  61. <div id="toc">
  62. <h3>Table of Contents</h3>
  63. <ul style="display:none">${doc['toc'][4:]|n}
  64. </div>
  65. </%def>