diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-04-06 10:04:22 +0300 | 
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-04-06 10:04:22 +0300 | 
| commit | 1e5faf9b609fa230d763bccdd8520441c5498a15 (patch) | |
| tree | 17a92182b49f1222b377fb009a9eff70a84b6a35 /components/question.html | |
| parent | 95c3ebfaf9fdb1e65e3dfaef177e4b6d20344009 (diff) | |
Feat: add mixed exercsises
Diffstat (limited to 'components/question.html')
| -rw-r--r-- | components/question.html | 75 | 
1 files changed, 75 insertions, 0 deletions
diff --git a/components/question.html b/components/question.html new file mode 100644 index 0000000..ef4618b --- /dev/null +++ b/components/question.html @@ -0,0 +1,75 @@ +{{define "question"}} +<div id="question"> +      {{if .Requirement}} +      <p>{{.Requirement}}</p> +      {{end}} +    <div class="question-text" data-testid="question"> +        {{.Text}} +    </div> +    <div id="reaction"> +        {{if eq .Status 1}} +        Correct! +        {{end}} +        {{if eq .Status 2}} +        Wrong. +        {{end}} +    </div> +    <div id="feedback" data-testid="feedback"> +      {{if ne .Status 0}} +      <div> +        {{.Explanation}} +      </div> +      <button  +          hx-get="/next-question?current_id={{.ID}}"  +          hx-target="#ancestor" +          hx-swap="outerHTML" +          class="next-button" +          data-testid="next-button"> +        Next Question → +      </button> +      {{end}} +    </div> +    <div id="options"> +        <button  +            data-testid="option1" +            hx-post="/answer"  +            hx-vals='{"selected": "0", "question_id": "{{.ID}}"}' +            hx-target="#ancestor" +            hx-swap="innerHTML" +            class="option-button" +        > +            {{.Option1}} +        </button> +        <button  +            data-testid="option2" +            hx-post="/answer"  +            hx-vals='{"selected": "1", "question_id": "{{.ID}}"}' +            hx-target="#ancestor" +            hx-swap="innerHTML" +            class="option-button" +        > +            {{.Option2}} +        </button> +        <button  +            data-testid="option3" +            hx-post="/answer"  +            hx-vals='{"selected": "2", "question_id": "{{.ID}}"}' +            hx-target="#ancestor" +            hx-swap="innerHTML" +            class="option-button" +        > +            {{.Option3}} +        </button> +        <button  +            data-testid="option4" +            hx-post="/answer"  +            hx-vals='{"selected": "3", "question_id": "{{.ID}}"}' +            hx-target="#ancestor" +            hx-swap="innerHTML" +            class="option-button" +        > +            {{.Option4}} +        </button> +    </div> +</div> +{{end}}  | 
