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
Léo-Paul Géneau
erp5
Commits
2234bc8a
Commit
2234bc8a
authored
May 26, 2015
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Factorize multiple functions
parent
9c95a5c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
57 deletions
+47
-57
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
...i/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
+47
-57
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
View file @
2234bc8a
...
@@ -119,6 +119,19 @@
...
@@ -119,6 +119,19 @@
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
// Some functions\n
// Some functions\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
function route(my_root_gadget, my_scope, my_method, my_param_list) {\n
return RSVP.Queue()\n
.push(function () {\n
return my_root_gadget.getDeclaredGadget(my_scope);\n
})\n
.push(function (my_gadget) {\n
if (my_param_list) {\n
return my_gadget[my_method].apply(my_gadget, my_param_list);\n
}\n
return my_gadget[my_method]();\n
});\n
}\n
\n
function createJio(gadget) {\n
function createJio(gadget) {\n
return gadget.getDeclaredGadget("jio_gadget")\n
return gadget.getDeclaredGadget("jio_gadget")\n
.push(function (jio_gadget) {\n
.push(function (jio_gadget) {\n
...
@@ -270,43 +283,29 @@
...
@@ -270,43 +283,29 @@
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("pleaseRedirectMyHash",
"pleaseRedirectMyHash")\n
.declareAcquiredMethod("pleaseRedirectMyHash",
"pleaseRedirectMyHash")\n
\n
\n
/////////////////////////////////////////////////////////////////\n
//
published
methods\n
/////////////////////////////////////////////////////////////////\n
//
bridge
translation
gadget\n
//
bridge
translation
gadget\n
//
XXX:
fix
translations,
getTranslationMethod
not
used,
no?\n
.allowPublicAcquisition("getTranslationMethod",
function
()
{\n
.allowPublicAcquisition("getTranslationMethod",
function
()
{\n
var
root =
(new
URI(this.props.hateoas_url)).absoluteTo(location.href).toString();\n
var
root =
(new
URI(this.props.hateoas_url)).absoluteTo(location.href).toString();\n
return
root
+
this.props.translation_lookup;\n
return
root
+
this.props.translation_lookup;\n
})\n
})\n
.allowPublicAcquisition("changeLanguage",
function
(param_list)
{\n
.allowPublicAcquisition("changeLanguage",
function
(param_list)
{\n
if
(this.setLanguage)
{\n
if
(this.setLanguage)
{\n
return
this.getDeclaredGadget("translate")\n
return
route(this,
"translate",
"changeLanguage",
param_list);\n
.push(function
(translation_gadget)
{\n
return
translation_gadget.changeLanguage.apply(\n
translation_gadget,\n
param_list\n
);\n
});\n
}\n
}\n
})\n
})\n
.allowPublicAcquisition("getLanguageList",
function
(param_list)
{\n
.allowPublicAcquisition("getLanguageList",
function
(param_list)
{\n
if
(this.setLanguage)
{\n
if
(this.setLanguage)
{\n
return
this.getDeclaredGadget("translate")\n
return
route(this,
"translate",
"getLanguageList",
param_list);\n
.push(function
(translation_gadget)
{\n
return
translation_gadget.getLanguageList.apply(\n
translation_gadget,\n
param_list\n
);\n
});\n
}\n
}\n
return
JSON.stringify([]);\n
return
JSON.stringify([]);\n
})\n
})\n
.allowPublicAcquisition("translateHtml",
function
(param_list)
{\n
.allowPublicAcquisition("translateHtml",
function
(param_list)
{\n
if
(this.setLanguage)
{\n
if
(this.setLanguage)
{\n
return
this.getDeclaredGadget("translate")\n
return
route(this,
"translate",
"translateHtml",
param_list);\n
.push(function
(translation_gadget)
{\n
return
translation_gadget.translateHtml.apply(\n
translation_gadget,\n
param_list\n
);\n
});\n
}\n
}\n
return
param_list;\n
return
param_list;\n
})\n
})\n
...
@@ -341,14 +340,12 @@
...
@@ -341,14 +340,12 @@
.push(function
(jio_gadget)
{\n
.push(function
(jio_gadget)
{\n
return
jio_gadget.getAttachment(\n
return
jio_gadget.getAttachment(\n
param_list[0]._id,\n
param_list[0]._id,\n
param_list[0]._attachment\n
param_list[0]._attachment,\n
{format:
"json"}\n
);\n
);\n
})\n
})\n
.push(function
(response)
{\n
.push(function
(json)
{\n
return
jIO.util.readBlobAsText(response);\n
return
{data:
json};\n
})\n
.push(function
(event)
{\n
return
{data:
JSON.parse(event.target.result)};\n
});\n
});\n
})\n
})\n
.allowPublicAcquisition("whoWantToDisplayThis",
function
(param_list)
{\n
.allowPublicAcquisition("whoWantToDisplayThis",
function
(param_list)
{\n
...
@@ -413,45 +410,38 @@
...
@@ -413,45 +410,38 @@
}\n
}\n
return displayError(this, param_list[0]);\n
return displayError(this, param_list[0]);\n
})\n
})\n
// XXX translate: while header calls render on ready, this is needed to\n
\n
// update the header once translations are available\n
// bridge notifications\n
// XXX: called twice, 2nd time after header loaded to translate header\n
.allowPublicAcquisition(\'notifyUpdate\', function () {\n
.allowPublicAcquisition(\'notifyUpdate\', function () {\n
return this.getDeclaredGadget("header")\n
return route(this, "header", \'notifyUpdate\');\n
.push(function (header_gadget) {\n
return header_gadget.notifyUpdate();\n
});\n
})\n
})\n
.allowPublicAcquisition(\'notifySubmitting\', function () {\n
.allowPublicAcquisition(\'notifySubmitting\', function () {\n
return this.getDeclaredGadget("header")\n
return route(this, "header", \'notifySubmitting\');\n
.push(function (header_gadget) {\n
return header_gadget.notifySubmitting();\n
});\n
})\n
})\n
\n
\n
.allowPublicAcquisition(\'notifySubmitted\', function () {\n
.allowPublicAcquisition(\'notifySubmitted\', function () {\n
return this.getDeclaredGadget("header")\n
return route(this, "header", "notifySubmitted");\n
.push(function (header_gadget) {\n
return header_gadget.notifySubmitted();\n
});\n
})\n
})\n
.allowPublicAcquisition(\'notifyChange\', function () {\n
.allowPublicAcquisition(\'notifyChange\', function () {\n
return this.getDeclaredGadget("header")\n
return route(this, "header", \'notifyChange\');\n
.push(function (header_gadget) {\n
})\n
return header_gadget.notifyChange();\n
.allowPublicAcquisition(\'notifyLoading\', function () {\n
});\n
return route(this, "pg", "notifyLoading");\n
})\n
.allowPublicAcquisition(\'notifyLoaded\', function () {\n
return route(this, "pg", "notifyLoaded");\n
})\n
})\n
.allowPublicAcquisition(\'triggerSubmit\', function () {\n
.allowPublicAcquisition(\'triggerSubmit\', function () {\n
return this.getDeclaredGadget("pg")\n
return route(this, "pg", "triggerSubmit");\n
.push(function (page_gadget) {\n
return page_gadget.triggerSubmit();\n
});\n
})\n
})\n
\n
// bridge panel\n
.allowPublicAcquisition(\'triggerPanel\', function () {\n
.allowPublicAcquisition(\'triggerPanel\', function () {\n
return this.getDeclaredGadget("panel")\n
return route(this, "panel", "toggle");\n
.push(function (panel_gadget) {\n
return panel_gadget.toggle();\n
});\n
})\n
})\n
\n
// root\n
.allowPublicAcquisition(\'getSiteRoot\', function () {\n
.allowPublicAcquisition(\'getSiteRoot\', function () {\n
return this.getSiteRoot();\n
return this.getSiteRoot();\n
})\n
})\n
...
@@ -735,7 +725,7 @@
...
@@ -735,7 +725,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
xiaowu
</string>
</value>
<value>
<string>
romain
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -749,7 +739,7 @@
...
@@ -749,7 +739,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
94
2.21393.17345.64221
</string>
</value>
<value>
<string>
94
3.18096.34625.39714
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -767,8 +757,8 @@
...
@@ -767,8 +757,8 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
28997594.
5
</float>
<float>
14
32645716.4
5
</float>
<string>
UTC
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
</object>
</object>
...
...
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