Implement displaying of answer fields, title, and sources

This commit is contained in:
Christian Neff 2024-02-28 22:11:14 +01:00
parent c0b97c6543
commit b7b093c25e
6 changed files with 46 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -652,20 +652,30 @@ summary.title {
display: none;
}
.answer-title {
font-size: 1rem;
margin-top: 0;
margin-bottom: 1rem;
}
span {
overflow-wrap: anywhere;
}
.answer {
display: flex;
flex-direction: column;
.answer-fields dt {
font-weight: bold;
margin-top: .8rem;
margin-bottom: .4rem;
}
.answer-url {
margin-left: auto;
margin-top: 5px;
margin-right: 10px;
margin-bottom: 10px;
.answer-fields dd {
margin-left: 1.5rem;
}
.answer-sources {
margin-top: 1rem;
font-size: .8rem;
.ltr-text-align-right();
}
}

View file

@ -23,10 +23,30 @@
<div id="answers" role="complementary" aria-labelledby="answers-title"><h4 class="title" id="answers-title">{{ _('Answers') }} : </h4>
{%- for answer in answers.values() -%}
<div class="answer">
<span>{{ answer.answer }}</span>
{% if answer.url -%}
<a href="{{ answer.url }}" class="answer-url">{{ urlparse(answer.url).hostname }}</a>
{% endif -%}
{% if answer.title %}
<h5 class="answer-title">{{ answer.title }}</h5>
{% endif %}
{% if answer.url %}
<a href="{{ answer.url }}">{{ answer.answer }}</a>
{% else %}
<span>{{ answer.answer }}</span>
{% endif %}
{% if answer.fields %}
<dl class="answer-fields">
{% for field in answer.fields -%}
<dt>{{ field.label }}</dt>
<dd>{{ field.value }}</dd>
{%- endfor %}
</dl>
{% endif %}
{% if answer.sources %}
<div class="answer-sources">
{{ _('Sources') }}:
{% for source in answer.sources -%}
{% if not loop.first %}, {% endif %}<a href="{{ source.url }}">{{ source.title }}</a>
{%- endfor %}
</div>
{% endif %}
</div>
{%- endfor -%}
</div>