uccser/cs-field-guide

View on GitHub
csfieldguide/templates/curriculum_guides/curriculum_guide_section.html

Summary

Maintainability
Test Coverage
{% extends "columns.html" %}

{% load i18n %}
{% load render_html_field %}

{% block title %}
  {{ curriculum_guide_section.curriculum_guide.name }}
{% endblock title %}

{% block page_heading %}
  <small>
    <a href="{% url 'curriculum_guides:curriculum_guide' curriculum_guide.slug %}" class="text-white-50">
      {{ curriculum_guide_section.curriculum_guide.name }}
    </a>
  </small>
  <br>
  <span class="text-white-50">{{ curriculum_guide_section.number }}.</span> {{ curriculum_guide_section.name }}
{% endblock page_heading %}

{% block left_column_content %}
  {% if curriculum_guide_section.translation_available %}
    {% render_html_field curriculum_guide_section.content %}
  {% else %}
    {% with model=curriculum_guide_section %}
      {% include "generic/not-available-warning.html" %}
    {% endwith %}
  {% endif %}

  <div class="{% if previous_section %}d-flex justify-content-between{% endif %}">
    {% if previous_section %}
      <a href="{% url 'curriculum_guides:curriculum_guide_section' curriculum_guide.slug previous_section.0.slug %}" class="btn btn-primary btn-chapter-section mb-2 float-left {% if not curriculum_guide_section.translation_available %} text-muted{% endif %}">
        <strong>{% trans 'Previous:' %}</strong><br>{{ previous_section.0.name }}
      </a>
    {% endif %}
    {% if next_section %}
      <a id="section-next-btn" href="{% url 'curriculum_guides:curriculum_guide_section' curriculum_guide.slug next_section.0.slug %}" class="btn btn-primary btn-chapter-section mb-2 float-right {% if not curriculum_guide_section.translation_available %} text-muted{% endif %}">
        <strong>{% trans 'Next:' %}</strong><br>{{ next_section.0.name }}
      </a>
    {% endif %}
  </div>
{% endblock left_column_content %}

{% block right_column_content %}
  {% if curriculum_guide_section.translation_available %}
    <div id="sticky-sidebar" class="sticky-top d-print-none">
      <h2 class="mt-2">{% trans "Table of contents" %}</h2>
      <ul class="nav nav-pills flex-column">
        {% for section in curriculum_guide.curriculum_guide_sections.all %}
          <li class="nav-item">
            <a class="nav-link {% if section.slug == curriculum_guide_section.slug %} active text-white{% else %} nav-link-colour{% endif %}" href="{% url 'curriculum_guides:curriculum_guide_section' curriculum_guide.slug section.slug %}">
              {{ section.name }}
            </a>
          </li>
        {% endfor %}
      </ul>
    </div>
  {% endif %}
{% endblock right_column_content %}