Skip to content

Commit

Permalink
Fix module header update if using customising from module.getHeaders()
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouron committed Dec 26, 2019
1 parent 73be6c3 commit d8b7292
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed
- 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

ℹ️ **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).
Expand Down
17 changes: 9 additions & 8 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ var MM = (function() {
dom.opacity = 0;
wrapper.appendChild(dom);

if (typeof module.getHeader() !== "undefined" && module.getHeader() !== "") {
var moduleHeader = document.createElement("header");
moduleHeader.innerHTML = module.getHeader();
moduleHeader.className = "module-header";
dom.appendChild(moduleHeader);
var moduleHeader = document.createElement("header");
moduleHeader.innerHTML = module.getHeader();
moduleHeader.className = "module-header";
dom.appendChild(moduleHeader);

if (typeof module.getHeader() === "undefined" || module.getHeader() !== "") {
moduleHeader.style = "display: none;";
}

var moduleContent = document.createElement("div");
Expand Down Expand Up @@ -210,9 +212,8 @@ var MM = (function() {
contentWrapper[0].innerHTML = "";
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)
Expand Down

0 comments on commit d8b7292

Please sign in to comment.