filebrowser/_embed/templates/base.tmpl
Henrique Dias 103457f4e3 updates
Former-commit-id: 997f42a531
2016-12-30 16:22:26 +00:00

129 lines
5.3 KiB
Cheetah

<!DOCTYPE html>
<html>
{{ $absURL := .Config.AbsoluteURL }}
<head>
<title>{{.Name}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="token" content="{{ .Token }}">
<link rel="stylesheet" href="{{ .Config.AbsoluteURL }}/_filemanagerinternal/css/styles.css">
{{ if ne .User.StyleSheet "" }}
<style>{{ CSS .User.StyleSheet }}</style>
{{ end }}
<!-- SCRIPTS -->
<!-- User Data and Permissions; WebDavURL -->
<script>
var user = JSON.parse('{{ Marshal .User }}'),
webdavURL = "{{.Config.AbsoluteURL}}{{.Config.WebDavURL}}",
baseURL = "{{.Config.AbsoluteURL}}";
</script>
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/common.js" defer></script>
{{ if .IsDir }}
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/listing.js" defer></script>
{{ else }}
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/vendor/ace/ace.js" defer></script>
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/vendor/form2js.js" defer></script>
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/editor.js" defer></script>
{{ end }}
</head>
<body>
<header>
<!-- TOP BAR -->
<div>
<div><p>File Manager</p></div>
<div id="search">
<i class="material-icons" title="Search">search</i>
<input type="text" placeholder="Search or execute a command...">
<div>
<div>Loading...</div>
<p><i class="material-icons spin">autorenew</i></p>
</div>
</div>
<div class="action" id="logout">
<i class="material-icons" title="Logout">exit_to_app</i> <span>Logout</span>
</div>
</div>
<!-- BOTTOM BAR -->
<div>
<div>
{{ if ne .Name "/"}}
<p id="breadcrumbs-button">Previous</p>
<ul id="breadcrumbs">
{{ range $item := .BreadcrumbMap }}
<a href="{{ $absURL }}{{ $item.URL }}"><li>{{ $item.Name }}</li></a>
{{ end }}
</ul><i class="material-icons">keyboard_arrow_right</i>
{{ end }}
<p id="current-file">{{ if ne .Name "/"}}{{ .Name }}{{ else }}Root{{ end }}</p>
</div>
<!-- ACTIONS -->
<div class="actions">
<div id="file-only" {{ if .IsDir }}class="disabled"{{ end }}>
<div class="action" id="open">
<i class="material-icons" title="See raw">open_in_new</i> <span>See raw</span>
</div>
{{ if and .IsDir .User.AllowEdit }}
<div class="action" id="rename">
<i class="material-icons" title="Edit">mode_edit</i>
</div>
{{ end }}
{{ if .User.AllowEdit }}
<div class="action" id="delete">
<i class="material-icons" title="Delete">delete</i> <span>Delete</span>
</div>
{{ end }}
</div>
{{ if and (.User.AllowNew) (.IsDir) }}
<div class="action" id="upload">
<i class="material-icons" title="Upload">file_upload</i> <span>Upload</span>
</div>
{{ end }}
<div class="action" id="download">
<a href="?download=true">
<i class="material-icons" title="Download">file_download</i> <span>Download</span>
</a>
{{ if .IsDir }}
<ul class="prev-links">
<a data-format="tarbz2" href="?download=tarbz2"><li>tar.bz2</li></a>
<a data-format="targz" href="?download=targz"><li>tar.gz</li></a>
<a data-format="tar" href="?download=tar"><li>tar</li></a>
<a data-format="zip" href="?download=zip"><li>zip</li></a>
</ul>
{{ end }}
</div>
{{ if .IsDir }}
<div class="action" id="view">
<i class="material-icons" title="Switch view">view_headline</i> <span>Switch view</span>
</div>
{{ end }}
</div>
</div>
</header>
<main>
{{ template "content" . }}
{{ if and (.User.AllowNew) (.IsDir) }}
<input id="newdir" type="text" placeholder="Name. End with a trailing slash to create a dir.">
<div class="floating">
<div class="action" id="new">
<i class="material-icons" title="New file or directory. End name with a trailing slash to create a directory.">add</i>
</div>
</div>
{{ end }}
</main>
<footer>Served with <a rel="noopener noreferrer" href="https://caddyserver.com">Caddy</a> and <a rel="noopener noreferrer" href="https://github.com/hacdias/caddy-filemanager">File Manager</a>.</footer>
</body>
</html>