From 8fafa41809a20af2cb2904f68b4c40d10a0a3c2d Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Mon, 6 Aug 2012 10:43:52 +0200 Subject: [PATCH] book: layout section, with links to concepts and edit icons --- browser/loops.js | 14 ++++------ compound/book/browser.py | 16 ++++++++++-- compound/book/view_macros.pt | 50 +++++++++++++++++++++--------------- 3 files changed, 48 insertions(+), 32 deletions(-) diff --git a/browser/loops.js b/browser/loops.js index 7221b16..7a86dfa 100644 --- a/browser/loops.js +++ b/browser/loops.js @@ -125,22 +125,18 @@ function setConceptTypeForComboBox(typeId, cbId) { } var dialog; -var dialogName; function objectDialog(dlgName, url) { dojo.require('dijit.Dialog'); dojo.require('dojo.parser'); dojo.require('dijit.form.FilteringSelect'); dojo.require('dojox.data.QueryReadStore'); - if (dialogName == undefined || dialogName != dlgName || dialogName == '') { - if (dialog != undefined) { - dialog.destroyRecursive(); - } - dialogName = dlgName; - dialog = new dijit.Dialog({ - href: url - }, dojo.byId('dialog.' + dlgName)); + if (dialog != undefined) { + dialog.destroyRecursive(); } + dialog = new dijit.Dialog({ + href: url + }, dojo.byId('dialog.' + dlgName)); dialog.show(); } diff --git a/compound/book/browser.py b/compound/book/browser.py index 9117e95..ac3e905 100644 --- a/compound/book/browser.py +++ b/compound/book/browser.py @@ -62,13 +62,25 @@ class SectionView(Base, ConceptView): if self.editable: return 'index.html' + @Lazy + def documentTypeType(self): + return self.conceptManager['documenttype'] + + @Lazy + def sectionType(self): + return self.conceptManager['section'] + def getCssClassForResource(self, r): - documentType = self.conceptManager['documenttype'] for c in r.context.getConcepts([self.defaultPredicate]): - if c.conceptType == documentType: + if c.conceptType == self.documentTypeType: return getName(c) return 'textelement' + def getParentsForResource(self, r): + for c in r.context.getConcepts([self.defaultPredicate]): + if c.conceptType not in (self.documentTypeType, self.sectionType): + yield c + # layout parts - probably obsolete: diff --git a/compound/book/view_macros.pt b/compound/book/view_macros.pt index ec1e68c..a7b0ee8 100644 --- a/compound/book/view_macros.pt +++ b/compound/book/view_macros.pt @@ -4,29 +4,37 @@
-