From b8b55c1670a65026e8365942c8af8bd9fa54c788 Mon Sep 17 00:00:00 2001 From: Dylan Jay Date: Thu, 10 Sep 2015 18:25:08 +0700 Subject: [PATCH] introduced frontend body tag for views with no, or just view permision. --- plone/app/layout/globals/layout.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plone/app/layout/globals/layout.py b/plone/app/layout/globals/layout.py index c3523b6f..28544336 100644 --- a/plone/app/layout/globals/layout.py +++ b/plone/app/layout/globals/layout.py @@ -180,13 +180,16 @@ def bodyClass(self, template, view): if self.icons_visible(): body_classes.append('icons-on') - # who is allowed to view this view. - # HACK: there must be a less dodgy way to do this? - for permission,roles in getattr(view, '__ac_permissions__', tuple()): - body_classes.append('viewpermission-' + normalizer.normalize(permission)) + # permissions required. Useful to theme frontend and backend differently + permissions = [] if not getattr(view, '__ac_permissions__'): - # should we have this special permission if it requires none? - body_classes.append('viewpermission-none') + permissions = ['none'] + for permission,roles in getattr(view, '__ac_permissions__', tuple()): + permissions.append(normalizer.normalize(permission)) + if 'none' in permissions or 'view' in permissions: + body_classes.append('frontend') + for permission in permissions: + body_classes.append('viewpermission-' + permission) # class for user roles membership = getToolByName(context, "portal_membership")