Commit 0dbc6b10 authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Aurel

erp5_web_renderjs_ui: use domsugar instead of DOM API in launcher gadget

parent ed983277
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<script src="${base_prefix}rsvp.js"></script> <script src="${base_prefix}rsvp.js"></script>
<script src="${base_prefix}renderjs.js"></script> <script src="${base_prefix}renderjs.js"></script>
<script src="${base_prefix}domsugar.js"></script>
<script src="${base_prefix}erp5_launcher_nojqm.js"></script> <script src="${base_prefix}erp5_launcher_nojqm.js"></script>
</head> </head>
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>983.59172.56372.41198</string> </value> <value> <string>988.54689.43253.59187</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1589545308.75</float> <float>1609513682.22</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*globals window, document, RSVP, rJS, /*globals window, document, RSVP, rJS,
URI, location, XMLHttpRequest, console, navigator, Event, URI, location, XMLHttpRequest, console, navigator, Event,
URL*/ URL, domsugar*/
/*jslint indent: 2, maxlen: 80*/ /*jslint indent: 2, maxlen: 80*/
(function (window, document, RSVP, rJS, (function (window, document, RSVP, rJS,
XMLHttpRequest, location, console, navigator, Event, XMLHttpRequest, location, console, navigator, Event,
URL) { URL, domsugar) {
"use strict"; "use strict";
var MAIN_SCOPE = "m", var MAIN_SCOPE = "m",
...@@ -561,9 +561,10 @@ ...@@ -561,9 +561,10 @@
return route(this, 'translation_gadget', 'getTranslationList', return route(this, 'translation_gadget', 'getTranslationList',
argument_list); argument_list);
}) })
.allowPublicAcquisition("getSelectedLanguage", function getSelectedLanguage() { .allowPublicAcquisition("getSelectedLanguage",
return route(this, 'translation_gadget', 'getSelectedLanguage'); function getSelectedLanguage() {
}) return route(this, 'translation_gadget', 'getSelectedLanguage');
})
.allowPublicAcquisition("redirect", function redirect(param_list) { .allowPublicAcquisition("redirect", function redirect(param_list) {
return route(this, 'router', 'redirect', param_list); return route(this, 'router', 'redirect', param_list);
...@@ -617,9 +618,9 @@ ...@@ -617,9 +618,9 @@
}) })
.allowPublicAcquisition('refreshHeaderAndPanel', .allowPublicAcquisition('refreshHeaderAndPanel',
function acquireRefreshHeaderAndPanel() { function acquireRefreshHeaderAndPanel() {
return refreshHeaderAndPanel(this, true); return refreshHeaderAndPanel(this, true);
}) })
.allowPublicAcquisition('hidePanel', function hidePanel(param_list) { .allowPublicAcquisition('hidePanel', function hidePanel(param_list) {
return hideDesktopPanel(this, param_list[0]); return hideDesktopPanel(this, param_list[0]);
...@@ -724,50 +725,43 @@ ...@@ -724,50 +725,43 @@
}) })
.push(function () { .push(function () {
var element = gadget.props.content_element, var element = gadget.props.content_element,
container = document.createElement("section"), container;
paragraph,
iframe, container = domsugar("section", [
link; domsugar("p", {
"text": 'Please report this unhandled error to the support ' +
paragraph = document.createElement("p"); 'team, and go back to the '
paragraph.textContent = }, [
'Please report this unhandled error to the support team, ' + domsugar("a", {
'and go back to the '; "href": "#",
link = document.createElement("a"); "text": "homepage"
link.href = '#'; })
link.textContent = 'homepage'; ]),
paragraph.appendChild(link); domsugar("br"),
container.appendChild(paragraph); domsugar("p", {
"text": 'Location: '
container.appendChild(document.createElement("br")); }, [
domsugar("a", {
paragraph = document.createElement("p"); "href": window.location.toString(),
paragraph.textContent = 'Location: '; "text": window.location.toString()
link = document.createElement("a"); })
link.href = link.textContent = window.location.toString(); ]),
paragraph.appendChild(link); domsugar("p", {
container.appendChild(paragraph); "text": 'User-agent: ' + navigator.userAgent
}),
paragraph = document.createElement("p"); domsugar("p", {
paragraph.textContent = 'User-agent: ' + navigator.userAgent; "text": 'Date: ' + new Date(Date.now()).toISOString()
container.appendChild(paragraph); }),
domsugar("p", {
paragraph = document.createElement("p"); "text": 'Online: ' + navigator.onLine
paragraph.textContent = }),
'Date: ' + new Date(Date.now()).toISOString(); domsugar("br"),
container.appendChild(paragraph); domsugar("pre", [
domsugar("code", {
paragraph = document.createElement("p"); "text": gadget.state.error_text
paragraph.textContent = 'Online: ' + navigator.onLine; })
container.appendChild(paragraph); ])
]);
container.appendChild(document.createElement("br"));
link = document.createElement("code");
link.textContent = gadget.state.error_text;
paragraph = document.createElement("pre");
paragraph.appendChild(link);
container.appendChild(paragraph);
// Remove the content // Remove the content
while (element.firstChild) { while (element.firstChild) {
...@@ -777,9 +771,11 @@ ...@@ -777,9 +771,11 @@
// make an iframe to display error page from XMLHttpRequest. // make an iframe to display error page from XMLHttpRequest.
if (gadget.state.request_error_text) { if (gadget.state.request_error_text) {
iframe = document.createElement('iframe'); container.appendChild(
container.appendChild(iframe); domsugar('iframe', {
iframe.srcdoc = gadget.state.request_error_text; "srcdoc": gadget.state.request_error_text
})
);
} }
// reset gadget state // reset gadget state
...@@ -1008,4 +1004,4 @@ ...@@ -1008,4 +1004,4 @@
}(window, document, RSVP, rJS, }(window, document, RSVP, rJS,
XMLHttpRequest, location, console, navigator, Event, URL)); XMLHttpRequest, location, console, navigator, Event, URL, domsugar));
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>988.26965.13575.15547</string> </value> <value> <string>989.7273.32666.52736</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1607016321.86</float> <float>1609765240.15</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment