phrase_expansions.html 5.1 KB
{% extends "base-margins.html" %}

{% load i18n %}
{% load static %}

{% block title %}{% endblock %}

{% block scripts %}
    <script src="{% static 'phrase_expansions/js/expansions.js' %}"></script>
{% endblock %}

{% block content2 %}

<div class="accordion my-3" id="accordion">

{% for phrase_expansions in expansions %}

<div class="card">
    <div class="card-header p-3" id="heading-{{ phrase_expansions.phrase_type }}">
        <h5 class="mb-0">
            <a data-toggle="collapse" href="#{{ phrase_expansions.phrase_type }}" role="button" aria-expanded="false" aria-controls="{{ phrase_expansions.phrase_type }}">
                {{ phrase_expansions.title }}<span class="float-right">[<span class="action">+</span>]</span>
            </a>
        </h5>
    </div>
    <div id="{{ phrase_expansions.phrase_type }}" class="collapse" aria-labelledby="heading-{{ phrase_expansions.phrase_type }}" data-parent="#accordion">
        <div class="card-body">
        {% if phrase_expansions.phrase_subtypes|length > 1 and phrase_expansions.phrase_type != 'comprepnp' %}
        <div class="accordion" id="accordion-{{ phrase_expansions.phrase_type }}">
        {% endif %}
        {% for subtype_expansions in phrase_expansions.phrase_subtypes %}
            {% if phrase_expansions.phrase_subtypes|length > 1 and phrase_expansions.phrase_type != 'comprepnp' %}
            <div class="card">
                <div class="card-header p-2" id="heading-{{ phrase_expansions.phrase_type }}-{{ subtype_expansions.phrase_subtype|slugify }}">
                    <h6 class="mb-0">
                        <a data-toggle="collapse" href="#{{ phrase_expansions.phrase_type }}-{{ subtype_expansions.phrase_subtype|slugify }}" role="button" aria-expanded="false" aria-controls="{{ phrase_expansions.phrase_type }}-{{ subtype_expansions.phrase_subtype|slugify }}">
                            {{ subtype_expansions.title }}<span class="float-right">[<span class="action">+</span>]</span>
                        </a>
                    </h6>
                </div>
                <div
                    id="{{ phrase_expansions.phrase_type }}-{{ subtype_expansions.phrase_subtype|slugify }}"
                    class="collapse"
                    aria-labelledby="heading-{{ phrase_expansions.phrase_type }}-{{ subtype_expansions.phrase_subtype|slugify }}"
                    data-parent="#accordion-{{ phrase_expansions.phrase_type }}"
                >
                    <div class="card-body">
            {% endif %}
                        <table class="table table-sm table-borderless border border-secondary text-dark mb-1">
                            <tbody>
                            {% for expansion in subtype_expansions.expansions %}
                                <tr>
                                    {% if phrase_expansions.phrase_type == 'comprepnp' and forloop.counter == 1 %}
                                    <th class="py-2 px-1" style="width: 13em;" scope="row" rowspan="{{ subtype_expansions.expansions|length }}">
                                        {{ subtype_expansions.phrase_subtype }}
                                    </th>
                                    {% endif %}
                                    <td class="py-2 px-1" style="width: 7em;"><img src="/static/entries/img/{{ expansion.opinion_sym }}.svg" alt="{{ expansion.opinion_str }}" width="12" height="12">
                                        {{ expansion.opinion_str }}
                                    </td>
                                    {% for position in expansion.positions %}
                                    <td class="px-0 py-0 border-top border-left border-secondary text-break">
                                        {% for phrase in position.phrases %}
                                        <div class="phrase px-1 py-2{% if forloop.counter > 1 %} border-top{% endif %}">
                                            {% if phrase.desc %}
                                            <span data-toggle="tooltip" data-placement="bottom" data-html="true" title="{{ phrase.desc }}">
                                                {{ phrase.str }}
                                            </span>
                                            {% else %}
                                                {{ phrase.str }}
                                            {% endif %}
                                            </div>
                                        {% endfor %}
                                    </td>
                                    {% endfor %}
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
            {% if phrase_expansions.phrase_subtypes|length > 1 and phrase_expansions.phrase_type != 'comprepnp' %}
                    </div>
                </div>
            </div>
            {% endif %}
        {% endfor %}
        {% if phrase_expansions.phrase_subtypes|length > 1 and phrase_expansions.phrase_type != 'comprepnp' %}
        </div><!-- accordion -->
        {% endif %}
        </div>
    </div>
</div>

{% endfor %}

</div>

{% endblock %}