{% extends theme("layout.html") %}

{% import "utils.html" as utils with context %}
{% import theme("itemviews.html") as itemviews with context %}
{% import "snippets.html" as snippets with context %}

{% set exists = storage.has_item(item_name) %}
{% set footer_meta = snippets.footer_meta() %}


{% block views %}
    {{ itemviews }}
{% endblock %}

{% block content %}

    {% block headline %}
        {% block item_summary %}
            {% if item.meta['summary'] %}
                <div class="moin-summary">
                    {{ _('Summary: {summary}').format(summary=item.meta['summary']) }}
                </div>
            {% endif %}
        {% endblock %}

        {% block rev_navigation %}
            {{ utils.rev_navigation(rev_navigation_ids_dates, fqname, view='frontend.show_item', item=item) }}
        {% endblock %}

    {% endblock %}

    {% block content_data %}
        {% if data_rendered %}
            <div id="moin-content-data">
                {{ data_rendered }}
            </div>
        {% endif %}
    {% endblock %}

{% endblock %}

{% block user_actions %}
    {{ local_panel_main(user_actions) }}
{% endblock %}

{% block item_actions %}
    {{ local_panel_main(item_actions) }}
{% endblock %}

{% block local_panel %}

    <div class="moin-list-heading">
        <div class="list-group-item-heading">
            {{ _("View Options") }}
            <a class="moin-showhide moin-viewoptions" href="#">
                <i class="fa fa-lg fa-caret-right"></i>
            </a>
        </div>
        <div id="moin-view-options" class="hidden">
            {# TODO: review themes/init.py and config/default.py to improve support #}
            {{ local_panel_main(item_navigation) }} {# Discussion #}
            <div class="moin-toggle-comments-button list-group-item">
                <a class="moin-toggle-comments-tooltip" href="#" title="Hide comments">
                    <i class="fa fa-comment"></i>
                    Comments
                </a>
            </div>
            <div class="moin-transclusions-button list-group-item">
                <a class="moin-transclusions-tooltip" href="#" title="Show transclusions">
                    <i class="fa fa-paste"></i>
                    Transclusions
                </a>
            </div>
        </div>
    </div>

    {% if user_actions %}
        <div class="moin-list-heading">
            <div class="list-group-item-heading">
                {{ _("User Actions") }}
                <a class="moin-showhide moin-useractions" href="#" >
                    <i class="fa fa-lg fa-caret-right"></i>
                </a>
            </div>
            <div id="moin-user-actions" class="hidden">{{ self.user_actions() }}</div>
        </div>
    {% endif %}

    {% if item_actions %}
        <div class="moin-list-heading">
            <div class="list-group-item-heading">
                {{ _("Item Actions") }}
                <a class="moin-showhide moin-itemactions" href="#" >
                    <i class="fa fa-lg fa-caret-right"></i>
                </a>
            </div>
            <div id="moin-item-actions" class="hidden">{{ self.item_actions() }}</div>
        </div>
    {% endif %}
{% endblock %}

{% block footer_meta %}
    {{ footer_meta }}
{% endblock %}

{% block options_for_javascript %}
    {%- if item_name and user.edit_on_doubleclick and user.may.write(item_name) -%}
        <br id="moin-edit-on-doubleclick">
    {%- endif %}
    {%- if user.show_comments -%}
        <br id="moin-show-comments">
    {%- endif %}
{% endblock %}
