Fix accordion behavior with question redirects

This commit is contained in:
RotationMatrix 2020-06-08 07:47:22 -04:00
parent 29472b8250
commit 7d2ee16b7a
No known key found for this signature in database
GPG Key ID: 5A63E6FCD622708E
3 changed files with 7 additions and 7 deletions

View File

@ -1,14 +1,14 @@
{% macro render_question(item, t_id, alternative) %}
{% macro render_question(item, q_id, t_id, alternative) %}
<div class="question {{ bag('alternatives', alternative, 'direction') }}">
<h4 class="text-primary">
<a data-toggle="collapse" href="#{{ item._id }}" data-target="#{{ item._id }}" role="button" aria-expanded="false" aria-controls="{{ item._id }}">
<a data-toggle="collapse" href="#{{ q_id }}" data-target="#{{ q_id }}" role="button" aria-expanded="false" aria-controls="{{ q_id }}">
{{ item.title }}
</a>
</h4>
<div id="{{ item._id }}" class="collapse show anchor-spacer" role="tabpanel" data-parent="#{{ t_id }}Accordion">
<div id="{{ q_id }}" class="collapse show anchor-spacer" role="tabpanel" data-parent="#{{ t_id }}Accordion">
{{ item.description|safe }}
{% if item._id == "https-1" %}
{% if q_id == "https-1" %}
{% include 'secure-connections.html' %}
{% endif %}
<div class="card mt-5">

View File

@ -12,9 +12,9 @@
{% for q in item.children.include_undiscoverable(true).order_by('key') %}
{% if q._model == 'redirect' %}
{% set r = site.get(q.target, alt=alternative) %}
{{ render_question(r, item._id, alternative) }}
{{ render_question(r, q._id, item._id, alternative) }}
{% else %}
{{ render_question(q, item._id, alternative) }}
{{ render_question(q, q._id, item._id, alternative) }}
{% endif %}
{% endfor %}
</div>

View File

@ -2,5 +2,5 @@
{% extends "layout.html" %}
{% block title %}{{ this.title }}{% endblock %}
{% block body %}
{{ render_question(this, "topic", this.alt) }}
{{ render_question(this, this._id, "topic", this.alt) }}
{% endblock %}