mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-30 06:31:16 +00:00
Show changes on popout button
This commit is contained in:
@@ -42,7 +42,10 @@ export default class PopoutController extends Controller {
|
||||
close() {
|
||||
// Close if not already closed
|
||||
if (this.dialogTarget.style.display != "none") {
|
||||
// Update button to represent any changes
|
||||
this.buttonTarget.innerText = this.#displayValue();
|
||||
this.buttonTarget.classList.toggle("changed", this.#isChanged());
|
||||
|
||||
this.dialogTarget.style.display = "none";
|
||||
}
|
||||
}
|
||||
@@ -78,6 +81,10 @@ export default class PopoutController extends Controller {
|
||||
return values.filter(Boolean).join();
|
||||
}
|
||||
|
||||
#isChanged() {
|
||||
return this.#enabledDisplayElements().some((element) => element.classList.contains("changed"));
|
||||
}
|
||||
|
||||
#enabledDisplayElements() {
|
||||
return this.displayElements.filter((element) => !element.disabled);
|
||||
}
|
||||
|
||||
@@ -300,9 +300,13 @@
|
||||
color: $color-txt-text;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&.changed {
|
||||
border-color: $color-txt-changed-brd;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover:not(:active):not(:focus) {
|
||||
&:hover:not(:active):not(:focus):not(.changed) {
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user