PageRenderTime 204ms CodeModel.GetById 101ms app.highlight 2ms RepoModel.GetById 98ms app.codeStats 1ms

/kai/templates/layout.mako

https://bitbucket.org/bbangert/kai/
Mako | 158 lines | 148 code | 2 blank | 8 comment | 11 complexity | 189f9d9bb6d6669c07998a8d467023a3 MD5 | raw file
  1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2<html xmlns="http://www.w3.org/1999/xhtml">
  3<head>
  4    <title>${self.title()}</title>
  5    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6    ${self.styles()}
  7</head>
  8<body>
  9    <div id="doc4"${self.yui_class()}>
 10        <div id="hd">
 11            <h1 id="logo"><a href="${url('home')}">Pylons</a></h1>
 12            ${nav(getattr(c, 'active_tab', None), getattr(c, 'active_sub', None))}
 13        </div>
 14        <div id="bd">
 15            <div id="loginbar">
 16                <div class="layoutstyle">
 17                    Layout: ${h.link_to('Fixed-width', id_='layout-toggle', url='#')}
 18                </div>
 19                <div class="links">
 20                % if session.get('logged_in'):
 21                    Logged in as ${session['displayname']}
 22                    ${h.link_to('Logout', url=url('account_logout', redir=request.path_qs))}
 23                % else:
 24                ${h.link_to('Login', url=url('account_login', redir=request.path_qs))} or 
 25                ${h.link_to('Register', url=url('account_register', redir=request.path_qs))}
 26                % endif
 27                </div>
 28            </div>
 29            % for message_type in ['success', 'failure']:
 30            <% 
 31                messages = getattr(h, '%s_flash' % message_type).pop_messages() 
 32            %>
 33            % if messages:
 34            <ul id="${message_type}-flash-messages">
 35            % for message in messages:
 36                <li>${message}</li>
 37            % endfor
 38            </ul>
 39            % endif
 40            % endfor
 41            ${next.body()}
 42            ## Load Javascripts and such at the end
 43            ${self.more_body()}
 44        </div>
 45        <div id="ft">
 46            <p>Powered by Pylons - <a href="mailto:ben@groovie.org">Contact Administrators</a></p>
 47        </div>
 48    </div>
 49    ${self.javascript()}
 50    <script type="text/javascript">
 51    /*
 52    Inserts GA using DOM insertion of <script> tag and "script onload" method to
 53    initialize the pageTracker object. Prevents GA insertion from blocking I/O!
 54
 55    As suggested in Steve Souder's talk. See:
 56    http://google-code-updates.blogspot.com/2009/03/steve-souders-lifes-too-short-write.html
 57    */
 58
 59    /* acct is GA account number, i.e. "UA-5555555-1" */
 60    function gaSSDSLoad (acct) {
 61      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."),
 62          pageTracker,
 63          s;
 64      s = document.createElement('script');
 65      s.src = gaJsHost + 'google-analytics.com/ga.js';
 66      s.type = 'text/javascript';
 67      s.onloadDone = false;
 68      function init () {
 69        pageTracker = _gat._getTracker(acct);
 70        pageTracker._trackPageview();
 71      }
 72      s.onload = function () {
 73        s.onloadDone = true;
 74        init();
 75      };
 76      s.onreadystatechange = function() {
 77        if (('loaded' === s.readyState || 'complete' === s.readyState) && !s.onloadDone) {
 78          s.onloadDone = true;
 79          init();
 80        }
 81      };
 82      document.getElementsByTagName('head')[0].appendChild(s);
 83    }
 84    /* and run it */
 85    gaSSDSLoad("UA-341777-2");
 86    </script>
 87</body>
 88</html>
 89<%def name="yui_class()"></%def>
 90<%def name="more_body()"></%def>
 91<%def name="title()">PylonsHQ</%def>
 92<%def name="styles()">
 93% if c.use_minified_assets:
 94    ${h.stylesheet_link('/css/%s' % config['phq.minified_css'])}
 95% else:
 96    ${h.stylesheet_link(*h.load_stylesheet_assets())}
 97%endif
 98</%def>
 99<%def name="javascript()">
100<script src="http://cdn.jquerytools.org/1.2.2/full/jquery.tools.min.js"></script>
101<script type="text/javascript" src="/javascripts/jquery_all.js" charset="utf-8"></script>
102<script type="text/javascript" src="/javascripts/behavior.js" charset="utf-8"></script>
103</%def>
104<%def name="nav(tab, sub)">
105<div id="nav">\
106<%
107    active_tab = {}
108    active_tab[tab or 'Home'] = ' class="selected"'
109    active_sub = {}
110    active_sub[sub or 'Overview'] = ' class="selected"'
111%>\
112  <ul class="clearfix">
113    <li id="nav-1"${active_tab.get('Home', '') | n}>${h.link_to('Home', url=url('home'))}
114      <ul>
115        <li${active_sub.get('Overview', '') | n}>${h.link_to('Overview', url=url('home'))}</li>
116        <li${active_sub.get('Features', '') | n}>${h.link_to('Features', url=url('features'))}</li>
117        <li${active_sub.get('History', '') | n}>${h.link_to('History', url=url('history'))}</li>
118        <li${active_sub.get('Search', '') | n}>${h.link_to('Search', url=url('search'))}</li>
119##        <li${active_sub.get('The Team', '') | n}><a href="#">The Team</a></li>
120      </ul>
121    </li>
122    <li id="nav-2"${active_tab.get('Documentation', '') | n}>${h.link_to('Documentation', url=url('doc_home', version=session.get('doc_version', app_globals.doc_version)))}
123      <ul>
124        <li${active_sub.get('Reference', '') | n}>${h.link_to('Reference', url=url('doc_home', version=session.get('doc_version', app_globals.doc_version)))}</li>
125##        <li${active_sub.get('FAQ', '') | n}><a href="#">FAQ</a></li>
126        <li${active_sub.get('Modules', '') | n}>${h.link_to('Modules', url=url('doc_view', url='modules/', version=session.get('doc_version', app_globals.doc_version)))}</li>
127        <li${active_sub.get('Glossary', '') | n}>${h.link_to('Glossary', url=url('doc_view', url='glossary/', version=session.get('doc_version', app_globals.doc_version)))}</li>
128        <li${active_sub.get('Index', '') | n}><a href="#">${h.link_to('Index', url=url('doc_view', url='index/', version=session.get('doc_version', app_globals.doc_version)))}</a></li>
129      </ul>
130    </li>
131    <li id="nav-3"${active_tab.get('Community', '') | n}>${h.link_to('Community', url=url('community'))}
132      <ul>
133        <li${active_sub.get('Blog', '') | n}>${h.link_to('Blog', url=url('articles'))}</li>
134        <li${active_sub.get('Wiki', '') | n}>${h.link_to('Wiki', url=url('wiki'))}</li>
135##        <li${active_sub.get('Jobs', '') | n}><a href="#">Jobs</a></li>
136##        <li${active_sub.get('Sites Using Pylons', '') | n}><a href="#">Sites Using Pylons</a></li>
137##        <li${active_sub.get('Aggregator', '') | n}><a href="#">Aggregator</a></li>
138      </ul>
139    </li>
140    <li id="nav-4"${active_tab.get('Tools', '') | n}><a href="${url('pasties')}">Tools</a>
141      <ul>
142        <li${active_sub.get('Pastebin', '') | n}>${h.link_to('Pastebin', url=url('pasties'))}</li>
143        <li${active_sub.get('Tracebacks', '') | n}>${h.link_to('Tracebacks', url=url('tracebacks'))}</li>
144        <li${active_sub.get('Snippets', '') | n}><a href="#">${h.link_to('Snippets', url=url('snippets'))}</a></li>
145      </ul>
146    </li>
147    <li id="nav-5"${active_tab.get('Code', '') | n}>${h.link_to('Code', url='https://github.com/Pylons/pylons')}
148      <ul>
149        <li${active_sub.get('Contributing', '') | n}>${h.link_to('Contributing', url='http://docs.pylonsproject.org/#contributing')}</li>
150        <li${active_sub.get('View Tickets', '') | n}>${h.link_to('View Tickets', url='https://github.com/Pylons/pylons/issues')}</li>
151        <li${active_sub.get('Source', '') | n}>${h.link_to('Source', url='https://github.com/Pylons/pylons')}</li>
152##        <li${active_sub.get('Releases', '') | n}><a href="#">Releases</a></li>
153##        <li${active_sub.get('Buildbots', '') | n}>${h.link_to('Buildbots', url=url('buildbot', action='index'))}</li>
154      </ul>
155    </li>
156  </ul>
157</div>
158</%def>