mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Add report name and details to CSV files
This commit is contained in:
committed by
Maikel Linke
parent
f5a9ec7fa9
commit
0a9eb173ea
31
app/webpacker/controllers/metadata_toggle_controller.js
Normal file
31
app/webpacker/controllers/metadata_toggle_controller.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Controller } from "stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["reportType", "checkbox", "label"];
|
||||
|
||||
handleSelectChange() {
|
||||
this.reportTypeTarget.value == "csv" ?
|
||||
this.enableField():
|
||||
this.disableField();
|
||||
}
|
||||
|
||||
disableField() {
|
||||
if (this.hasCheckboxTarget) {
|
||||
this.checkboxTarget.checked = false;
|
||||
this.checkboxTarget.disabled = true;
|
||||
}
|
||||
if (this.hasLabelTarget) {
|
||||
this.labelTarget.classList.add("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
enableField() {
|
||||
if (this.hasCheckboxTarget) {
|
||||
this.checkboxTarget.checked = true;
|
||||
this.checkboxTarget.disabled = false;
|
||||
}
|
||||
if (this.hasLabelTarget) {
|
||||
this.labelTarget.classList.remove("disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user