Commit afda535e authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Fixup gadget for render urls on listbox

See merge request !407
parents 33659245 5b98f5ec
Pipeline #22807 failed with stage
in 0 seconds
/*globals console, window, document, rJS, loopEventListener, i18n */
/*globals window, document, rJS, JSON */
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, document, rJS) {
(function (window, document, rJS, JSON) {
"use strict";
var gadget_klass = rJS(window);
gadget_klass
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("translateHtml", "translateHtml")
rJS(window)
.declareMethod("getContent", function () {
return {};
})
......@@ -19,7 +13,7 @@
return gadget.getElement()
.push(function (element) {
value = options.value;
if (options.value) {
if (typeof options.value === "string") {
if (options.value.startsWith("http://") ||
options.value.startsWith("https://")) {
a = document.createElement('a');
......@@ -32,9 +26,11 @@
pre.innerText = options.value;
value = pre.outerHTML;
}
}
element.innerHTML = value;
} else {
element.innerHTML = JSON.stringify(value);
}
return element;
});
});
}(window, document, rJS));
\ No newline at end of file
}(window, document, rJS, JSON));
\ No newline at end of file
......@@ -222,7 +222,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>superthomas</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.17178.36781.34560</string> </value>
<value> <string>1000.2322.46712.16657</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1544636507.97</float>
<float>1658871156.69</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