changeset 2328:5d61b26cad7c

Fixes highlight of current item without JS
author sharky93 <rishabhr123@gmail.com>
date Tue, 16 Jul 2013 22:39:17 +0530
parents cc97af25b8e2
children 322841eed772
files MoinMoin/themes/__init__.py MoinMoin/themes/basic/templates/layout.html
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/themes/__init__.py	Mon Jul 15 20:52:44 2013 +0530
+++ b/MoinMoin/themes/__init__.py	Tue Jul 16 22:39:17 2013 +0530
@@ -425,7 +425,7 @@
         'storage': flaskg.storage,
         'clock': flaskg.clock,
         'cfg': app.cfg,
-        'item_name': u'handlers need to give it',
+        'item_name': u'@NONAMEGIVEN',
         'url_for_item': url_for_item,
         'get_editor_info': lambda meta: get_editor_info(meta),
         'utctimestamp': lambda dt: utctimestamp(dt),
--- a/MoinMoin/themes/basic/templates/layout.html	Mon Jul 15 20:52:44 2013 +0530
+++ b/MoinMoin/themes/basic/templates/layout.html	Tue Jul 16 22:39:17 2013 +0530
@@ -3,6 +3,12 @@
 {% import theme("snippets.html") as snippets %}
 {% set logo = snippets.logo() %}
 
+{% if item_name in ['@NONAMEGIVEN',''] %}
+{% set index = url_for(request.endpoint) %}
+{% else %}
+{% set index = url_for_item(endpoint = request.endpoint, item_name = item_name) %}
+{% endif %}
+
 {% block layout %}
 	<div class="container-fluid">
         <div class="navbar navbar-inverse">
@@ -77,8 +83,12 @@
                             {% if class == 'userlink' %}
                                 {% set quicklinks = 'true' %}
                             {% endif %}
-                            <li class="{{ cls }}">
-                                <a href="{{ url }}" {% if title %}title="{{ title }}"{% endif %}>{{ text }}</a>
+                            {% if url == index %}
+                                <li class="{{ cls }} active">
+                            {% else %}
+                                <li class="{{ cls }}">
+                            {% endif %}
+                            <a href="{{ url }}" {% if title %}title="{{ title }}"{% endif %}>{{ text }}</a>
                             </li>
                         {% endfor %}