optionally reverse head title parts (like in browser/node.py)

This commit is contained in:
Helmut Merz 2013-07-26 10:59:53 +02:00
parent de822e717f
commit 25541aa4bf
2 changed files with 12 additions and 8 deletions

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
"""
Base classes for layout-based views.
$Id$
"""
from zope.app.security.interfaces import IUnauthenticatedPrincipal
@ -29,6 +27,7 @@ from zope.proxy import removeAllProxies
from zope.security.proxy import removeSecurityProxy
from zope.traversing.browser import absoluteURL
from cybertools.meta.interfaces import IOptions
from cybertools.util import format
from loops.common import adapted
from loops.i18n.browser import LanguageInfo
@ -170,3 +169,7 @@ class BaseView(object):
def getMetaDescription(self):
return self.context.title
@Lazy
def globalOptions(self):
return IOptions(self.loopsRoot)

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
"""
Layout node views.
$Id$
"""
from zope.app.security.interfaces import IUnauthenticatedPrincipal
@ -66,6 +64,9 @@ class LayoutNodeView(Page, BaseView):
if self.target is not None:
targetView = component.getMultiAdapter((self.target, self.request),
name='layout')
return ' - '.join((self.context.title, targetView.title))
parts = [self.context.title, targetView.title]
else:
return self.context.title
parts = [self.context.title]
if self.globalOptions('reverseHeadTitle'):
parts.reverse()
return ' - '.join(parts)