mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Merge pull request #1838 from tbouron/fix/module-header
Module header updates correctly, if a module need to dynamically show/hide its header based on a condition
This commit is contained in:
commit
05f710cb5c
@ -27,7 +27,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed issue in weatherforecast module where predicted amount of rain was not using the decimal symbol specified in config.js.
|
- Fixed issue in weatherforecast module where predicted amount of rain was not using the decimal symbol specified in config.js.
|
||||||
|
- Module header now updates correctly, if a module need to dynamically show/hide its header based on a condition.
|
||||||
|
|
||||||
## [2.9.0] - 2019-10-01
|
## [2.9.0] - 2019-10-01
|
||||||
|
|
||||||
ℹ️ **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`. If you are having issues running Electron, make sure your [Raspbian is up to date](https://www.raspberrypi.org/documentation/raspbian/updating.md).
|
ℹ️ **Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`. If you are having issues running Electron, make sure your [Raspbian is up to date](https://www.raspberrypi.org/documentation/raspbian/updating.md).
|
||||||
|
17
js/main.js
17
js/main.js
@ -39,11 +39,13 @@ var MM = (function() {
|
|||||||
dom.opacity = 0;
|
dom.opacity = 0;
|
||||||
wrapper.appendChild(dom);
|
wrapper.appendChild(dom);
|
||||||
|
|
||||||
if (typeof module.getHeader() !== "undefined" && module.getHeader() !== "") {
|
var moduleHeader = document.createElement("header");
|
||||||
var moduleHeader = document.createElement("header");
|
moduleHeader.innerHTML = module.getHeader();
|
||||||
moduleHeader.innerHTML = module.getHeader();
|
moduleHeader.className = "module-header";
|
||||||
moduleHeader.className = "module-header";
|
dom.appendChild(moduleHeader);
|
||||||
dom.appendChild(moduleHeader);
|
|
||||||
|
if (typeof module.getHeader() === "undefined" || module.getHeader() !== "") {
|
||||||
|
moduleHeader.style = "display: none;";
|
||||||
}
|
}
|
||||||
|
|
||||||
var moduleContent = document.createElement("div");
|
var moduleContent = document.createElement("div");
|
||||||
@ -210,9 +212,8 @@ var MM = (function() {
|
|||||||
contentWrapper[0].innerHTML = "";
|
contentWrapper[0].innerHTML = "";
|
||||||
contentWrapper[0].appendChild(newContent);
|
contentWrapper[0].appendChild(newContent);
|
||||||
|
|
||||||
if( headerWrapper.length > 0 && newHeader) {
|
headerWrapper[0].innerHTML = newHeader;
|
||||||
headerWrapper[0].innerHTML = newHeader;
|
headerWrapper[0].style = headerWrapper.length > 0 && newHeader ? undefined : "display: none;";
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* hideModule(module, speed, callback)
|
/* hideModule(module, speed, callback)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user