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*/ /*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, document, rJS) { (function (window, document, rJS, JSON) {
"use strict"; "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 () { .declareMethod("getContent", function () {
return {}; return {};
}) })
...@@ -19,7 +13,7 @@ ...@@ -19,7 +13,7 @@
return gadget.getElement() return gadget.getElement()
.push(function (element) { .push(function (element) {
value = options.value; value = options.value;
if (options.value) { if (typeof options.value === "string") {
if (options.value.startsWith("http://") || if (options.value.startsWith("http://") ||
options.value.startsWith("https://")) { options.value.startsWith("https://")) {
a = document.createElement('a'); a = document.createElement('a');
...@@ -32,9 +26,11 @@ ...@@ -32,9 +26,11 @@
pre.innerText = options.value; pre.innerText = options.value;
value = pre.outerHTML; value = pre.outerHTML;
} }
element.innerHTML = value;
} else {
element.innerHTML = JSON.stringify(value);
} }
element.innerHTML = value;
return element; return element;
}); });
}); });
}(window, document, rJS)); }(window, document, rJS, JSON));
\ No newline at end of file \ No newline at end of file
...@@ -222,7 +222,7 @@ ...@@ -222,7 +222,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>superthomas</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>972.17178.36781.34560</string> </value> <value> <string>1000.2322.46712.16657</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1544636507.97</float> <float>1658871156.69</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