changeset 1555:d8759402b2fe

Foobar theme selected link highlighter
author Jaiditya Mathur <jaiditya.mathur@gmail.com>
date Tue, 24 Jul 2012 04:19:12 +0530
parents 883dc30621d7
children 8ceefa296052
files MoinMoin/templates/common.js MoinMoin/themes/foobar/static/css/common.css MoinMoin/themes/foobar/static/css/stylus/color_palette.styl MoinMoin/themes/foobar/static/css/stylus/main.styl MoinMoin/themes/foobar/templates/layout.html MoinMoin/themes/foobar/templates/local.html
diffstat 6 files changed, 27 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/common.js	Sat Jul 21 16:44:53 2012 +0530
+++ b/MoinMoin/templates/common.js	Tue Jul 24 04:19:12 2012 +0530
@@ -22,6 +22,25 @@
 }
 $(document).ready(editOnDoubleClick);
 
+// Highlight currently selected link in side panel. Executed on page load
+function selected_link() {
+   var selected = window.location.pathname;
+   
+   var list = document.getElementsByClassName('panel');
+   for (var j = 0; j < list.length; j++) {
+      nav_links = list[j].getElementsByTagName('a');
+      
+      for (var i = 0; i < nav_links.length; i++) {
+         var link = nav_links[i].attributes.href.value;
+             
+             if (link == selected) {
+               nav_links[i].setAttribute('class', 'current');
+               break;
+            }
+        }
+    }
+}
+$(document).ready(selected_link);
 
 
 // Insert Zero-Width-Space characters into long text strings of textNode elements.  Executed on page load.
--- a/MoinMoin/themes/foobar/static/css/common.css	Sat Jul 21 16:44:53 2012 +0530
+++ b/MoinMoin/themes/foobar/static/css/common.css	Tue Jul 24 04:19:12 2012 +0530
@@ -327,6 +327,7 @@
 a.moin-nonexistent:visited{color:#808080}
 a.moin-nonexistent:hover{color:#ff2727}
 a.moin-nonexistent:active{color:#ff2727}
+.current{color:#f82a2a !important}
 .moin-flash{margin:0;padding:6px 6px 6px 38px;background-color:#fff;border-bottom:border style;background-repeat:no-repeat;background-position:16px center}
 .moin-flash-hint{background-image:url("../img/smileys/idea.png");color:#007cef}
 .moin-flash-info{background-image:url("../img/smileys/icon-info.png");color:#007cef}
--- a/MoinMoin/themes/foobar/static/css/stylus/color_palette.styl	Sat Jul 21 16:44:53 2012 +0530
+++ b/MoinMoin/themes/foobar/static/css/stylus/color_palette.styl	Tue Jul 24 04:19:12 2012 +0530
@@ -19,4 +19,5 @@
 visited_color = #5F9EA0
 nonexistent_link_color = #808080
 nonexistent_hover_color = #ff2727
+selected_link_color = #F82A2A
 error_color = #ff2727
\ No newline at end of file
--- a/MoinMoin/themes/foobar/static/css/stylus/main.styl	Sat Jul 21 16:44:53 2012 +0530
+++ b/MoinMoin/themes/foobar/static/css/stylus/main.styl	Tue Jul 24 04:19:12 2012 +0530
@@ -710,6 +710,9 @@
     &.moin-nonexistent:active
         color nonexistent_hover_color
 
+.current
+    color selected_link_color !important
+
 // moin-flash & error
 .moin-flash
     margin 0
--- a/MoinMoin/themes/foobar/templates/layout.html	Sat Jul 21 16:44:53 2012 +0530
+++ b/MoinMoin/themes/foobar/templates/layout.html	Tue Jul 24 04:19:12 2012 +0530
@@ -22,7 +22,7 @@
     <ul>
         {% set navibar_items = theme_supp.navibar(item_name) %}
         {% if navibar_items %}
-            <li>Links
+            <li class="panel">Links
             <ul>
             {% for cls, url, text, title in navibar_items %}
                 <li class="{{ cls }}">
@@ -56,7 +56,7 @@
             </ul>
         </li>
         {% endif %}
-        <li id="moin-user">User
+        <li id="moin-user" class="panel">User
         <ul>
         {% if user.valid -%}
 	    {% set avatar = user.avatar(20) %}
--- a/MoinMoin/themes/foobar/templates/local.html	Sat Jul 21 16:44:53 2012 +0530
+++ b/MoinMoin/themes/foobar/templates/local.html	Tue Jul 24 04:19:12 2012 +0530
@@ -15,7 +15,7 @@
 <div id="moin-local-panel">
 {% block local %}
 <ul>
-    <li>Views
+    <li class="panel">Views
         {{ itemviews }}    
     </li>
     {% if rev %}