Skip to content

Commit

Permalink
webui: style save button
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Apr 14, 2024
1 parent c3ab86b commit dd6bede
Show file tree
Hide file tree
Showing 23 changed files with 15,040 additions and 14,973 deletions.
Binary file modified code/espurna/data/index.all.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.curtain.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.garland.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.light.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.lightfox.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfbridge.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfm69.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.sensor.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.small.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.thermostat.html.gz
Binary file not shown.
4,614 changes: 2,309 additions & 2,305 deletions code/espurna/static/index.all.html.gz.h

Large diffs are not rendered by default.

2,919 changes: 1,462 additions & 1,457 deletions code/espurna/static/index.curtain.html.gz.h

Large diffs are not rendered by default.

2,863 changes: 1,434 additions & 1,429 deletions code/espurna/static/index.garland.html.gz.h

Large diffs are not rendered by default.

4,058 changes: 2,031 additions & 2,027 deletions code/espurna/static/index.light.html.gz.h

Large diffs are not rendered by default.

2,174 changes: 1,089 additions & 1,085 deletions code/espurna/static/index.lightfox.html.gz.h

Large diffs are not rendered by default.

2,238 changes: 1,121 additions & 1,117 deletions code/espurna/static/index.rfbridge.html.gz.h

Large diffs are not rendered by default.

2,939 changes: 1,472 additions & 1,467 deletions code/espurna/static/index.rfm69.html.gz.h

Large diffs are not rendered by default.

3,133 changes: 1,569 additions & 1,564 deletions code/espurna/static/index.sensor.html.gz.h

Large diffs are not rendered by default.

2,833 changes: 1,419 additions & 1,414 deletions code/espurna/static/index.small.html.gz.h

Large diffs are not rendered by default.

2,214 changes: 1,109 additions & 1,105 deletions code/espurna/static/index.thermostat.html.gz.h

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion code/html/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ label {
background: rgb(192, 0, 0); /* redish */
}

.button-update,
.button-setup-password,
.button-add-settings-group,
.button-upgrade-browse,
Expand All @@ -248,6 +247,11 @@ label {
background: rgb(0, 192, 0); /* green */
}

.button-save {
--save-background: grey;
background: var(--save-background);
}

.button-wifi-scan,
.button-more-parent,
.button-simple-action,
Expand Down
20 changes: 19 additions & 1 deletion code/html/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ function applySettings(settings) {
function resetOriginals() {
setOriginalsFromValues();
resetSettingsGroup();

Settings.resetCounters();
Settings.saved = false;
}
Expand Down Expand Up @@ -1302,6 +1303,20 @@ function handleFirmwareUpgrade(event) {
});
}

function greyoutSave() {
const elems = document.querySelectorAll(".button-save");
for (let elem of elems) {
elem.style.removeProperty("--save-background");
}
}

function greenifySave() {
const elems = document.querySelectorAll(".button-save");
for (let elem of elems) {
elem.style.setProperty("--save-background", "rgb(0, 192, 0)");
}
}

function afterSaved() {
var response;

Expand All @@ -1323,6 +1338,7 @@ function afterSaved() {
}

resetOriginals();
greyoutSave();
}

function waitForSaved(){
Expand Down Expand Up @@ -2959,6 +2975,7 @@ function onElementChange(event) {
}
}
setChangedElement(event.target);
greenifySave();
} else {
if (changed) {
--Settings.counters.changed;
Expand All @@ -2967,6 +2984,7 @@ function onElementChange(event) {
}
}
resetChangedElement(event.target);
greyoutSave();
}
}

Expand Down Expand Up @@ -3066,7 +3084,7 @@ function main() {
// Sidebar menu & buttons
elementSelectorOnClick(".menu-link", toggleMenu);
elementSelectorOnClick(".pure-menu-link", showPanel);
elementSelectorOnClick(".button-update", (event) => {
elementSelectorOnClick(".button-save", (event) => {
event.preventDefault();
applySettingsFromAllForms();
});
Expand Down
2 changes: 1 addition & 1 deletion code/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ <h2>Before using this device you have to change the default password for the use
</ul>

<div class="main-buttons">
<button type="button" class="pure-button button-update">Save</button>
<button type="button" class="pure-button button-save">Save</button>
<button type="button" class="pure-button button-reconnect">Reconnect</button>
<button type="button" class="pure-button button-reboot">Reboot</button>
</div>
Expand Down

0 comments on commit dd6bede

Please sign in to comment.