Commit fbb90c1a authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: use domsugar instead of DOM API in launcher gadget

parent 25ce6bb7
Pipeline #13012 failed with stage
in 0 seconds
......@@ -30,6 +30,7 @@
<script src="${base_prefix}rsvp.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>
</head>
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>983.59172.56372.41198</string> </value>
<value> <string>988.54689.43253.59187</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1589545308.75</float>
<float>1609513682.22</float>
<string>UTC</string>
</tuple>
</state>
......
/*globals window, document, RSVP, rJS,
URI, location, XMLHttpRequest, console, navigator, Event,
URL*/
URL, domsugar*/
/*jslint indent: 2, maxlen: 80*/
(function (window, document, RSVP, rJS,
XMLHttpRequest, location, console, navigator, Event,
URL) {
URL, domsugar) {
"use strict";
var MAIN_SCOPE = "m",
......@@ -561,7 +561,8 @@
return route(this, 'translation_gadget', 'getTranslationList',
argument_list);
})
.allowPublicAcquisition("getSelectedLanguage", function getSelectedLanguage() {
.allowPublicAcquisition("getSelectedLanguage",
function getSelectedLanguage() {
return route(this, 'translation_gadget', 'getSelectedLanguage');
})
......@@ -724,50 +725,43 @@
})
.push(function () {
var element = gadget.props.content_element,
container = document.createElement("section"),
paragraph,
iframe,
link;
paragraph = document.createElement("p");
paragraph.textContent =
'Please report this unhandled error to the support team, ' +
'and go back to the ';
link = document.createElement("a");
link.href = '#';
link.textContent = 'homepage';
paragraph.appendChild(link);
container.appendChild(paragraph);
container.appendChild(document.createElement("br"));
paragraph = document.createElement("p");
paragraph.textContent = 'Location: ';
link = document.createElement("a");
link.href = link.textContent = window.location.toString();
paragraph.appendChild(link);
container.appendChild(paragraph);
paragraph = document.createElement("p");
paragraph.textContent = 'User-agent: ' + navigator.userAgent;
container.appendChild(paragraph);
paragraph = document.createElement("p");
paragraph.textContent =
'Date: ' + new Date(Date.now()).toISOString();
container.appendChild(paragraph);
paragraph = document.createElement("p");
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);
container;
container = domsugar("section", [
domsugar("p", {
"text": 'Please report this unhandled error to the support ' +
'team, and go back to the '
}, [
domsugar("a", {
"href": "#",
"text": "homepage"
})
]),
domsugar("br"),
domsugar("p", {
"text": 'Location: '
}, [
domsugar("a", {
"href": window.location.toString(),
"text": window.location.toString()
})
]),
domsugar("p", {
"text": 'User-agent: ' + navigator.userAgent
}),
domsugar("p", {
"text": 'Date: ' + new Date(Date.now()).toISOString()
}),
domsugar("p", {
"text": 'Online: ' + navigator.onLine
}),
domsugar("br"),
domsugar("pre", [
domsugar("code", {
"text": gadget.state.error_text
})
])
]);
// Remove the content
while (element.firstChild) {
......@@ -777,9 +771,11 @@
// make an iframe to display error page from XMLHttpRequest.
if (gadget.state.request_error_text) {
iframe = document.createElement('iframe');
container.appendChild(iframe);
iframe.srcdoc = gadget.state.request_error_text;
container.appendChild(
domsugar('iframe', {
"srcdoc": gadget.state.request_error_text
})
);
}
// reset gadget state
......@@ -1008,4 +1004,4 @@
}(window, document, RSVP, rJS,
XMLHttpRequest, location, console, navigator, Event, URL));
XMLHttpRequest, location, console, navigator, Event, URL, domsugar));
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>988.26965.13575.15547</string> </value>
<value> <string>989.7273.32666.52736</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1607016321.86</float>
<float>1609765240.15</float>
<string>UTC</string>
</tuple>
</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