shithub: werc

Download patch

ref: 3214dcfbd19d05d4d985e14c82b780c4bbcd6c2f
parent: f5ae66f72f0a3dbbf270d8f42ca43cb80a2dc7a2
author: uriel <[email protected]>
date: Fri Jan 16 22:05:19 EST 2009

Make left sidebar into a list of handlers.

--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -26,7 +26,9 @@
 }
 
 # Sidebar 
-fn gensidebar {
+fn nav_tree {
+    if(! ~ $#sideBarNavTitle 0)
+        echo '<p class="sideBarTitle">'$"sideBarNavTitle':</p>'
     # Ignore stderr, last path element might be a file that doesn't exist (eg., foo for foo.md)
     # /./ to deal with p9p's ls failure to follow dir symlinks otherwise
     ls -F $sitedir/./$req_paths_list >[2]/dev/null \
@@ -135,7 +137,7 @@
 headers=lib/headers.tpl
 master_template=default_master.tpl
 res_tail='</body></html>'
-sidebar=sidebar
+ll_add handlers_bar_left nav_tree
 werc_root=`{pwd}
 for(i in siteTitle siteSubTitle pageTitle extraHeaders)
     $i = ''
--- a/lib/default_master.tpl
+++ b/lib/default_master.tpl
@@ -13,33 +13,17 @@
     </div>
 </div>
 
-% if(! ~ $#sidebar 0) {
-<div id="side-bar">
-
-<div>
 %{
-if(! ~ $#sideBarNavTitle 0)
-    echo '<p class="sideBarTitle">'$"sideBarNavTitle':</p>'
-
-gensidebar
-
+if(! ~ $#handlers_bar_left 0) {
+    echo '<div id="side-bar">'
+    for(h in $handlers_bar_left) {
+        echo '<div>'
+        run_handler $$h
+        echo '</div>'
+    }
+    echo '<div><!-- Bottom filler div --></div> </div>'
+}
 %}
-</div>
-
-% if(! ~ $#wiki 0 && test -f $local_path.md  && check_user $wiki_editors_group) {
-<div> 
-    <form action="/_apps/dirdir/edit" method="POST">
-        <input type="hidden" name="edit_wiki_page" value="%($req_path%)" />
-        <input type="submit" name="" value="Edit page" />
-    </form>
-</div>
-% }
-
-<div>
-</div>
-
-</div>
-% }
 
 <div id="main-copy">