[static-web] don't show RecentChanges/Schedule twice



commit 9dd6f13cae32bd6795528ba598dbd96e2c99417b
Author: Olav Vitters <olav vitters nl>
Date:   Sat Aug 2 14:03:26 2014 +0200

    don't show RecentChanges/Schedule twice

 wiki.gnome.org/gnome/gnome.py |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/wiki.gnome.org/gnome/gnome.py b/wiki.gnome.org/gnome/gnome.py
index d10c45a..8ab10d0 100644
--- a/wiki.gnome.org/gnome/gnome.py
+++ b/wiki.gnome.org/gnome/gnome.py
@@ -79,7 +79,7 @@ class Theme(ThemeBase):
         pagename, link = ThemeBase.splitNavilink(self, text, localize = localize)
         return (pagename, re.sub(r'(<a.*?>)(.*)(</a>)', r'\1<span>\2</span>\3', link))
 
-    def tabs(self, d):
+    def tabs(self, d, skip_current=False):
         ### based on ThemeBase.navibar
         request = self.request
         found = {} # pages we found. prevent duplicates
@@ -87,10 +87,16 @@ class Theme(ThemeBase):
         item = u'<li class="%s">%s</li>'
         current = d['page_name']
 
+        if skip_current:
+            found[current] = 1
+
         # Process config navi_bar
         if request.cfg.navi_bar:
             for text in request.cfg.navi_bar:
                 pagename, link = self.splitNavilink(text)
+                if paggename in found:
+                    continue
+
                 if pagename == current:
                     cls = 'wikilink selected'
                 else:
@@ -104,12 +110,14 @@ class Theme(ThemeBase):
             # Split text without localization, user knows what he wants
             pagename, link = self.splitNavilink(text, localize=0)
             if not pagename in found:
-                if pagename == current:
-                    cls = 'userlink selected'
-                else:
-                    cls = 'userlink'
-                items.append(item % (cls, link))
-                found[pagename] = 1
+                continue
+
+            if pagename == current:
+                cls = 'userlink selected'
+            else:
+                cls = 'userlink'
+            items.append(item % (cls, link))
+            found[pagename] = 1
 
         # Assemble html
         html = u''.join(items)
@@ -159,7 +167,7 @@ class Theme(ThemeBase):
         _ = self.request.getText
 
         html_title = self.title_with_separators2(d)
-        html_tabs = self.tabs(d)
+        html_tabs = self.tabs(d, skip_current=True)
 
         html = [
             u'''


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]