summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-04-07 22:11:54 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-04-07 22:11:54 +0200
commit30f0c5929254571b6fd2cd36ead67ce90ecf17ed (patch)
tree0220a75b3e70bd6a86026a12169bd3c8bc49b299
parent63ae50fc433d3bf1e8335a443751512dfbb03508 (diff)
downloadweb-30f0c5929254571b6fd2cd36ead67ce90ecf17ed.tar.gz
web-30f0c5929254571b6fd2cd36ead67ce90ecf17ed.tar.bz2
web-30f0c5929254571b6fd2cd36ead67ce90ecf17ed.zip
Removed the javascript toc and replaced it by a mako-solution
-rw-r--r--static/css/style.css8
-rw-r--r--static/js/toc.js30
-rw-r--r--templates/page.mako36
-rw-r--r--templates/pages/development.mako10
-rw-r--r--templates/pages/translating.mako10
5 files changed, 28 insertions, 66 deletions
diff --git a/static/css/style.css b/static/css/style.css
index 26900e0..caa829d 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -234,14 +234,10 @@ img.right {
/* Table of contents */
-#tocheader {
- display: none;
+ul#toc {
}
-#innertoc {
-}
-
-#tocLink {
+.tocLink {
}
/* Footer */
diff --git a/static/js/toc.js b/static/js/toc.js
deleted file mode 100644
index 5ef8545..0000000
--- a/static/js/toc.js
+++ /dev/null
@@ -1,30 +0,0 @@
-function createToc(pages) {
- var tdiv = document.getElementById('toc');
- if (tdiv) {
- var header = tdiv.appendChild(document.createElement('span'));
- // header.onclick = showhideToc;
- header.id = 'tocheader';
- header.innerHTML = 'Contents';
-
- var tul = tdiv.appendChild(document.createElement('ul'));
- tul.id = 'innertoc';
-
- for (key in pages) {
- var link = tul.appendChild(document.createElement('li')).appendChild(document.createElement('a'));
- link.innerHTML = pages[key];
- link.className = 'tocLink';
- link.href = '#' + key;
- }
-
- // showhideToc();
- }
-}
-
-var TocState = 'none';
-
-function showhideToc() {
- TocState = (TocState == 'none') ? 'block' : 'none';
- var newText = (TocState == 'none') ? 'show page contents' : 'hide page contents';
- document.getElementById('tocheader').innerHTML = newText;
- document.getElementById('innertoc').style.display = TocState;
-}
diff --git a/templates/page.mako b/templates/page.mako
index 4670764..625a05c 100644
--- a/templates/page.mako
+++ b/templates/page.mako
@@ -2,25 +2,23 @@
title = ""
uses_toc = False
%>
+<%
+ page_text = capture(next.body)
+%>
<%inherit file="/root.mako" />
-<h1 class="title">${self.attr.title}</h1>
-${next.body()}
+## content
+<h1 class="title">${self.attr.title}</h1>
% if self.attr.uses_toc:
- <script type="text/javascript">
- createToc(${h.toJS(self.attr.tlist)})
- </script>
+ ${self.preface()}
+ ${self.toc()}
% endif
+${page_text}
-<%def name="style()">
- ${parent.style()}
- % if self.attr.uses_toc:
- <script src=${"/static/js/toc.js" | url} type="text/javascript"></script>
- % endif
-</%def>
+## functions
<%def name="h2()">
<%
@@ -38,13 +36,11 @@ ${next.body()}
</%def>
<%def name="toc()">
- <div id="toc">
- <noscript class="box">
- Enable JavaScript for a table of contents.
- </noscript>
- </div>
- <noscript>
- <!-- dummy paragraph to get the correct layout in noscript mode -->
- <p></p>
- </noscript>
+ <ul id="toc">
+ % for url, name in self.attr.tlist:
+ <li><a class="tocLink" href="#${url}">${name}</a></li>
+ % endfor
+ </ul>
</%def>
+
+<%def name="preface()"></%def>
diff --git a/templates/pages/development.mako b/templates/pages/development.mako
index dfc6200..7e42326 100644
--- a/templates/pages/development.mako
+++ b/templates/pages/development.mako
@@ -3,11 +3,11 @@
uses_toc = True
%>
<%inherit file="/page.mako" />
-<p>
- If you want to have a look at the sourcecode, or even support the development with patches or similar, you are now on the correct page :).
-</p>
-
-${self.toc()}
+<%def name="preface()">
+ <p>
+ If you want to have a look at the sourcecode, or even support the development with patches or similar, you are now on the correct page :).
+ </p>
+</%def>
<%self:h2>Getting the source</%self:h2>
<p>
diff --git a/templates/pages/translating.mako b/templates/pages/translating.mako
index 811ff41..8abe9a5 100644
--- a/templates/pages/translating.mako
+++ b/templates/pages/translating.mako
@@ -4,11 +4,11 @@
%>
<%inherit file="/page.mako" />
-<p>
- Portato supports native languages. Nevertheless the translations into these languages have to be created. This page shows how to add a new translation or how to extend an existing translation.
-</p>
-
-${self.toc()}
+<%def name="preface()">
+ <p>
+ Portato supports native languages. Nevertheless the translations into these languages have to be created. This page shows how to add a new translation or how to extend an existing translation.
+ </p>
+</%def>
<%self:h2>Short introduction about NLS in Linux</%self:h2>
<p>