Skip to content

Commit

Permalink
[BasicUI] Fix image element being link to a sub page (openhab#2238)
Browse files Browse the repository at this point in the history
Fix openhab#2233

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo authored Jan 1, 2024
1 parent bf2f257 commit b175d1b
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions bundles/org.openhab.ui.basic/web-src/smarthome.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,19 +709,25 @@
_t.periodButton = null;
_t.upscaleButton = null;
_t.refreshButton = null;
_t.displayLegend = _t.parentNode.getAttribute("data-legend") === "true";
_t.period = null;
_t.upscale = false;

_t.legendButton = _t.formHeaderRow.querySelector(o.image.legendButton);
_t.periodButton = _t.formHeaderRow.querySelector(o.image.periodButton);
_t.upscaleButton = _t.formHeaderRow.querySelector(o.image.upscaleButton);
_t.refreshButton = _t.formHeaderRow.querySelector(o.image.refreshButton);
if (_t.legendButton !== null) {
if (_t.displayLegend) {
_t.legendButton.classList.add(o.buttonActiveClass);
} else {
_t.legendButton.classList.remove(o.buttonActiveClass);

if (_t.headerRow !== null) {
_t.legendButton = _t.formHeaderRow.querySelector(o.image.legendButton);
_t.periodButton = _t.formHeaderRow.querySelector(o.image.periodButton);
_t.upscaleButton = _t.formHeaderRow.querySelector(o.image.upscaleButton);
_t.refreshButton = _t.formHeaderRow.querySelector(o.image.refreshButton);
if (_t.legendButton !== null) {
_t.displayLegend = _t.parentNode.getAttribute("data-legend") === "true";
if (_t.displayLegend) {
_t.legendButton.classList.add(o.buttonActiveClass);
} else {
_t.legendButton.classList.remove(o.buttonActiveClass);
}
}
if (_t.periodButton !== null) {
_t.period = null;
}
if (_t.upscaleButton !== null) {
_t.upscale = false;
}
}

Expand Down Expand Up @@ -912,8 +918,9 @@
componentHandler.downgradeElements([ _t.refreshButton ]);
_t.refreshButton.removeEventListener("click", onRefreshClick);
}

_t.parentNode.parentNode.removeEventListener("click", toggleHeaderRow);
if (_t.headerRow !== null) {
_t.parentNode.parentNode.removeEventListener("click", toggleHeaderRow);
}
};

if (_t.legendButton !== null) {
Expand All @@ -928,8 +935,9 @@
if (_t.refreshButton !== null) {
_t.refreshButton.addEventListener("click", onRefreshClick);
}

_t.parentNode.parentNode.addEventListener("click", toggleHeaderRow);
if (_t.headerRow !== null) {
_t.parentNode.parentNode.addEventListener("click", toggleHeaderRow);
}

if (_t.visible) {
_t.activateRefresh();
Expand Down

0 comments on commit b175d1b

Please sign in to comment.