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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
15dc79be
Commit
15dc79be
authored
May 18, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate global variables into library namespace.
parent
aa113bd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
51 deletions
+58
-51
bt5/erp5_jquery_plugin_renderjs/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/renderjs/renderjs.js.xml
..._skins/erp5_jquery/jquery/plugin/renderjs/renderjs.js.xml
+57
-50
bt5/erp5_jquery_plugin_renderjs/bt/revision
bt5/erp5_jquery_plugin_renderjs/bt/revision
+1
-1
No files found.
bt5/erp5_jquery_plugin_renderjs/PathTemplateItem/portal_skins/erp5_jquery/jquery/plugin/renderjs/renderjs.js.xml
View file @
15dc79be
...
...
@@ -12,7 +12,7 @@
</item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts373
23241.04
</string>
</value>
<value>
<string>
ts373
39345.5
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
...
...
@@ -32,55 +32,15 @@ if (typeof console === "undefined" || typeof console.log === "undefined") {\n
console.log = function() {};\n
}\n
\n
var is_ready;\n
is_ready = false; // XXX: dirty flag to be removed (indicates if ready event has been handled)\n
\n
\n
/*\n
* Javascript Gadget representation\n
*/\n
function Gadget(id, dom) {\n
this.id = id;\n
this.dom = dom;\n
this.is_ready = false;\n
}\n
\n
Gadget.prototype.getId = function() {\n
return this.id;\n
};\n
\n
Gadget.prototype.getDom = function() {\n
return this.dom;\n
};\n
\n
Gadget.prototype.isReady = function() {\n
/*\n
* Return True if remote gadget is loaded into DOM.\n
*/\n
return this.is_ready;\n
};\n
\n
Gadget.prototype.setReady = function() {\n
/*\n
* Return True if remote gadget is loaded into DOM.\n
*/\n
this.is_ready = true;\n
};\n
\n
\n
Gadget.prototype.getParent = function() {\n
/*\n
* Get Gadget\'s parent by using DOM\n
*/\n
// XXX:\n
};\n
\n
\n
/*\n
* Generic Gadget library renderer\n
*/\n
\n
var RenderJs = (function () {\n
\n
// a variable indicating if current gadget loading is over or not\n
var is_ready = false;\n
\n
return {\n
\n
...
...
@@ -114,7 +74,7 @@ var RenderJs = (function () {\n
gadget_id = gadget.attr("id");\n
\n
// register gadget in javascript namespace\n
gadget_js = new Gadget(gadget_id, gadget);\n
gadget_js = new
RenderJs.
Gadget(gadget_id, gadget);\n
RenderJs.GadgetIndex.registerGadget(gadget_js);\n
\n
if (url!==undefined && url!==""){\n
...
...
@@ -172,6 +132,20 @@ var RenderJs = (function () {\n
}\n
},\n
\n
isReady: function (value) {\n
/*\n
* Get rendering status\n
*/\n
return is_ready;\n
},\n
\n
setReady: function (value) {\n
/*\n
* Update rendering status\n
*/\n
is_ready = value; \n
},\n
\n
checkAndTriggerReady: function() {\n
/*\n
* Trigger "ready" event only if all gadgets were marked as "ready"\n
...
...
@@ -179,11 +153,13 @@ var RenderJs = (function () {\n
var is_gadget_list_loaded;\n
is_gadget_list_loaded = RenderJs.GadgetIndex.isGadgetListLoaded();\n
if (is_gadget_list_loaded){\n
if (!is_ready) {\n
//console.log("trigger");\n
//console.log("to trigger ");\n
if (!RenderJs.isReady()) {\n
//console.log("trigger ", RenderJs.GadgetIndex.getGadgetList());\n
RenderJs.GadgetIndex.getRootGadget().getDom().trigger("ready");\n
RenderJs.setReady(true);\n
}\n
is_ready = true;\n
//
is_ready = true;\n
}\n
return is_gadget_list_loaded;\n
},\n
...
...
@@ -304,6 +280,37 @@ var RenderJs = (function () {\n
\n
}}()),\n
\n
Gadget: ( function (id, dom) {\n
/*\n
* Javascript Gadget representation\n
*/\n
this.id = id;\n
this.dom = dom;\n
this.is_ready = false;\n
\n
this.getId = function() {\n
return this.id;\n
};\n
\n
this.getDom = function() {\n
return this.dom;\n
};\n
\n
this.isReady = function() {\n
/*\n
* Return True if remote gadget is loaded into DOM.\n
*/\n
return this.is_ready;\n
};\n
\n
this.setReady = function() {\n
/*\n
* Return True if remote gadget is loaded into DOM.\n
*/\n
this.is_ready = true;\n
};\n
}),\n
\n
TabbularGadget : (function () {\n
/*\n
* Generic tabular gadget\n
...
...
@@ -337,7 +344,7 @@ var RenderJs = (function () {\n
// XXX: we should unregister all gadgets (if any we replace now in DOM)\n
\n
// render new gadget\n
is_ready = false
;\n
RenderJs.setReady(false)
;\n
RenderJs.loadGadgetFromUrl(tab_gadget);\n
// clear previous events\n
RenderJs.GadgetIndex.getRootGadget().getDom().bind("ready", function (){\n
...
...
@@ -482,7 +489,7 @@ var RenderJs = (function () {\n
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
1
8703
</int>
</value>
<value>
<int>
1
9475
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
...
...
bt5/erp5_jquery_plugin_renderjs/bt/revision
View file @
15dc79be
18
\ No newline at end of file
19
\ No newline at end of file
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