Files
edx-platform/xmodule/capa/templates/choicetext.html

62 lines
3.3 KiB
HTML

{% load i18n %}
{% load static %}
{% with element_checked=False %}
{% for choice_id, _ in choices %}
{% if choice_id in value %}
{% with element_checked=True %}{% endwith %}
{% endif %}
{% endfor %}
<section id="choicetextinput_{{ id }}" class="choicetextinput">
<div class="choicetextgroup capa_inputtype" id="inputtype_{{ id }}">
<div class="script_placeholder"
data-src="{% static 'js/capa/choicetextinput.js' %}" />
<fieldset aria-label="{{ response_data.label|striptags }}">
{% for choice_id, choice_description in choices %}
<section id="forinput{{ choice_id }}"
{% if input_type == 'radio' and choice_id in value %} {% if status.classname %}class="choicetextgroup_{{ status.classname }}"{% endif %}
{% endif %}>
<input class="ctinput"
type="{{ input_type }}"
name="choiceinput_{{ id }}"
id="{{ choice_id }}"
value="{{ choice_id }}"
{% if choice_id in value %}checked="true"{% endif %} />
{% for content_node in choice_description %}
{% if content_node.type == 'text' %}
<span class="mock_label">{{ content_node.contents }}</span>
{% else %}
{% with my_id=content_node.contents|default:'' %}
{% with my_val=value.my_id|default:'' %}
<input class="ctinput"
type="text"
name="{{ content_node.contents }}"
id="{{ content_node.contents }}"
value="{{ my_val }}" />
{% endwith %}
{% endwith %}
{% endif %}
<span class="mock_label">{{ content_node.tail_text }}</span>
{% endfor %}
<p id="answer_{{ choice_id }}" class="answer"></p>
</section>
{% endfor %}
<span id="answer_{{ id }}"></span>
</fieldset>
<input class="choicetextvalue"
type="hidden"
name="input_{{ id }}{}"
id="input_{{ id }}"
value="{{ value }}" />
<div class="indicator-container">
{% if input_type == 'checkbox' or not value or status.classname == 'incomplete' or status.classname == 'unsubmitted' or status.classname == 'unanswered' %}
{% include "status_span.html" with status=status status_id=id %}
{% endif %}
</div>
{% if show_correctness == "never" %}
{% if value or status != "unsubmitted" %}<div class="capa_alert">{{ submitted_message }}</div>{% endif %}
{% endif %}
{% if msg %}<span class="message" tabindex="-1">{{ msg|safe }}</span>{% endif %}
</div>
</section>
{% endwith %}