From 62077c5dfbf598de1f3d170bcb3a9977a3209418 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 13 Jul 2012 10:43:11 +0200 Subject: [PATCH] use first type token as default type token, thus showing the correct fields in the create form --- browser/form.py | 2 ++ browser/form_macros.pt | 14 +++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/browser/form.py b/browser/form.py index aa59167..9e0ac7f 100644 --- a/browser/form.py +++ b/browser/form.py @@ -396,6 +396,8 @@ class CreateConceptForm(CreateObjectForm): parentType.getChildren([subtypePred])) types = [dict(token=ConceptTypeInfo(t).token, title=t.title) for t in tconcepts] + if self.defaultTypeToken is None and types: + self.defaultTypeToken = types[0]['token'] if include or include is None: return util.KeywordVocabulary(types + self.listTypes(include, ('hidden',))) return util.KeywordVocabulary(types) diff --git a/browser/form_macros.pt b/browser/form_macros.pt index 47f56b1..0ab2fe2 100644 --- a/browser/form_macros.pt +++ b/browser/form_macros.pt @@ -78,7 +78,10 @@ id="dialog_form" class="dialog" dojoType="dijit.form.Form" tal:define="qualifier request/qualifier|view/qualifier|string:resource; - innerForm request/inner_form|view/inner_form|string:inner_form.html; + innerForm + request/inner_form|view/inner_form|string:inner_form.html; + typesVocabulary python: + view.getTypesVocabulary((qualifier,)); typeToken view/typeToken; fixedType view/fixedType; langInfo view/languageInfo; @@ -104,8 +107,7 @@ '${view/virtualTargetUrl}/$innerForm')">