changeset 2489:d29bfd06cd8c

Fixes the global index view, issue with checking existence of empty string
author sharky93 <rishabhr123@gmail.com>
date Sun, 15 Sep 2013 22:18:31 +0530
parents dc05bbf035d3
children e3dfa238d68d
files MoinMoin/themes/__init__.py MoinMoin/themes/basic/templates/itemviews.html
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/themes/__init__.py	Sun Sep 15 12:12:47 2013 +0530
+++ b/MoinMoin/themes/__init__.py	Sun Sep 15 22:18:31 2013 +0530
@@ -80,15 +80,22 @@
         self.meta_items = []  # list of (name, content) for html head <meta>
 
     def get_action_tabs(self, item_name, current_endpoint):
+
+        if item_name in ['@NONAMEGIVEN', '']:
+            return []
+
+        exists = flaskg.storage.has_item(item_name)
+            
         navtabs_endpoints = ['frontend.show_item', 'frontend.history',
                             'frontend.show_item_meta', 'frontend.highlight_item', 'frontend.backrefs',
                             'frontend.index', 'frontend.sitemap','frontend.similar_names',
                             ]
+
         if self.user.may.write(item_name):
             navtabs_endpoints.append('frontend.modify_item')
 
         icon = self.get_endpoint_iconmap()
-        exists = flaskg.storage.has_item(item_name)
+
         navtabs = []
         spl_active = [('frontend.history', 'frontend.diff'),]
 
@@ -119,6 +126,12 @@
         return navtabs
 
     def get_local_panel(self, item_name):
+
+        if item_name in ['@NONAMEGIVEN', '']:
+            return [], [], []
+
+        exists = flaskg.storage.has_item(item_name)
+
         user_actions_endpoints = ['frontend.quicklink_item', 'frontend.subscribe_item', ]
         item_navigation_endpoints = ['special.supplementation']
         item_actions_endpoints = ['frontend.rename_item', 'frontend.delete_item', 'frontend.destroy_item',
@@ -130,7 +143,6 @@
         item_actions = []
 
         icon = self.get_endpoint_iconmap()
-        exists = flaskg.storage.has_item(item_name)
 
         for endpoint, label, title, check_exists in app.cfg.item_views:
             if endpoint not in app.cfg.endpoints_excluded:
--- a/MoinMoin/themes/basic/templates/itemviews.html	Sun Sep 15 12:12:47 2013 +0530
+++ b/MoinMoin/themes/basic/templates/itemviews.html	Sun Sep 15 22:18:31 2013 +0530
@@ -4,7 +4,7 @@
 {% set navtabs = theme_supp.get_action_tabs(item_name, current_endpoint) %}
 
 {% block views %}
-
+    {% if navtabs %}
     <ul class="moin-nav nav-tabs moin-shadow">
       {% for endpoint, href, maincls, iconcls, linkcls, title, label in navtabs %}
         <li {% if maincls %}class="{{ maincls }}"{% endif %}>
@@ -14,6 +14,6 @@
             </a>
         </li>
       {% endfor %}
-
     </ul>
+    {% endif %}
 {% endblock %}