r9735 - in helma-ng/trunk/apps/demo: . skins static

[email protected] Wed, 13 May 2009 11:50:27 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090513095027.9895E3D0D6@mia>
Author: hannes
Date: 2009-05-13 11:50:27 +0200 (Wed, 13 May 2009)
New Revision: 9735

Modified:
   helma-ng/trunk/apps/demo/macros.js
   helma-ng/trunk/apps/demo/skins/base.html
   helma-ng/trunk/apps/demo/static/style.css
Log:
Implement simple menu highlighting scheme.

Details at http://dev.helma.org/trac/helma/changeset/9735

Modified: helma-ng/trunk/apps/demo/macros.js
===================================================================
--- helma-ng/trunk/apps/demo/macros.js	2009-05-12 14:22:14 UTC (rev 9734)
+++ helma-ng/trunk/apps/demo/macros.js	2009-05-13 09:50:27 UTC (rev 9735)
@@ -23,3 +23,10 @@
     });
     return markdown.process(content);
 };
+
+exports.matchPath_macro = function(tag) {
+    var req = require('helma/webapp/env').req;
+    if (req && req.path && req.path.match(tag.parameters[0])) {
+        return "highlight";
+    }
+}

Modified: helma-ng/trunk/apps/demo/skins/base.html
===================================================================
--- helma-ng/trunk/apps/demo/skins/base.html	2009-05-12 14:22:14 UTC (rev 9734)
+++ helma-ng/trunk/apps/demo/skins/base.html	2009-05-13 09:50:27 UTC (rev 9735)
@@ -20,13 +20,12 @@
     </div>
     <div id="menu">
         <ul>
-            <li><a href="/">home</a></li>
-            <li><a href="/skins">skins</a></li>
-            <li><a href="/storage/">storage</a></li>
-            <li><a href="/mount/point/">modules</a></li>
-            <li><a href="/continuation">continuations</a></li>
-            <li><a href="/logging">logging</a></li>
-            <li><a href="/profiler">profiler</a></li>
+            <li><a href="/" class="<% matchPath ^/$ %>">home</a></li>
+            <li><a href="/skins" class="<% matchPath ^/skin %>">skins</a></li>
+            <li><a href="/storage/" class="<% matchPath ^/storage/ %>">storage</a></li>
+            <li><a href="/mount/point/" class="<% matchPath ^/mount/point %>">modules</a></li>
+            <li><a href="/continuation" class="<% matchPath ^/continuation %>">continuations</a></li>
+            <li><a href="/logging" class="<% matchPath ^/logging %>">logging &amp; profiling</a></li>
         </ul>
     </div>
     <div id="footer"><% footer %></div>

Modified: helma-ng/trunk/apps/demo/static/style.css
===================================================================
--- helma-ng/trunk/apps/demo/static/style.css	2009-05-12 14:22:14 UTC (rev 9734)
+++ helma-ng/trunk/apps/demo/static/style.css	2009-05-13 09:50:27 UTC (rev 9735)
@@ -61,9 +61,6 @@
 
 #menu ul {
     background-color: #abc;
-    border-width: 1px 1px 0 1px;
-    border-color: white;
-    border-style: solid;
     margin: 10px;
     padding: 0;
 }
@@ -80,7 +77,11 @@
     display: block;
 }
 
-#menu a:hover {
+#menu a.highlight {
+    background-color: #cde;
+}
+
+#menu a:hover, #menu a.highlight#hover {
     background-color: #89a;
 }