我有一个带有RelationChoice
字段的磁贴,但该字段只有静态html表单元素(“无”单选按钮,文本输入和“搜索”按钮),并且它不响应动态。在将其与另一个有效的网站上的相同磁贴进行比较时,我注意到plone.formwidget.contenttree和plone.formwidget.autocomplete中的特定于字段的js代码未嵌入到磁贴源中。我将断点放在https://github.com/plone/plone.formwidget.autocomplete/blob/master/plone/formwidget/autocomplete/widget.py#L142和https://github.com/plone/plone.formwidget.contenttree/blob/master/plone/formwidget/contenttree/widget.py#L253中,并且在加载磁贴时它们会被击中,并且正在返回正确的js。但我不知道为什么它不会被发送给客户。
有什么想法吗?
磁贴上的其他所有工作正常,并且加载了标准的jquery资源:
++resource++plone.formwidget.autocomplete/jquery.autocomplete.min.js
++resource++plone.formwidget.autocomplete/formwidget-autocomplete.js
++resource++plone.formwidget.contenttree/contenttree.js
这是我的磁贴的zcml:
<plone:tile
name="peps.tiles.calltoaction"
title="PEPS call to action tile"
description="A tile containing a full-size link, enclosing plain text"
add_permission="cmf.ModifyPortalContent"
schema=".tile.ICallToActionData"
class=".tile.CallToActionTile"
template="templates/calltoaction.pt"
permission="zope2.View"
for="*"
/>
这是tile架构和类:
class ICallToActionData(IRichTextTileData):
target = RelationChoice(
title=_(u"Link target"),
description=_(u'Choose the item to which this button will link'),
source=UUIDSourceBinder(),
required=False,
)
link_text = Text(
title=_(u"Link button text"),
description=_(u"The text for the link button at the bottom"),
)
class CallToActionTile(RichTextTile):
def target_url(self):
url = None
if self.data['target']:
obj = uuidUtils.uuidToObject(self.data['target'])
if obj is not None:
if obj.portal_type == "Link":
site_url = getToolByName(obj, 'portal_url')()
if not obj.getRemoteUrl().startswith(site_url):
url = obj.getRemoteUrl()
else:
url = obj.absolute_url()
return url
def link_text(self):
return self.text_value('link_text')
答案 0 :(得分:0)
问题的原因是这些重氮规则:
<drop css:content="body script" />
<after css:theme-children="html body" css:content="html body script" method="raw" />
如果Diazo主题处于活动状态,则在调试问题时停用它总是一个好主意。