summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-04-05 15:09:34 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-04-05 15:09:34 +0300
commitcbf71a38424b4c778e3b607cfd52245655ae6a12 (patch)
tree7e9badaf5ead25980f1ca755ca0117b587086a2b
parentc0cd24eb89cac5d8e7480cc13895e47b570c3994 (diff)
refactor: update index.html to match Question model structure
-rw-r--r--components/index.html37
1 files changed, 33 insertions, 4 deletions
diff --git a/components/index.html b/components/index.html
index 68f15ad..c8cf327 100644
--- a/components/index.html
+++ b/components/index.html
@@ -15,17 +15,46 @@
</div>
<div id="feedback"></div>
<div id="options">
- {{range $index, $option := .Options}}
<button
+ data-testid="option1"
hx-post="/answer"
- hx-vals='{"selected": "{{$index}}", "question_id": "{{$.ID}}"}'
+ hx-vals='{"selected": "0", "question_id": "{{.ID}}"}'
hx-target="#feedback"
hx-swap="innerHTML"
class="option-button"
>
- {{$option}}
+ {{.Option1}}
+ </button>
+ <button
+ data-testid="option2"
+ hx-post="/answer"
+ hx-vals='{"selected": "1", "question_id": "{{.ID}}"}'
+ hx-target="#feedback"
+ hx-swap="innerHTML"
+ class="option-button"
+ >
+ {{.Option2}}
+ </button>
+ <button
+ data-testid="option3"
+ hx-post="/answer"
+ hx-vals='{"selected": "2", "question_id": "{{.ID}}"}'
+ hx-target="#feedback"
+ hx-swap="innerHTML"
+ class="option-button"
+ >
+ {{.Option3}}
+ </button>
+ <button
+ data-testid="option4"
+ hx-post="/answer"
+ hx-vals='{"selected": "3", "question_id": "{{.ID}}"}'
+ hx-target="#feedback"
+ hx-swap="innerHTML"
+ class="option-button"
+ >
+ {{.Option4}}
</button>
- {{end}}
</div>
</div>
</body>