Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
dc524389
Commit
dc524389
authored
Oct 03, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
register all gadget in advance so checkAndTriggerReady
can have accurate information for list of all gadgets.
parent
8d5df8ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
renderjs.js
renderjs.js
+17
-4
No files found.
renderjs.js
View file @
dc524389
...
...
@@ -44,8 +44,18 @@ var RenderJs = (function () {
load
:
function
(
root
)
{
/* Load gadget layout by traversing DOM */
var
gadget_list
;
var
gadget_list
,
gadget
,
gadget_id
,
gadget_js
;
gadget_list
=
root
.
find
(
"
[data-gadget]
"
);
// register all gadget in advance so checkAndTriggerReady
// can have accurate information for list of all gadgets
gadget_list
.
each
(
function
()
{
gadget
=
$
(
this
);
gadget_id
=
gadget
.
attr
(
"
id
"
);
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
);
});
// Load chilren
gadget_list
.
each
(
function
()
{
RenderJs
.
loadGadgetFromUrl
(
$
(
this
));
...
...
@@ -65,9 +75,12 @@ var RenderJs = (function () {
app_cache
,
data
,
gadget_js
;
url
=
gadget
.
attr
(
"
data-gadget
"
);
gadget_id
=
gadget
.
attr
(
"
id
"
);
// register gadget in javascript namespace
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
);
gadget_js
=
RenderJs
.
GadgetIndex
.
getGadgetById
(
gadget_id
);
if
(
gadget_js
===
undefined
)
{
// register gadget in javascript namespace if not already registered
gadget_js
=
new
RenderJs
.
Gadget
(
gadget_id
,
gadget
);
RenderJs
.
GadgetIndex
.
registerGadget
(
gadget_js
);
}
// update Gadget's instance with contents of "data-gadget-property"
gadget_property
=
gadget
.
attr
(
"
data-gadget-property
"
);
...
...
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