1
votes

I have a tile with a RelationChoice field, but the field just has the static html form elements (a "nothing" radio button, a text input and a 'Search' button), and it does not respond dynamically. In comparing it with an identical tile on another site that works, I noticed that the field-specific js code from plone.formwidget.contenttree and plone.formwidget.autocomplete is not embedded in the tile source. I put breakpoints in https://github.com/plone/plone.formwidget.autocomplete/blob/master/plone/formwidget/autocomplete/widget.py#L142 and in https://github.com/plone/plone.formwidget.contenttree/blob/master/plone/formwidget/contenttree/widget.py#L253, and they are getting hit when the tile loads, and the proper js is being returned. But I don't know why it doesn't get sent to the client.

Any ideas?

Everything else on the tile works fine, and the standard jquery resources are loaded:

++resource++plone.formwidget.autocomplete/jquery.autocomplete.min.js
++resource++plone.formwidget.autocomplete/formwidget-autocomplete.js
++resource++plone.formwidget.contenttree/contenttree.js

Here is the zcml for my tile:

  <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="*"
      />

And here is the tile schema and class:

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')

  • Plone 4.2.5
  • plone.app.tiles 1.0.1
  • plone.formwidget.contenttree 1.0.6
  • plone.formwidget.autocomplete 1.2.4
1

1 Answers

0
votes

The cause of the problem were these Diazo rules:

    <drop css:content="body script" />
    <after css:theme-children="html body" css:content="html body script" method="raw" />

If a Diazo theme is active, it's always a good idea to deactivate it when debugging issues.