Commit dba17ae1 by Jillian Vogel Committed by GitHub

Merge pull request #21 from arizzitano/arizzitano/valid-id-attribute

[template] avoid potential invalid id attribute
parents a5f3f764 c4994ead
......@@ -14,19 +14,19 @@
{% for key, value in answers %}
<div class="poll-answer">
<div class="poll-input-container">
<input type="radio" name="choice" id="{{ block_id }}-answer-{{ key }}" value="{{ key }}"
<input type="radio" name="choice" id="poll-{{ block_id }}-answer-{{ key }}" value="{{ key }}"
{% if choice == key %}checked{% endif %}/>
</div>
{% if any_img %}
<div class="poll-image">
<label for="{{ block_id }}-answer-{{ key }}" class="poll-image-label">
<label for="poll-{{ block_id }}-answer-{{ key }}" class="poll-image-label">
{% if value.img %}
<img src="{{ value.img }}"/>
{% endif %}
</label>
</div>
{% endif %}
<label class="poll-answer-text" for="{{ block_id }}-answer-{{ key }}">{{ value.label|safe }}</label>
<label class="poll-answer-text" for="poll-{{ block_id }}-answer-{{ key }}">{{ value.label|safe }}</label>
</div>
{% endfor %}
</div>
......
......@@ -9,13 +9,13 @@
<tr>
<td></td>
{% for answer, label in answers %}
<th id="{{block_id}}-{{answer}}" class="survey-answer">{{label}}</th>
<th id="poll-{{block_id}}-{{answer}}" class="survey-answer">{{label}}</th>
{% endfor %}
</tr>
</thead>
{% for key, question in questions %}
<tr class="survey-row" role="group" aria-labelledby="{{block_id}}-{{key}}">
<th id="{{block_id}}-{{key}}" class="survey-question">
<tr class="survey-row" role="group" aria-labelledby="poll-{{block_id}}-{{key}}">
<th id="poll-{{block_id}}-{{key}}" class="survey-question">
{% if question.img %}
<div class="poll-image-td">
<img src="{{question.img}}" alt="{{question.img_alt|default_if_none:''}}"/>
......@@ -29,7 +29,7 @@
<input type="radio"
name="{{key}}"
value="{{answer}}"{% if question.choice == answer %} checked{% endif %}
aria-labelledby="{{block_id}}-{{answer}}"
aria-labelledby="poll-{{block_id}}-{{answer}}"
/>
</label>
</td>
......
......@@ -44,7 +44,7 @@ def package_data(pkg, roots):
setup(
name='xblock-poll',
version='1.2.4',
version='1.2.5',
description='An XBlock for polling users.',
packages=[
'poll',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment