Converted to a Go app

This commit is contained in:
Leon Mika 2025-06-19 14:14:46 +02:00
parent 543c1790de
commit d4b3322077
28 changed files with 302 additions and 1 deletions

View file

@ -0,0 +1,31 @@
import { Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js";
export default class extends Controller {
static targets = ["radio", "answerDetails"];
static values = {
answer: String
};
connect() {
}
submitAnswer(ev) {
ev.preventDefault();
this.element.classList.add("reveal");
window.setTimeout(() => {
this.radioTargets.forEach(e => {
e.disabled = true;
if (e.value === this.answerValue) {
e.classList.add("answer");
} else {
e.classList.add("wrong");
}
});
}, 1);
this.answerDetailsTarget.classList.remove("hidden");
}
};

7
public/scripts/main.js Normal file
View file

@ -0,0 +1,7 @@
import { Application } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js";
import PickerController from "./controllers/picker.js";
window.Stimulus = Application.start();
Stimulus.register("picker", PickerController);