improve suggest answers (and fix some other issues)
This commit is contained in:
@@ -15,7 +15,28 @@
|
||||
{% if question.answer_help %}
|
||||
<details>
|
||||
<summary>Marking help:</summary>
|
||||
<div class="border border-secondary">
|
||||
{{question.answer_help|safe}}
|
||||
</div>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Suggest incorrect answers:</summary>
|
||||
|
||||
{% for word in words_suggest_incorrect %}
|
||||
<span>{{word}}<span class="user-select-none" _="on click if #id_answer_suggest_incorrect == null then
|
||||
set btn to #answer-suggest-incorrect-button
|
||||
js(btn) btn.click() end
|
||||
repeat forever
|
||||
if #id_answer_suggest_incorrect != null then break end
|
||||
wait 0.1s
|
||||
end
|
||||
end
|
||||
put (#id_answer_suggest_incorrect's value + ',' + my @data-word) into #id_answer_suggest_incorrect's value then remove closest parent <span/>" data-word='{{word}}'>(+)</span>,</span>
|
||||
{% endfor %}
|
||||
|
||||
<div class="border border-secondary">
|
||||
{% include "anatomy/question_detail.html#suggest-incorrect-form" %}
|
||||
</div>
|
||||
</details>
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends 'anatomy/base.html' %}
|
||||
|
||||
{% load partials %}
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
{% include 'anatomy/question_link_header.html' %}
|
||||
@@ -58,7 +58,14 @@
|
||||
Answer help: {{ question.answer_help|safe }}
|
||||
</div>
|
||||
<div>
|
||||
Answer suggest incorrect: {{ question.answer_suggest_incorrect }}
|
||||
{% partialdef suggest-incorrect-form inline %}
|
||||
<span id="incorrect-answers">
|
||||
Answer suggest incorrect: {{ question.answer_suggest_incorrect }}
|
||||
<button id="answer-suggest-incorrect-button" class="btn btn-sm" hx-get="{% url 'anatomy:question_suggest_incorrect_answers' question.pk %}"
|
||||
hx-target="#incorrect-answers"
|
||||
hx-swap="innerHTML">Edit suggestions</button>
|
||||
</span>
|
||||
{% endpartialdef %}
|
||||
</div>
|
||||
<div>
|
||||
Description: {{ question.description }}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{% load crispy_forms_tags %}
|
||||
<form method="POST" class="post-form">{% csrf_token %}
|
||||
{{ form | crispy}}
|
||||
<button type="button" class="btn btn-sm" hx-post="{% url 'anatomy:question_suggest_incorrect_answers' question.id %}"
|
||||
hx-target="#incorrect-answers"
|
||||
hx-swap="innerHTML">Save</button>
|
||||
<button type="button" _="on click remove closest <form/>" >Cancel</button>
|
||||
</form>
|
||||
Reference in New Issue
Block a user