Commits

Anonymous committed 02c7915

Made the sections' nav menus nicer:

1. Added a header for them.

2. Added a JavaScript-based link that can be used to hide and re-show them.

Comments (0)

Files changed (6)

common/js/toggle_sect.js

+function toggle_sect_menu()
+{
+    var wrapper = document.getElementById("sect_menu_wrapper");
+    var action_link = document.getElementById("toggle_sect_menu");
+    if (wrapper.getAttribute("class") == "hide")
+    {
+        wrapper.setAttribute("class", "");
+        action_link.innerHTML = "Hide";
+    }
+    else
+    {
+        wrapper.setAttribute("class", "hide");
+        action_link.innerHTML = "Show";
+    }
+}
+
     margin-left: 7pt;
     margin-right: 10pt;
     padding-right:5pt;
+    padding-left:5pt;
+    width:25%;
 }
 .sub_menu ul
 {
 {
     color: #800080; /* Purple */
 }
+
+.sub_menu h2
+{
+   font-size: medium;
+   padding-top:0;
+   margin-top:0;
+   margin-bottom:0;  
+}
+.sub_menu .toggle_sect_menu
+{
+   float:right;
+}
+.hide
+{
+    display:none;
+}

lib/MySectNavData.pm

         'id' => "essays",
         'regex' => "^/philosophy/",
         'class' => "Essays",
+        'title' => "Essays Section Menu",
     },
     {
         'id' => "lectures",
         'regex' => "^/lecture/",
         'class' => "Lectures",
+        'title' => "Lectures Section Menu",
     },
     {
         'id' => "software",
         'regex' => "^/(open-source|jmikmod|grad-fu|rwlock|software-tools)/",
         'class' => "Software",
-    },    
+        'title' => "Software Section Menu",
+    },
 );
 
 sub get_nav_menu

lib/Shlomif/Homepage/SectionMenu.pm

     path_info
     results
     sections
+    title
 ));
 
 sub initialize
         my $results = $nav_menu->render();
         $self->nav_menu($nav_menu);
         $self->results($results);
+        $self->title($current_sect->{'title'});
     }
 }
 
     else
     {
         return qq{<div class="sub_menu">\n} .
+            qq{<h2>} . $self->title() . qq{</h2>\n} .
+            qq{<a id="toggle_sect_menu" href="javascript:toggle_sect_menu()" class="toggle_sect_menu">Hide</a>\n} .
+            qq{<div id="sect_menu_wrapper">\n} .
             join("\n", @{$self->results()->{html}}) .
-            qq{\n</div>\n};
+            qq{\n</div>\n</div>\n};
     }
 }
 

lib/Shlomif/Homepage/SectionMenu/Sects/Essays.pm

             'title' => "Index to Essays and Articles I wrote.",
         },
         {
-            'text' => "Books Recommendations",
+            'text' => "Recommended Books",
             'url' => "philosophy/books-recommends/",
             'title' => "Recommendations of Good Books I read and was Enlightened by.",
         },
 }:>
 </latemp_before_main_title>
 
+<latemp_extra_head_elements>
+<script type="text/javascript" src="$(ROOT)/js/toggle_sect.js"></script> 
+</latemp_extra_head_elements>