--- a/src/pyams_content/features/search/zmi/theme.py Fri Mar 22 17:46:49 2019 +0100
+++ b/src/pyams_content/features/search/zmi/theme.py Fri Mar 22 17:47:03 2019 +0100
@@ -14,17 +14,19 @@
from z3c.form import field
+from pyams_content import _
+from pyams_content.component.theme import ICollectionsManager, ICollectionsManagerTarget, IThemesManager, \
+ IThemesManagerTarget
from pyams_content.features.search import ISearchFolder
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
-from pyams_content.shared.view.interfaces import IViewTagsSettings, IViewThemesSettings, IViewCollectionsSettings
-from pyams_content.shared.view.zmi.theme import ViewTagsEditForm, ViewThemesEditForm, ViewCollectionsEditForm
+from pyams_content.shared.view.interfaces import IViewCollectionsSettings, IViewTagsSettings, IViewThemesSettings
+from pyams_content.shared.view.zmi.theme import ViewCollectionsEditForm, ViewTagsEditForm, ViewThemesEditForm
from pyams_form.form import ajax_config
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.layer import IPyAMSLayer
from pyams_thesaurus.zmi.widget import ThesaurusTermsTreeFieldWidget
from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
-
-from pyams_content import _
+from pyams_utils.traversing import get_parent
@pagelet_config(name='tags.html', context=ISearchFolder, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
@@ -54,9 +56,15 @@
fields['themes'].widgetFactory = ThesaurusTermsTreeFieldWidget
def updateWidgets(self, prefix=None):
- super(SearchFolderThemesEditForm, self).updateWidgets(prefix)
+ super(ViewThemesEditForm, self).updateWidgets(prefix)
if 'themes' in self.widgets:
- self.widgets['themes'].label_css_class = 'hidden'
+ target = get_parent(self.context, IThemesManagerTarget)
+ manager = IThemesManager(target)
+ widget = self.widgets['themes']
+ widget.label_css_class = 'hidden'
+ widget.input_css_class = 'col-md-12'
+ widget.thesaurus_name = manager.thesaurus_name
+ widget.extract_name = manager.extract_name
@pagelet_config(name='collections.html', context=ISearchFolder, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
@@ -70,6 +78,12 @@
fields['collections'].widgetFactory = ThesaurusTermsTreeFieldWidget
def updateWidgets(self, prefix=None):
- super(SearchFolderCollectionsEditForm, self).updateWidgets(prefix)
+ super(ViewCollectionsEditForm, self).updateWidgets(prefix)
if 'collections' in self.widgets:
- self.widgets['collections'].label_css_class = 'hidden'
+ target = get_parent(self.context, ICollectionsManagerTarget)
+ manager = ICollectionsManager(target)
+ widget = self.widgets['collections']
+ widget.label_css_class = 'hidden'
+ widget.input_css_class = 'col-md-12'
+ widget.thesaurus_name = manager.thesaurus_name
+ widget.extract_name = manager.extract_name