Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
4dfd0c6e
Commit
4dfd0c6e
authored
Jan 21, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Ensure that iframe GadgetField are correctly loaded with their data
parent
533a81c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
58 deletions
+83
-58
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_gadgetfield_html.xml
...Item/web_page_module/rjs_gadget_erp5_gadgetfield_html.xml
+4
-3
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_gadgetfield_js.xml
...teItem/web_page_module/rjs_gadget_erp5_gadgetfield_js.xml
+79
-55
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_gadgetfield_html.xml
View file @
4dfd0c6e
...
@@ -121,6 +121,7 @@
...
@@ -121,6 +121,7 @@
\n
\n
</head>
\n
</head>
\n
<body>
\n
<body>
\n
<div></div>
\n
</body>
\n
</body>
\n
</html>
\n
</html>
\n
...
@@ -246,7 +247,7 @@
...
@@ -246,7 +247,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
xiaowu
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -260,7 +261,7 @@
...
@@ -260,7 +261,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
0.17402.52950.42820
</string>
</value>
<value>
<string>
94
6.44927.40202.16725
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -278,7 +279,7 @@
...
@@ -278,7 +279,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
21153002.1
9
</float>
<float>
14
53306099.8
9
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_gadgetfield_js.xml
View file @
4dfd0c6e
...
@@ -99,45 +99,43 @@
...
@@ -99,45 +99,43 @@
</item>
</item>
<item>
<item>
<key>
<string>
text_content
</string>
</key>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*global window, rJS, RSVP
, document
*/\n
<value>
<string>
/*global window, rJS, RSVP*/\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window,
document,
rJS, RSVP) {\n
(function (window, rJS, RSVP) {\n
"use strict";\n
"use strict";\n
function createGadget(gadget) {\n
\n
var gadget_element = document.createElement("div"),\n
function enqueueRender(gadget, options) {\n
suboptions = {},\n
var loop_deferred = gadget.props.loop_defer,\n
field_json = gadget.props.field_json;\n
new_loop_deferred = RSVP.defer();\n
suboptions.value = field_json.default;\n
\n
suboptions.key = field_json.key;\n
gadget.props.loop_defer = new_loop_deferred;\n
suboptions.editable = field_json.editable;\n
\n
gadget.props.element.appendChild(gadget_element);\n
gadget.props.render_queue\n
return new RSVP.Queue()\n
.push(function () {\n
.push(function () {\n
return gadget.declareGadget(field_json.url, {\n
return gadget.props.service_deferred.promise;\n
scope: field_json.key,\n
sandbox: field_json.sandbox,\n
element: gadget_element\n
});\n
})\n
})\n
.push(function (field_gadget) {\n
.push(function (field_gadget) {\n
var iframe;\n
return field_gadget.render(options);\n
gadget.props.field_gadget = field_gadget;\n
})\n
if (field_json.css_class) {\n
.push(function () {\n
gadget_element.setAttribute("class", field_json.css_class);\n
return new_loop_deferred.promise;\n
}\n
if (field_json.sandbox === "iframe") {\n
iframe = gadget_element.querySelector("iframe");\n
iframe.style.width = "100%";\n
iframe.style.height = "100%";\n
}\n
if (field_gadget.render !== undefined) {\n
return field_gadget.render(suboptions);\n
}\n
});\n
});\n
loop_deferred.resolve();\n
}\n
}\n
\n
rJS(window)\n
rJS(window)\n
.ready(function (g) {\n
.ready(function (g) {\n
g.props = {};\n
var loop_defer = RSVP.defer();\n
g.props = {\n
service_deferred: RSVP.defer(),\n
first_render_deferred: RSVP.defer(),\n
render_queue: new RSVP.Queue(),\n
loop_defer: loop_defer\n
};\n
g.props.render_queue\n
.push(function () {\n
return loop_defer.promise;\n
});\n
})\n
})\n
// Assign the element to a variable\n
// Assign the element to a variable\n
.ready(function (g) {\n
.ready(function (g) {\n
...
@@ -151,32 +149,58 @@
...
@@ -151,32 +149,58 @@
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
.declareMethod("render", function (options) {\n
.declareMethod("render", function (options) {\n
var gadget = this;\n
var gadget = this;\n
gadget.props.field_json = options.field_json;\n
\n
if (gadget.props.field_gadget !== undefined) {\n
enqueueRender(gadget, {\n
if (gadget.props.field_gadget.render !== undefined) {\n
key: options.field_json.key,\n
return gadget.props.field_gadget.render({"key" : options.field_json.key,\n
value: options.field_json.default,\n
"value" : options.field_json.default,\n
editable: options.field_json.editable\n
"editable" : options.field_json.editable});\n
});\n
}\n
gadget.props.first_render_deferred.resolve(options.field_json);\n
} else if (gadget.props.field_json.sandbox !== "iframe") {\n
})\n
if (gadget.props.field_json.sandbox === "") {\n
\n
gadget.props.field_json.sandbox = "public";\n
.declareMethod("getContent", function () {\n
}\n
return this.props.field_gadget.getContent();\n
return createGadget(gadget);\n
}\n
})\n
})\n
\n
.declareService(function () {\n
.declareService(function () {\n
var gadget = this;\n
// Add the field in the DOM after the first render method has been called\n
if (gadget.props.field_gadget === undefined) {\n
var gadget = this,\n
return createGadget(gadget);\n
gadget_element = gadget.props.element.querySelector(\'div\'),\n
}\n
field_json;\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.props.first_render_deferred.promise;\n
})\n
.push(function (result) {\n
field_json = result;\n
return gadget.declareGadget(field_json.url, {\n
scope: field_json.key,\n
sandbox: field_json.sandbox,\n
element: gadget_element\n
});\n
})\n
.push(function (field_gadget) {\n
var iframe;\n
if (field_json.css_class) {\n
gadget_element.setAttribute("class", field_json.css_class);\n
}\n
if (field_json.sandbox === "iframe") {\n
iframe = gadget_element.querySelector("iframe");\n
iframe.style.width = "100%";\n
iframe.style.height = "100%";\n
}\n
// Trigger render methods\n
gadget.props.field_gadget = field_gadget;\n
gadget.props.service_deferred.resolve(field_gadget);\n
});\n
})\n
})\n
.declareMethod("getContent", function () {\n
\n
if (this.props.field_gadget.getContent) {\n
\n
return this.props.field_gadget.getContent();\n
.declareService(function () {\n
}\n
// Defer render execution and check errors\n
return this.props.render_queue;\n
});\n
});\n
}(window,
document,
rJS, RSVP));\n
}(window, rJS, RSVP));\n
</string>
</value>
</string>
</value>
</item>
</item>
<item>
<item>
...
@@ -298,7 +322,7 @@
...
@@ -298,7 +322,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
xiaowu
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -312,7 +336,7 @@
...
@@ -312,7 +336,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
0.57981.32712.11997
</string>
</value>
<value>
<string>
94
8.39131.50045.63214
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -330,7 +354,7 @@
...
@@ -330,7 +354,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
23588896.63
</float>
<float>
14
53310168.81
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment