Commit b8c6c386 authored by Romain Courteaud's avatar Romain Courteaud

GadgetField: handle gadget fields loaded from a web site

parent ceb4cb4d
......@@ -41,11 +41,15 @@ class GadgetWidget(Widget.Widget):
return self.render_view(field, value, REQUEST, render_prefix, key)
def render_view(self, field, value, REQUEST=None, render_prefix=None, key=None):
gadget_url = field.get_value('gadget_url')
if gadget_url:
gadget_component = field.restrictedTraverse(gadget_url, None)
if gadget_component is not None:
gadget_url = gadget_component.absolute_url()
kw = {
'data-gadget-sandbox': field.get_value('js_sandbox'),
# Duplicate the absolute url logic of xhtml style
'data-gadget-url': urljoin(field.getPortalObject().absolute_url() + '/',
field.get_value('gadget_url')),
'data-gadget-url': gadget_url,
'data-gadget-value': value,
'data-gadget-renderjs-extra': dumps(dict(field.get_value('renderjs_extra')))
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment