{% extends 'simplewiki/base.html' %}
{% load i18n %}
{% load humanize %}
{% load static %}
{% load markdown_filters %}

{% block details %}

<div class="container-fluid">
<div class="row">
<!-- Wiki Section View -->
{% if available_sections_count > 0 and display_page_contents %}
<div class="col-md-9" style="padding-left: 0px; padding-right: 0px;">
{% else %}
<div class=""></div>
{% endif %}
    {% for item in available_sections %}
    <div id="{{ item.title }}" class="card card-primary" style="margin-bottom: 1rem;">
        <div class="card-header">
            <div class="card-title">
                <i class="{{ item.icon }}"></i>
                <a href="#{{ item.title }}" style="text-decoration: none;">{{ item.title }}</a>
            </div>
        </div>
        <div class="card-body">
            <p>
                {{ item.content|markdown|safe }}
            </p>
        </div>
    </div>
    {% empty %}
        {% if is_editor %}
            <div class="alert alert-info" role="alert">
                No wiki pages found. You can add them under Editor -> <a target="_blank" href="{% url 'simplewiki:editor_sections' %}" style="text-decoration: underline;">Edit Sections</a>.
            </div>
        {% endif %}
    {% endfor %}
</div>

{% if available_sections_count > 0 and display_page_contents %}
<!-- Page Contents Side View -->
<div class="col-md-3" style="padding-right: 0px;">
    <div class="card card-primary">
        <div class="card-header">
            <div class="card-title">
                Page Contents
            </div>
        </div>
        <div class="card-body">
            <ul class="nav nav-pills flex-column">
                {% for item in available_sections %}
                
                <li class="nav-item" style="margin-bottom: 1rem;">
                    <a class="h5" href="#{{ item.title }}" style="text-decoration: none;">
                        <i class="fas fa-chevron-right" style="padding-right: 0.5rem;"></i>
                        <i class="{{ item.icon }}"></i>
                        {{ item.title }}
                    </a>
                </li>
                {% endfor %}
            </ul>
        </div>
        {% if latest and latest_section.last_edit != "" %}
        <div class="card-footer">
            {% if latest_section.last_edit_id != 0 %}
            Last edited by <a target="_blank" href="https://evewho.com/character/{{ latest_section.last_edit_id }}" style="text-decoration: none;">{{ latest_section.last_edit }}</a> on {{ latest_section.last_edit_date }}
            {% else %}
            Last edited by {{ latest_section.last_edit }} on {{ latest_section.last_edit_date }}
            {% endif %}
        </div>
        {% endif %}
    </div>
</div> 

</div>
</div>
{% endif %}
{% endblock %}

{% block extra_javascript %}
{% endblock %}

{% block extra_script %}
{% endblock %}
