src/pyams_content/shared/common/zmi/properties.py
changeset 1342 999fa08d99c2
parent 1146 2477f95cf149
child 1348 ae293e874417
equal deleted inserted replaced
1341:09247c61f985 1342:999fa08d99c2
    75 class SharedContentPropertiesEditForm(AdminEditForm):
    75 class SharedContentPropertiesEditForm(AdminEditForm):
    76     """Shared content properties edit form"""
    76     """Shared content properties edit form"""
    77 
    77 
    78     legend = _("Content properties")
    78     legend = _("Content properties")
    79 
    79 
       
    80     interface = IWfSharedContent
       
    81     fieldnames = ('title', 'short_name', 'content_url', 'header', 'description', 'notepad')
       
    82 
    80     @property
    83     @property
    81     def fields(self):
    84     def fields(self):
    82         fields = field.Fields(IWfSharedContent).select('title', 'short_name', 'content_url',
    85         fields = field.Fields(self.interface).select(*self.fieldnames)
    83                                                        'header', 'description', 'notepad')
    86         if 'title' in fields:
    84         fields['title'].widgetFactory = I18nSEOTextLineFieldWidget
    87             fields['title'].widgetFactory = I18nSEOTextLineFieldWidget
    85         if not self.context.handle_content_url:
    88         if ('content_url' in fields) and not self.context.handle_content_url:
    86             fields = fields.omit('content_url')
    89             fields = fields.omit('content_url')
    87         if not self.context.handle_header:
    90         if ('header' in fields) and not self.context.handle_header:
    88             fields = fields.omit('header')
    91             fields = fields.omit('header')
    89         if not self.context.handle_description:
    92         if ('description' in fields) and not self.context.handle_description:
    90             fields = fields.omit('description')
    93             fields = fields.omit('description')
    91         return fields
    94         return fields
    92 
    95 
    93     def updateWidgets(self, prefix=None):
    96     def updateWidgets(self, prefix=None):
    94         super(SharedContentPropertiesEditForm, self).updateWidgets(prefix)
    97         super(SharedContentPropertiesEditForm, self).updateWidgets(prefix)