From 4b239e150a28faf7dcfeda79fbaf1f9a0b19b382 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 18 Nov 2007 18:33:59 +0000 Subject: [PATCH] Glossary and glossary item views git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2183 fd906abe-77d9-0310-91a1-e0d9ade77398 --- knowledge/glossary/browser.py | 44 ++++++++++++++++++++----------- knowledge/glossary/configure.zcml | 21 ++++++++++++--- knowledge/glossary/view_macros.pt | 30 ++++++++++++++------- 3 files changed, 66 insertions(+), 29 deletions(-) diff --git a/knowledge/glossary/browser.py b/knowledge/glossary/browser.py index ec6d52a..60629d7 100755 --- a/knowledge/glossary/browser.py +++ b/knowledge/glossary/browser.py @@ -1,5 +1,23 @@ +# +# Copyright (c) 2007 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + """ -Demonstration view. +View classes for glossary and glossary items. $Id$ """ @@ -8,30 +26,24 @@ $Id$ from zope.cachedescriptors.property import Lazy from zope.app.pagetemplate import ViewPageTemplateFile -from loops.browser import common -from loops.browser.concept import ConceptRelationView +from loops.browser.concept import ConceptView from loops.common import adapted from loops import util template = ViewPageTemplateFile('view_macros.pt') -conceptMacrosTemplate = common.conceptMacrosTemplate -class GlossaryItemView(common.BaseView): +class GlossaryView(ConceptView): + + @Lazy + def macro(self): + return template.macros['glossary'] + + +class GlossaryItemView(ConceptView): @Lazy def macro(self): return template.macros['glossaryitem'] - @Lazy - def conceptMacros(self): - return conceptMacrosTemplate.macros - - @Lazy - def children(self): - rels = sorted(self.context.getChildRelations(), - key=(lambda x: x.second.title.lower())) - for r in rels: - yield ConceptRelationView(r, self.request, contextIsSecond=True) - diff --git a/knowledge/glossary/configure.zcml b/knowledge/glossary/configure.zcml index bf1cdb4..629475a 100755 --- a/knowledge/glossary/configure.zcml +++ b/knowledge/glossary/configure.zcml @@ -6,9 +6,22 @@ i18n_domain="zope" > - + + + diff --git a/knowledge/glossary/view_macros.pt b/knowledge/glossary/view_macros.pt index 922f474..15fa9d9 100755 --- a/knowledge/glossary/view_macros.pt +++ b/knowledge/glossary/view_macros.pt @@ -1,17 +1,29 @@ - - - + + - - - +