{{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>
<table class="data-table panel">
    <tbody>
    {{range .Entries}}
    <tr class="list-item" data-path="{{.URL}}">
        <td class="icon">{{.Icon}}</td>
        <td class="name"><a href="{{.URL}}">{{.Name}}</a></td>
        <td class="meta">{{.Meta}}</td>
    </tr>
    {{end}}
    </tbody>
</table>
{{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>
{{if not .SuppressTOC}}<script src="/_/page/toc.js"></script>{{end}}
<script src="/_/page/tasks.js"></script>
{{end}}
{{if .Content}}
<script src="/_/page/sections.js"></script>
{{end}}
<script src="/_/page/sidebar-fab.js"></script>
{{end}}

{{define "sidebar"}}{{if .CanEdit}}<nav class="actions panel panel-sidebar">
    <div class="panel-header">ACTIONS</div>
    <button class="btn btn-block" onclick="newPage()" title="New page (N)">NEW PAGE</button>
    <a class="btn btn-block" href="?edit" title="Edit page (E)">EDIT PAGE</a>
    <button class="btn btn-block" data-companion-reveal hidden title="Reveal in file manager">REVEAL ON CLIENT</button>
    {{if not .IsRoot}}
    <button class="btn btn-block" onclick="movePage()" title="Move page (M)">MOVE PAGE</button>
    {{end}}
    <button class="btn btn-block" data-action="clean-tasks" onclick="cleanUpTasks()" title="Clean up finished tasks" hidden>CLEAN UP TASKS</button>
    {{if not .IsRoot}}
    <button class="btn btn-block danger" onclick="deletePage()" title="Delete page">DELETE PAGE</button>
    {{end}}
</nav>{{end}}{{if .SidebarWidget}}{{.SidebarWidget}}{{end}}{{end}}
