Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
[#931] Output basic answer values to entry page
Browse files Browse the repository at this point in the history
This outputs a table of Question/Answer/Comment rows for each answer
provided for an entry. This should help enable reviewers to assess an
already-published entry. There is special handling for some question
types to enable linking, and better handle list rendering.
  • Loading branch information
brew committed Feb 17, 2017
1 parent 9d9e7b4 commit cee3561
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions census/views/entry.html
Expand Up @@ -81,6 +81,51 @@ <h3>{{ gettext("What data is available?") }}</h3>
{%- endfor %}
</ul>

{% if not is_index %}
{% set answers = entry.getSimpleAnswersForQuestions(questions) %}
<h3>{{ gettext("All answers") }}</h3>
<table class="table table-striped yntable">
<tbody>
<tr>
<th>{{ gettext("Question")}}</th>
<th>{{ gettext("Answer") }}</th>
<th>{{ gettext("Comment")}}</th>
</tr>
{% for answer in answers %}
{% if answer.value %}
{% set question = questions|find({id: answer.id}) %}
{% set answerValue = '' %}

{% if question.type == 'source' %}
{# Special treatment for 'source' question type. #}
{% for source in answer.value %}
{% set answerValue = answerValue + source.urlValue + ' - ' + source.descValue %}
{% if not loop.last %}
{% set answerValue = answerValue + ', ' %}
{% endif %}
{% endfor %}
{% set answerValue = answerValue|marked %}
{% elif question.type == 'multiple' %}
{# Special treatment for 'multiple' question type. #}
{% set answerValue = answer.value|join(', ') %}
{% elif question.id == 'licence_url' %}
{# Special treatment for 'licence_url' question id. #}
{% set answerValue = answer.value|marked %}
{% else %}
{% set answerValue = answer.value %}
{% endif %}

<tr>
<td>{{question.questionshort or answer.id}}</td>
<td>{{answerValue}}</td>
<td>{{answer.commentValue}}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endif %}

{% if entry.details %}
<div class="place-details">
<h4><strong>{{ gettext("Details") }}</strong></h4>
Expand Down

0 comments on commit cee3561

Please sign in to comment.