Skip to content

Commit

Permalink
Added on body a class related to subsite.
Browse files Browse the repository at this point in the history
      The class is named site-x where x is navigation root object id.
  • Loading branch information
tdesvenain committed Oct 27, 2011
1 parent fb797f6 commit cf51033
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Expand Up @@ -14,6 +14,10 @@ Changelog
navigation root.
Fixes http://dev.plone.org/plone/ticket/12231

- Added on body a class related to subsite.
The class is named site-x where x is navigation root object id.
[thomasdesvenain]

- Treat aliases to the ``(Default)`` view of a content type also as a
view template (providing IViewView).
Fixes http://dev.plone.org/plone/ticket/8198
Expand Down
2 changes: 2 additions & 0 deletions plone/app/layout/globals/layout.py
Expand Up @@ -141,6 +141,8 @@ def bodyClass(self, template, view):

# section class (optional)
navroot = portal_state.navigation_root()
body_class += " site-%s" % navroot.getId()

contentPath = context.getPhysicalPath()[len(navroot.getPhysicalPath()):]
if contentPath:
body_class += " section-%s" % contentPath[0]
Expand Down
1 change: 1 addition & 0 deletions plone/app/layout/globals/tests/test_layout.py
Expand Up @@ -65,6 +65,7 @@ def testBodyClassWithNavigationRoot(self):
template = context.folder_listing
body_class = view.bodyClass(template, view)
assert 'section-%s'%context.getId() in body_class
assert 'site-Members' in body_class


def test_suite():
Expand Down

0 comments on commit cf51033

Please sign in to comment.