PageRenderTime 41ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 19ms app.codeStats 0ms

/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<%!
 2from 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
36  var
37    toc = $('#toc').show(),
38    items = $('#toc > ul').hide();
39  ${widgets.comment_js(c.doc.id)}
40  $('#toc h3')
41    .click(function() {
42      if (items.is(':visible')) {
43        items.animate({
44          height:     'hide',
45          opacity:    'hide'
46        }, 300, function() {
47          toc.removeClass('expandedtoc');
48        });
49      }
50      else {
51        items.animate({
52          height:     'show',
53          opacity:    'show'
54        }, 400);
55        toc.addClass('expandedtoc');
56      }
57    });
58
59});
60</script>
61</%def>
62<%def name="display_toc(doc)">
63<div id="toc">
64<h3>Table of Contents</h3>
65<ul style="display:none">${doc['toc'][4:]|n}
66</div>
67</%def>