{{define "headScripts"}}<script src="/_/page/actions.js"></script>{{end}}

{{define "content"}}
{{if .Content}}
<div class="content">{{.Content}}</div>
{{end}}
{{if .SpecialContent}}
<div class="content">{{.SpecialContent}}</div>
{{end}}
{{if .Entries}}
<h2 id="files">Files <button class="btn btn-small" data-companion-reveal hidden title="Open folder in file manager">open</button></h2>
<div class="listing">
    {{range .Entries}}
    <div class="listing-item" data-path="{{.URL}}">
        <span class="icon">{{.Icon}}</span>
        <a href="{{.URL}}">{{.Name}}</a>
        <span class="meta">{{.Meta}}</span>
    </div>
    {{end}}
</div>
{{else if not .Content}}
{{if not .SpecialContent}}
<p class="empty">Empty folder — <a href="?edit">[CREATE]</a></p>
{{end}}
{{end}}
{{if or .Content .SpecialContent}}
<script src="/_/page/content.js"></script>
<script src="/_/page/anchors.js"></script>
<script src="/_/page/toc.js"></script>
<script src="/_/page/tasks.js"></script>
{{end}}
{{if .Content}}
<script src="/_/page/sections.js"></script>
{{end}}
{{end}}

{{define "extras"}}
{{if .SidebarWidget}}{{.SidebarWidget}}{{end}}
{{if .CanEdit}}
<script src="/_/page/fab.js" defer></script>
<div class="fab dropdown">
    <button class="btn btn-fab" data-action="actions-drop" title="Actions" aria-label="Actions">≡</button>
    <div class="dropdown-menu align-right open-up">
        <button class="btn dropdown-item" onclick="newPage()" title="New page (N)">NEW</button>
        <a class="btn dropdown-item" href="?edit" title="Edit page (E)">EDIT</a>
        <button class="btn dropdown-item" data-companion-reveal hidden title="Reveal in file manager">REVEAL</button>
        {{if not .IsRoot}}
        <button class="btn dropdown-item" onclick="movePage()" title="Move page (M)">MOVE</button>
        <button class="btn dropdown-item danger" onclick="deletePage()" title="Delete page">DELETE</button>
        {{end}}
    </div>
</div>
{{end}}
{{end}}
