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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
e3af03a2
Commit
e3af03a2
authored
Oct 11, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Update WIP renderJS version
parent
2f3d99e2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
28 deletions
+31
-28
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js
...js_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js
+29
-26
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
...s_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js
View file @
e3af03a2
...
...
@@ -1087,7 +1087,7 @@ if (typeof document.contains !== 'function') {
}
function
loadSubGadgetDOMDeclaration
(
g
)
{
var
element_list
=
g
.
__
element
.
querySelectorAll
(
'
[data-gadget-url]
'
),
var
element_list
=
g
.
element
.
querySelectorAll
(
'
[data-gadget-url]
'
),
element
,
promise_list
=
[],
scope
,
...
...
@@ -1124,6 +1124,10 @@ if (typeof document.contains !== 'function') {
this
.
state
=
JSON
.
parse
(
json_state
);
});
};
RenderJSGadget
.
onStateChange
=
function
(
callback
)
{
this
.
prototype
.
__state_change_callback
=
callback
;
return
this
;
};
RenderJSGadget
.
__service_list
=
[];
RenderJSGadget
.
declareService
=
function
(
callback
)
{
...
...
@@ -1133,7 +1137,7 @@ if (typeof document.contains !== 'function') {
RenderJSGadget
.
onEvent
=
function
(
type
,
callback
,
use_capture
,
prevent_default
)
{
this
.
__service_list
.
push
(
function
()
{
return
loopEventListener
(
this
.
__
element
,
type
,
use_capture
,
return
loopEventListener
(
this
.
element
,
type
,
use_capture
,
callback
.
bind
(
this
),
prevent_default
);
});
return
this
;
...
...
@@ -1237,16 +1241,11 @@ if (typeof document.contains !== 'function') {
})
.
declareMethod
(
'
getElement
'
,
function
()
{
// Returns the DOM Element of a gadget
if
(
this
.
__element
===
undefined
)
{
// XXX Kept for compatibility. Use element property directly
if
(
this
.
element
===
undefined
)
{
throw
new
Error
(
"
No element defined
"
);
}
return
this
.
__element
;
})
.
declareMethod
(
'
render
'
,
function
()
{
return
;
})
.
declareMethod
(
'
updateDOM
'
,
function
()
{
return
;
return
this
.
element
;
})
.
declareMethod
(
'
changeState
'
,
function
(
state_dict
)
{
var
key
,
...
...
@@ -1259,8 +1258,8 @@ if (typeof document.contains !== 'function') {
modified
=
true
;
}
}
if
(
modified
)
{
return
this
.
updateDOM
(
modification_dict
);
if
(
modified
&&
this
.
__state_change_callback
!==
undefined
)
{
return
this
.
__state_change_callback
(
modification_dict
);
}
});
...
...
@@ -1352,6 +1351,8 @@ if (typeof document.contains !== 'function') {
RenderJSGadget
.
ready
;
RenderJSEmbeddedGadget
.
setState
=
RenderJSGadget
.
setState
;
RenderJSEmbeddedGadget
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
RenderJSEmbeddedGadget
.
declareService
=
RenderJSGadget
.
declareService
;
RenderJSEmbeddedGadget
.
onEvent
=
...
...
@@ -1384,11 +1385,10 @@ if (typeof document.contains !== 'function') {
template_node_list
=
Klass
.
__template_element
.
body
.
childNodes
;
gadget_loading_klass
=
Klass
;
gadget_instance
=
new
Klass
();
gadget_instance
.
__element
=
options
.
element
;
gadget_instance
.
element
=
options
.
element
;
gadget_instance
.
state
=
{};
for
(
i
=
0
;
i
<
template_node_list
.
length
;
i
+=
1
)
{
gadget_instance
.
__
element
.
appendChild
(
gadget_instance
.
element
.
appendChild
(
template_node_list
[
i
].
cloneNode
(
true
)
);
}
...
...
@@ -1432,6 +1432,8 @@ if (typeof document.contains !== 'function') {
RenderJSGadget
.
ready
;
RenderJSIframeGadget
.
setState
=
RenderJSGadget
.
setState
;
RenderJSIframeGadget
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
RenderJSIframeGadget
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
RenderJSIframeGadget
.
declareService
=
RenderJSGadget
.
declareService
;
...
...
@@ -1464,7 +1466,6 @@ if (typeof document.contains !== 'function') {
// gadget_instance.element.setAttribute("seamless", "seamless");
iframe
.
setAttribute
(
"
src
"
,
url
);
gadget_instance
.
__path
=
url
;
gadget_instance
.
__element
=
options
.
element
;
gadget_instance
.
element
=
options
.
element
;
gadget_instance
.
state
=
{};
// Attach it to the DOM
...
...
@@ -1661,16 +1662,16 @@ if (typeof document.contains !== 'function') {
}
}
parent_gadget
.
__sub_gadget_dict
[
scope
]
=
gadget_instance
;
gadget_instance
.
__
element
.
setAttribute
(
"
data-gadget-scope
"
,
gadget_instance
.
element
.
setAttribute
(
"
data-gadget-scope
"
,
scope
);
// Put some attribute to ease page layout comprehension
gadget_instance
.
__
element
.
setAttribute
(
"
data-gadget-url
"
,
url
);
gadget_instance
.
__
element
.
setAttribute
(
"
data-gadget-sandbox
"
,
gadget_instance
.
element
.
setAttribute
(
"
data-gadget-url
"
,
url
);
gadget_instance
.
element
.
setAttribute
(
"
data-gadget-sandbox
"
,
options
.
sandbox
);
gadget_instance
.
__
element
.
_gadget
=
gadget_instance
;
gadget_instance
.
element
.
_gadget
=
gadget_instance
;
if
(
document
.
contains
(
gadget_instance
.
__
element
))
{
if
(
document
.
contains
(
gadget_instance
.
element
))
{
// Put a timeout
queue
.
push
(
startService
);
}
...
...
@@ -1833,6 +1834,8 @@ if (typeof document.contains !== 'function') {
RenderJSGadget
.
ready
;
tmp_constructor
.
setState
=
RenderJSGadget
.
setState
;
tmp_constructor
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
tmp_constructor
.
declareService
=
RenderJSGadget
.
declareService
;
tmp_constructor
.
onEvent
=
...
...
@@ -2010,6 +2013,7 @@ if (typeof document.contains !== 'function') {
tmp_constructor
.
__ready_list
=
RenderJSGadget
.
__ready_list
.
slice
();
tmp_constructor
.
ready
=
RenderJSGadget
.
ready
;
tmp_constructor
.
setState
=
RenderJSGadget
.
setState
;
tmp_constructor
.
onStateChange
=
RenderJSGadget
.
onStateChange
;
tmp_constructor
.
__service_list
=
RenderJSGadget
.
__service_list
.
slice
();
tmp_constructor
.
declareService
=
RenderJSGadget
.
declareService
;
...
...
@@ -2163,12 +2167,11 @@ if (typeof document.contains !== 'function') {
}
}
tmp_constructor
.
__template_element
=
document
.
createElement
(
"
div
"
);
root_gadget
.
__element
=
document
.
body
;
root_gadget
.
element
=
document
.
body
;
root_gadget
.
state
=
{};
for
(
j
=
0
;
j
<
root_gadget
.
__
element
.
childNodes
.
length
;
j
+=
1
)
{
for
(
j
=
0
;
j
<
root_gadget
.
element
.
childNodes
.
length
;
j
+=
1
)
{
tmp_constructor
.
__template_element
.
appendChild
(
root_gadget
.
__
element
.
childNodes
[
j
].
cloneNode
(
true
)
root_gadget
.
element
.
childNodes
[
j
].
cloneNode
(
true
)
);
}
RSVP
.
all
([
root_gadget
.
getRequiredJSList
(),
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
View file @
e3af03a2
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
954.
12913.34971.42393
</string>
</value>
<value>
<string>
954.
33025.37475.1638
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
147
5850999.47
</float>
<float>
147
6192938.84
</float>
<string>
UTC
</string>
</tuple>
</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