{% extends 'base.html' %}

{% block body %}
    
    <div class="dokk-editor">
        
        <header>
            <div class="title">
                {% if type is defined %}
                    <div class="pagename">
                        <span class="tag">{{
                            {
                                'article':  'NODE',
                                'file':     'FILE',
                                'topic':    'NODE',
                                'query':    'QUERY',
                                'template': 'TEMPLATE'
                            }[type]
                        }}</span>
                        <a href="{{ url('node', id=node_id) }}" class="large-font blacklink bold small-margin-left nodecoration">{{ node_id }}</a>
                    </div>
                    
                    {% if type in ['article', 'topic'] %}
                        <div>
                            <span class="small-font">Switch to:</span>
                            <a href="{{ url('edit', type='article', id=node_id) }}" class="blacklink small-font nodecoration {{ 'active' if type == 'article' }}">Article</a>
                            <a href="{{ url('edit', type='topic', id=node_id) }}" class="blacklink small-font nodecoration {{ 'active' if type == 'topic' }}">Properties</a>
                        </div>
                    {% endif %}
                {% endif %}
            </div>
            
            <div class="user">
                <a href="{{ url('editor') }}" class="nodecoration margin-right" title="DOKK Editor">DOKK Editor</a>
                <a href="{{ url('user', username=user['username']) }}" class="nodecoration margin-right">{{ user['username'] }}</a>
                <a href="{{ url('index') }}" class="dokk-logo nodecoration" title="DOKK">DOKK</a>
            </div>
        </header>
        
        {% if type is defined %}
            <div class="menu">
                <a href="{{ url('edit', type=type, id=node_id) }}" class="blacklink margin-left nodecoration {{ 'active' if view == 'edit' }}">
                    Edit
                </a>
                <a href="{{ url('revisions', type=type, id=node_id) }}" class="blacklink  nodecoration {{ 'active' if view == 'revision' }}">
                    Revisions
                </a>
            </div>
        {% endif %}
        
        <main>{% block main %}{% endblock %}</main>
        
    </div>

{% endblock %}
