changeset 2381:aa19b1b69b5c

adds helper function to render the local panel
author sharky93 <rishabhr123@gmail.com>
date Sat, 17 Aug 2013 02:50:14 +0530
parents 7df17df524e7
children 0ce1c8ec7738
files MoinMoin/themes/__init__.py MoinMoin/themes/basic/templates/show.html
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/themes/__init__.py	Sat Aug 17 00:21:30 2013 +0530
+++ b/MoinMoin/themes/__init__.py	Sat Aug 17 02:50:14 2013 +0530
@@ -87,6 +87,13 @@
             navtabs.append('frontend.modify_item')
         return navtabs
 
+    def get_local_panel(self, item_name):
+        user_actions = ['frontend.quicklink_item', 'frontend.subscribe_item', ]
+        item_navigation = ['frontend.index', 'frontend.sitemap', ]
+        item_actions = ['frontend.rename_item', 'frontend.delete_item', 'frontend.destroy_item',
+                'frontend.similar_names', 'frontend.download_item', 'frontend.copy_item',] if self.user.may.write(item_name) else []
+        return user_actions, item_navigation, item_actions
+
     def location_breadcrumbs(self, item_name):
         """
         Assemble the location using breadcrumbs (was: title)
--- a/MoinMoin/themes/basic/templates/show.html	Sat Aug 17 00:21:30 2013 +0530
+++ b/MoinMoin/themes/basic/templates/show.html	Sat Aug 17 02:50:14 2013 +0530
@@ -15,12 +15,7 @@
                'frontend.copy_item' : "icon-comment",
            } %}
 
-{% set user_actions = ['frontend.quicklink_item', 'frontend.subscribe_item', ] %}
-
-{% set item_navigation = ['frontend.index', 'frontend.sitemap', ] %}
-
-{% set item_actions = ['frontend.rename_item', 'frontend.delete_item', 'frontend.destroy_item',
-                       'frontend.similar_names', 'frontend.download_item', 'frontend.copy_item',] %}
+{% set user_actions, item_navigation, item_actions = theme_supp.get_local_panel(item_name) %}
 
 {% block views %}
     {{ itemviews }}