diff --git a/fields/group.py b/fields/group.py index 1bc235b..97d6cb7 100644 --- a/fields/group.py +++ b/fields/group.py @@ -289,32 +289,25 @@ class UiGroup: ''') - # PX that renders a group of searches. + # PX that renders a group of searches pxViewSearches = Px(''' - + -
- +
:collapse.px :_(field.labelId) :field.translated
-
+
- :field.pxViewSearches + :field.pxViewSearches - :search.pxView + :search.pxView -
- ''') +
''') # PX that renders a group of transitions. pxViewTransitions = Px(''' @@ -349,7 +342,7 @@ class UiGroup: self.group = group self.columnsWidths = [col.width for col in group.columns] self.columnsAligns = [col.align for col in group.columns] - # Names of i18n labels for this group. + # Names of i18n labels for this group labelName = self.name prefix = className if group.label: @@ -397,4 +390,9 @@ class UiGroup: for i in range(freeColumns): lastRow.append('') # Create a new row self.elements.append([element]) + + def getCollapseInfo(self, id, request): + '''Returns a Collapsible instance, that determines if this group, + represented as an expandable menu item, is collapsed or expanded.''' + return gutils.Collapsible(id, request) # ------------------------------------------------------------------------------ diff --git a/fields/ref.py b/fields/ref.py index 289a626..5ff6989 100644 --- a/fields/ref.py +++ b/fields/ref.py @@ -226,15 +226,10 @@ class Ref(Field):
''') - pxToggleIcon = Px(''' - ''') - # PX that displays referred objects as a list pxViewList = Px('''
- :field.pxToggleIcon + :collapse.px :_(subLabel) (:totalNumber) :field.pxAdd @@ -258,7 +253,8 @@ class Ref(Field): if="not objects and (innerRef and mayAdd)">:_('no_ref')

- @@ -350,6 +346,7 @@ class Ref(Field): (totalNumber > 1); showSubTitles=showSubTitles|\ req.get('showSubTitles', 'true') == 'true'; + collapse=field.getCollapseInfo(obj, True); subLabel='selectable_objects'">:field.pxViewList''') # PX that displays referred objects as dropdown menus. @@ -450,6 +447,7 @@ class Ref(Field): checkboxesEnabled=field.getAttribute(zobj, 'checkboxes') and \ (layoutType != 'cell'); checkboxes=checkboxesEnabled and (totalNumber > 1); + collapse=field.getCollapseInfo(obj, False); showSubTitles=req.get('showSubTitles', 'true') == 'true'">