Skip to content
Snippets Groups Projects
Commit d3d0afd3 authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon: Committed by Reiter, Christoph
Browse files

Make span clickable like img, add cursor/pointer

parent d94a4d1a
No related branches found
No related tags found
No related merge requests found
...@@ -117,6 +117,14 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement { ...@@ -117,6 +117,14 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
case "value": case "value":
case "entry-point-url": case "entry-point-url":
this.html = ''; this.html = '';
const img = this._('#A2');
if (img !== null) {
img.src = this.eyeOpen;
}
const div = this._('#A1');
if (div !== null) {
div.style.display = 'none';
}
break; break;
case "text": case "text":
this.class = this.text !== '' ? 'has-text' : ''; this.class = this.text !== '' ? 'has-text' : '';
...@@ -128,17 +136,17 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement { ...@@ -128,17 +136,17 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
} }
toggle(e) { toggle(e) {
const element = this._('#A1'); const div = this._('#A1');
const img = e.target; const img = this._('#A2');
const d = element.style.display; const d = div.style.display;
if(d === '' || d === 'none') { if(d === '' || d === 'none') {
element.style.display = 'block'; div.style.display = 'block';
img.src = this.eyeClose; img.src = this.eyeClose;
} else { } else {
element.style.display = 'none'; div.style.display = 'none';
img.src = this.eyeOpen; img.src = this.eyeOpen;
} }
if (this.html === '' && element.style.display !== 'none') { if (this.html === '' && div.style.display !== 'none') {
this.loadWebPageElement(); this.loadWebPageElement();
} }
} }
...@@ -150,8 +158,9 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement { ...@@ -150,8 +158,9 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
<style> <style>
.kb {display: none} .kb {display: none}
span.has-text img {margin-left: 5px} span.has-text img {margin-left: 5px}
span.with-pointer { cursor: pointer; }
</style> </style>
<span class="${this.class}">${this.text}<img src='${this.eyeOpen}' @click="${this.toggle}" alt="open/close"></span> <span class="with-pointer ${this.class}" @click="${this.toggle}">${this.text}<img src="${this.eyeOpen}" id="A2" alt="open/close"></span>
<div class='kb' id="A1"> <div class='kb' id="A1">
${unsafeHTML(this.html)} ${unsafeHTML(this.html)}
${this.error} ${this.error}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment