<!-- Sidebar -->
<div id="sidebar">
    <div class="inner">

        <!-- Search -->
        {% if app.user %}
        <section id="search" class="alt">
            <input type="text" name="query" id="query" placeholder="Search by title, passage, or note" />
        </section>
        {% endif %}

        <!-- Menu -->
        <nav id="menu">
            <header class="major">
                {% if app.user %}
                <h3>Welcome <a href='/profile' style='text-decoration:underline;'>{{ app.user.name }}</a></h3>
                <a href='/logout'>Logout</a>
                {% endif %}
            </header>
            <ul>
                {% if app.user %}
                <li><a href='/home'>Home</a></li>
                <li><a href="#" onclick='newNote()'>New Note</a></li>
                <li><a href='#' onclick='openNote()'>Open Note</a></li>
                <li><a href="#" onclick="saveNote()">Save Note</a></li>
                <li><a href='#' onclick='discardNote()'>Delete Note</a></li>
                {% if isAdmin is defined and isAdmin %}
                <li><a href='/reference-editor'>Reference Editor</a></li>
                {% endif %}
                <li><a href='#' onclick="openRef()">Open Reference</a></li>
                <li><a href='/template-editor'>Template Editor</a></li>
                <li><a href='/cheat-sheet' target='_blank'>Markdown Cheat Sheet</a></li>
                {% else %}
                <li><a href="/">Home</a></li>
                <li><a href='/register'>Register</a></li>
                <li><a href='/login'>Login</a></li>
                {% endif %}
            </ul>
        </nav>

        {% if app.user %}
        <!-- Section -->
        <section>
            <header class="major">
                <h2>Recent Notes</h2>
            </header>
            <div class="mini-posts" id='old-notes'>
                {% for n in last4Notes %}
                <article>
                    <p>{{ n.date|date("m/d/Y") }}</p>
                    <a href="#" onclick="retrieveNote('{{ n.id }}');openNote();">{{ n.title }}</a>
                    <p>{{ n.passage }}</p>
                </article>
                {% endfor %}
            </div>
        </section>
        {% endif %}

        <!-- Section -->
        <section>
            <header class="major">
                <h2>Get in touch</h2>
            </header>
            <ul class="contact">
                <li class="icon solid fa-envelope">
                    <a href="mailto:ryan@rkprather.com">ryan@rkprather.com</a>
                </li>
            </ul>
        </section>
    </div>
</div>
