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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
7758aa3d
Commit
7758aa3d
authored
Feb 05, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use jIO getAttachment instead of ajax in translation gadget
parent
a249d771
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
31 deletions
+28
-31
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
...i/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
+9
-8
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_translate_js.xml
...hTemplateItem/web_page_module/rjs_gadget_translate_js.xml
+19
-23
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
View file @
7758aa3d
...
...
@@ -103,7 +103,7 @@
/*global window, document, rJS, RSVP, jQuery, console, jQuery, XMLHttpRequest, loopEventListener, URI, location */\n
/*jslint nomen: true, indent: 2, maxerr: 3 */\n
(function (window, document, rJS, RSVP, $, XMLHttpRequest, console, loopEventListener,
URI,
location) {\n
(function (window, document, rJS, RSVP, $, XMLHttpRequest, console, loopEventListener, location) {\n
"use strict";\n
\n
var DEFAULT_VIEW_REFERENCE = "view";\n
...
...
@@ -257,7 +257,8 @@
\n
// bridge translation gadget\n
.allowPublicAcquisition("getTranslationMethod", function () {\n
return this.props.translation_lookup;\n
var root = (new URI("hateoas/")).absoluteTo(location.href).toString();\n
return root + this.props.translation_lookup;\n
})\n
.allowPublicAcquisition("changeLanguage", function (param_list) {\n
if (this.setLanguage) {\n
...
...
@@ -435,7 +436,7 @@
// XXX translate: called before ready(), so props is not available.\n
// Needed to lookup to retrieve HAL to fetch site module/runner languages \n
.declareMethod(\'getSiteRoot\', function () {\n
return
"hateoas/"
;\n
return
(new URI("hateoas/")).absoluteTo(location.href).toString()
;\n
})\n
\n
// Render the page\n
...
...
@@ -579,7 +580,7 @@
);\n
});\n
\n
}(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener,
URI,
location));
}(window, document, rJS, RSVP, jQuery, XMLHttpRequest, console, loopEventListener, location));
]]>
</string>
</value>
</item>
...
...
@@ -702,7 +703,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -716,7 +717,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
940.
49304.32028.23995
</string>
</value>
<value>
<string>
940.
50639.33715.55517
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -734,8 +735,8 @@
</tuple>
<state>
<tuple>
<float>
1423
067269.0
3
</float>
<string>
GMT
</string>
<float>
1423
147262.7
3
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_translate_js.xml
View file @
7758aa3d
...
...
@@ -114,17 +114,15 @@
cookie_lang = fetchLanguage(),\n
lang = cookie_lang || props.default_language || my_language,\n
path = props.src + "?language=" + lang + "&namespace=dict";\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return my_gadget.jio_ajax({\n
"method": "GET",\n
"url": path,\n
"xhrFields": {"withCredentials": true}\n
return my_gadget.jio_getAttachment({\n
"_id": "erp5",\n
"_attachment": path\n
});\n
})\n
.push(function (my_event) {\n
return
JSON.parse(my_event.target.responseText)
;\n
return
my_event.data
;\n
});\n
}\n
\n
...
...
@@ -164,23 +162,23 @@
]);\n
})\n
.push(function (my_config_list) {\n
var url;\n
url = my_config_list[0]\n
my_gadget.property_dict.src = my_config_list[1];\n
return my_gadget.jio_ajax({\n
"method": "GET",\n
"url": UriTemplate.parse(my_config_list[0]),\n
"xhrFields": {"withCredentials": true}\n
return my_gadget.jio_getAttachment({\n
"_id": "erp5",\n
"_attachment": url\n
});\n
})\n
.push(function (my_hateoas) {\n
var url,\n
site_hal = JSON.parse(my_hateoas.target.responseText);\n
var url;\n
// NOTE: at this point createJIO has not been called yet, so allDocs\n
// is not available and must be called "manually"\n
// XXX: Improve\n
url = UriTemplate.parse(
site_hal
._links.raw_search.href)\n
url = UriTemplate.parse(
my_hateoas.data
._links.raw_search.href)\n
.expand({\n
query: \'portal_type: "Web Site" AND title: "\'\n
+
site_hal
._links.parent.name + \'"\',\n
+
my_hateoas.data
._links.parent.name + \'"\',\n
select_list: [\n
"available_language_set",\n
"default_available_language"\n
...
...
@@ -188,15 +186,13 @@
limit: [0, 1]\n
});\n
\n
return my_gadget.jio_ajax({\n
"type": "GET",\n
"url": url,\n
"xhrFields": {withCredentials: true}\n
return my_gadget.jio_getAttachment({\n
"_id": "erp5",\n
"_attachment": url\n
});\n
})\n
.push(function (my_site_configuration) {\n
var response = JSON.parse(my_site_configuration.target.responseText),\n
web_site = response._embedded.contents[0];\n
var web_site = my_site_configuration.data._embedded.contents[0];\n
// set remaining properties\n
my_gadget.property_dict.language_list =\n
web_site.available_language_set;\n
...
...
@@ -242,7 +238,7 @@
// acquired methods\n
/////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("notifyUpdate", "notifyUpdate")\n
.declareAcquiredMethod("jio_
ajax", "jio_ajax
")\n
.declareAcquiredMethod("jio_
getAttachment", "jio_getAttachment
")\n
.declareAcquiredMethod("getSiteRoot", "getSiteRoot")\n
.declareAcquiredMethod("getTranslationMethod", "getTranslationMethod")\n
\n
...
...
@@ -502,7 +498,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
940.
10185.20882.26419
</string>
</value>
<value>
<string>
940.
50431.23564.44151
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -520,7 +516,7 @@
</tuple>
<state>
<tuple>
<float>
142
0723441.28
</float>
<float>
142
3134793.61
</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