--- a/src/pyams_thesaurus/zmi/extract.py Tue Nov 15 10:41:35 2016 +0100
+++ b/src/pyams_thesaurus/zmi/extract.py Tue Nov 15 10:42:18 2016 +0100
@@ -148,10 +148,12 @@
def updateWidgets(self, prefix=None):
super(ThesaurusExtractAddForm, self).updateWidgets()
- self.widgets['description'].label_css_class = 'textarea'
- widget = self.widgets['color']
- alsoProvides(widget, IObjectData)
- widget.object_data = {'ams-colorpicker-position': 'top left'}
+ if 'description' in self.widgets:
+ self.widgets['description'].widget_css_class = 'textarea'
+ if 'color' in self.widgets:
+ widget = self.widgets['color']
+ alsoProvides(widget, IObjectData)
+ widget.object_data = {'ams-colorpicker-position': 'top left'}
def create(self, data):
return ThesaurusExtract()
@@ -190,11 +192,14 @@
def updateWidgets(self, prefix=None):
super(ThesaurusExtractEditForm, self).updateWidgets(prefix)
- self.widgets['name'].mode = DISPLAY_MODE
- self.widgets['description'].label_css_class = 'textarea'
- widget = self.widgets['color']
- alsoProvides(widget, IObjectData)
- widget.object_data = {'ams-colorpicker-position': 'top left'}
+ if 'name' in self.widgets:
+ self.widgets['name'].mode = DISPLAY_MODE
+ if 'description' in self.widgets:
+ self.widgets['description'].widget_css_class = 'textarea'
+ if 'color' in self.widgets:
+ widget = self.widgets['color']
+ alsoProvides(widget, IObjectData)
+ widget.object_data = {'ams-colorpicker-position': 'top left'}
@view_config(name='properties.json', context=IThesaurusExtract, request_type=IPyAMSLayer,
--- a/src/pyams_thesaurus/zmi/term.py Tue Nov 15 10:41:35 2016 +0100
+++ b/src/pyams_thesaurus/zmi/term.py Tue Nov 15 10:42:18 2016 +0100
@@ -73,9 +73,11 @@
def updateWidgets(self, prefix=None):
super(ThesaurusTermAddForm, self).updateWidgets(prefix)
for name in ('definition', 'note'):
- self.widgets[name].label_css_class = 'input textarea'
+ if name in self.widgets:
+ self.widgets[name].widget_css_class = 'input textarea'
for name in ('generic', 'associations', 'usage'):
- self.widgets[name].thesaurus_name = self.context.name
+ if name in self.widgets:
+ self.widgets[name].thesaurus_name = self.context.name
def create(self, data):
return ThesaurusTerm(data.get('label'))
@@ -147,11 +149,14 @@
super(ThesaurusTermEditForm, self).updateWidgets(prefix)
thesaurus = get_parent(self.context, IThesaurus)
for name in ('definition', 'note'):
- self.widgets[name].label_css_class = 'input textarea'
+ if name in self.widgets:
+ self.widgets[name].widget_css_class = 'input textarea'
for name in ('generic', 'specifics', 'associations', 'usage', 'used_for'):
- self.widgets[name].thesaurus_name = thesaurus.name
+ if name in self.widgets:
+ self.widgets[name].thesaurus_name = thesaurus.name
for name in ('specifics', 'used_for', 'extracts', 'created'):
- self.widgets[name].mode = DISPLAY_MODE
+ if name in self.widgets:
+ self.widgets[name].mode = DISPLAY_MODE
def update_content(self, content, data):
term = self.context
--- a/src/pyams_thesaurus/zmi/thesaurus.py Tue Nov 15 10:41:35 2016 +0100
+++ b/src/pyams_thesaurus/zmi/thesaurus.py Tue Nov 15 10:42:18 2016 +0100
@@ -30,7 +30,6 @@
from pyams_thesaurus.zmi.interfaces import IThesaurusTermsMenu, IThesaurusView
from pyams_utils.interfaces import VIEW_PERMISSION, VIEW_SYSTEM_PERMISSION, MANAGE_SYSTEM_PERMISSION
from pyams_utils.interfaces.tree import INode, ITree
-from pyams_zmi.interfaces import IAdminView
from pyams_zmi.interfaces.menu import ISiteManagementMenu, IPropertiesMenu
from pyams_zmi.layer import IAdminLayer
from z3c.form.interfaces import IDataExtractedEvent, DISPLAY_MODE
@@ -40,7 +39,7 @@
from pyams_form.schema import CloseButton
from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.layer import IPyAMSLayer
-from pyams_skin.page import InnerPage, DefaultPageHeaderAdapter
+from pyams_skin.page import DefaultPageHeaderAdapter
from pyams_skin.table import DefaultElementEditorAdapter
from pyams_skin.viewlet.menu import MenuItem
from pyams_skin.viewlet.toolbar import ToolbarMenuItem
@@ -57,6 +56,7 @@
from pyams_viewlet.viewlet import viewlet_config
from pyams_zmi.control_panel import UtilitiesTable
from pyams_zmi.form import AdminDialogAddForm, AdminEditForm
+from pyams_zmi.view import InnerAdminView
from pyramid.events import subscriber
from pyramid.exceptions import NotFound
from pyramid.httpexceptions import HTTPBadRequest
@@ -106,7 +106,8 @@
def updateWidgets(self, prefix=None):
super(ThesaurusAddForm, self).updateWidgets(prefix)
- self.widgets['description'].label_css_class = 'input textarea'
+ if 'description' in self.widgets:
+ self.widgets['description'].widget_css_class = 'input textarea'
def create(self, data):
return Thesaurus()
@@ -205,8 +206,10 @@
def updateWidgets(self, prefix=None):
super(ThesaurusPropertiesEditForm, self).updateWidgets(prefix)
- self.widgets['name'].mode = DISPLAY_MODE
- self.widgets['description'].label_css_class = 'input textarea'
+ if 'name' in self.widgets:
+ self.widgets['name'].mode = DISPLAY_MODE
+ if 'description' in self.widgets:
+ self.widgets['description'].widget_css_class = 'input textarea'
@view_config(name='properties.json', context=IThesaurus, request_type=IPyAMSLayer,
@@ -233,8 +236,8 @@
@pagelet_config(name='terms.html', context=IThesaurus, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
@template_config(template='templates/terms-tree.pt', layer=IPyAMSLayer)
-@implementer(IAdminView, IThesaurusView)
-class ThesaurusTermsView(InnerPage):
+@implementer(IThesaurusView)
+class ThesaurusTermsView(InnerAdminView):
"""Thesaurus terms view"""
def __init__(self, context, request):