Commit c57b1552 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Render external links on connection parameters.

parent bf2f828e
/*globals console, window, rJS, RSVP, loopEventListener, i18n, Handlebars $*/
/*globals console, window, document, rJS, RSVP, loopEventListener, i18n, Handlebars $*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, RSVP, Handlebars) {
(function (window, document, rJS, RSVP, Handlebars) {
"use strict";
var gadget_klass = rJS(window);
......@@ -15,11 +15,21 @@
return {};
})
.declareMethod("render", function (options) {
var gadget = this;
var gadget = this, a, value;
return gadget.getElement()
.push(function (element) {
element.innerHTML = options.value;
return element;
});
.push(function (element) {
value = options.value;
if (options.value &&
(options.value.startsWith("http://") ||
options.value.startsWith("https://"))) {
a = document.createElement('a');
a.setAttribute("href", options.value);
a.setAttribute("target", "_blank");
a.innerText = options.value;
value = a.outerHTML;
}
element.innerHTML = value;
return element;
});
});
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
}(window, document, rJS, RSVP, Handlebars));
\ No newline at end of file
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>965.40908.63104.20514</string> </value>
<value> <string>965.40941.62497.477</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1519139430.27</float>
<float>1519141899.05</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