mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
28 lines
650 B
JavaScript
28 lines
650 B
JavaScript
import ApplicationController from "./application_controller";
|
|
|
|
export default class extends ApplicationController {
|
|
static targets = ["filename", "fileinput"];
|
|
static values = {
|
|
message: String,
|
|
};
|
|
|
|
connect() {
|
|
super.connect();
|
|
this.fileinputTarget.addEventListener("change", (event) => {
|
|
this.filenameTarget.innerText = event.target.files[0].name;
|
|
});
|
|
}
|
|
|
|
remove(event) {
|
|
let confirmation = confirm(this.messageValue);
|
|
if (confirmation) {
|
|
location.hash = "";
|
|
this.stimulate("EnterpriseEdit#remove_terms_and_conditions", event.target);
|
|
}
|
|
}
|
|
|
|
add() {
|
|
this.fileinputTarget.click();
|
|
}
|
|
}
|