optionally reverse head title parts (like in browser/node.py)
This commit is contained in:
parent
de822e717f
commit
25541aa4bf
2 changed files with 12 additions and 8 deletions
|
@ -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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Base classes for layout-based views.
|
Base classes for layout-based views.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
||||||
|
@ -29,6 +27,7 @@ from zope.proxy import removeAllProxies
|
||||||
from zope.security.proxy import removeSecurityProxy
|
from zope.security.proxy import removeSecurityProxy
|
||||||
from zope.traversing.browser import absoluteURL
|
from zope.traversing.browser import absoluteURL
|
||||||
|
|
||||||
|
from cybertools.meta.interfaces import IOptions
|
||||||
from cybertools.util import format
|
from cybertools.util import format
|
||||||
from loops.common import adapted
|
from loops.common import adapted
|
||||||
from loops.i18n.browser import LanguageInfo
|
from loops.i18n.browser import LanguageInfo
|
||||||
|
@ -170,3 +169,7 @@ class BaseView(object):
|
||||||
def getMetaDescription(self):
|
def getMetaDescription(self):
|
||||||
return self.context.title
|
return self.context.title
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def globalOptions(self):
|
||||||
|
return IOptions(self.loopsRoot)
|
||||||
|
|
||||||
|
|
|
@ -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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Layout node views.
|
Layout node views.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
from zope.app.security.interfaces import IUnauthenticatedPrincipal
|
||||||
|
@ -66,6 +64,9 @@ class LayoutNodeView(Page, BaseView):
|
||||||
if self.target is not None:
|
if self.target is not None:
|
||||||
targetView = component.getMultiAdapter((self.target, self.request),
|
targetView = component.getMultiAdapter((self.target, self.request),
|
||||||
name='layout')
|
name='layout')
|
||||||
return ' - '.join((self.context.title, targetView.title))
|
parts = [self.context.title, targetView.title]
|
||||||
else:
|
else:
|
||||||
return self.context.title
|
parts = [self.context.title]
|
||||||
|
if self.globalOptions('reverseHeadTitle'):
|
||||||
|
parts.reverse()
|
||||||
|
return ' - '.join(parts)
|
||||||
|
|
Loading…
Add table
Reference in a new issue