assets
Former-commit-id: a2d7966cff7f45015ac68dc16fb936bbd33464fe
This commit is contained in:
269
_embed/templates/base.tmpl
Normal file
269
_embed/templates/base.tmpl
Normal file
@@ -0,0 +1,269 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
{{ $absURL := .Config.AbsoluteURL }}
|
||||
<head>
|
||||
<title>{{.Name}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="{{ .Config.AbsoluteURL }}/_filemanagerinternal/css/normalize.css">
|
||||
<link rel="stylesheet" href="{{ .Config.AbsoluteURL }}/_filemanagerinternal/css/fonts.css">
|
||||
<link rel="stylesheet" href="{{ .Config.AbsoluteURL }}/_filemanagerinternal/css/styles.css">
|
||||
{{- if ne .User.StyleSheet "" -}}
|
||||
<style>{{ CSS .User.StyleSheet }}</style>
|
||||
{{- end -}}
|
||||
|
||||
<script>
|
||||
var user = JSON.parse('{{ Marshal .User }}'),
|
||||
webdavURL = "{{.Config.AbsoluteURL}}{{.Config.WebDavURL}}",
|
||||
baseURL = "{{.Config.AbsoluteURL}}",
|
||||
prefixURL = "{{ .Config.PrefixURL }}";
|
||||
</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 }}
|
||||
{{- if .Config.HugoEnabled }}
|
||||
<script src="{{ .Config.AbsoluteURL }}/_hugointernal/js/application.js" defer></script>
|
||||
{{- end }}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div id="top-bar">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="bottom-bar">
|
||||
<div>
|
||||
{{- if ne .Name "/"}}
|
||||
<div data-dropdown class="action" id="previous">
|
||||
<i class="material-icons">subdirectory_arrow_left</i>
|
||||
<ul class="dropdown" id="breadcrumbs">
|
||||
{{- range $item := .BreadcrumbMap }}
|
||||
<a href="{{ $absURL }}{{ $item.URL }}"><li>{{ $item.Name }}</li></a>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{ if ne .Name "/"}}<p id="current-file">{{ .Name }}</p>{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="actions{{ if .IsDir }} disabled{{ end }}" id="file-only">
|
||||
{{- if and (not .IsDir) (.User.AllowEdit) }}
|
||||
{{- if .Editor}}
|
||||
|
||||
{{- if eq .Data.Mode "markdown" }}
|
||||
<div class="action" id="preview" onclick="notImplemented(event);">
|
||||
<i class="material-icons" title="Preview">remove_red_eye</i>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if eq .Data.Visual true }}
|
||||
<div class="action" id="edit-source">
|
||||
<i class="material-icons" title="Toggle edit source">code</i>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
<div class="action" id="save">
|
||||
<i class="material-icons" title="Save">save</i>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if .IsDir }}
|
||||
<div class="action" id="open">
|
||||
<i class="material-icons" title="See raw">open_in_new</i>
|
||||
<span>See raw</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if and (.User.AllowEdit) (.IsDir) }}
|
||||
<div class="action" id="move">
|
||||
<i class="material-icons" title="Move">forward</i>
|
||||
<span>Move file</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if and .IsDir .User.AllowEdit }}
|
||||
<div class="action" id="rename">
|
||||
<i class="material-icons" title="Edit">mode_edit</i>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if and .User.AllowEdit .IsDir }}
|
||||
<div class="action" id="delete">
|
||||
<i class="material-icons" title="Delete">delete</i><span>Delete</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
|
||||
<div class="action mobile-only" id="more">
|
||||
<i class="material-icons">more_vert</i>
|
||||
</div>
|
||||
|
||||
<div class="actions" id="main-actions">
|
||||
{{- if .IsDir }}
|
||||
<div class="action" id="view">
|
||||
{{- if eq .Display "mosaic" }}
|
||||
<a href="?display=list"><i class="material-icons" title="Switch View">view_list</i><span>Switch view</span></a>
|
||||
{{- else }}
|
||||
<a href="?display=mosaic"><i class="material-icons" title="Switch View">view_module</i><span>Switch view</span></a>
|
||||
{{- end }}
|
||||
</div>
|
||||
|
||||
<div class="action mobile-only" id="multiple-selection-activate">
|
||||
<i class="material-icons">check_circle</i><span>Select</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if and (.User.AllowNew) (.IsDir) }}
|
||||
<div class="action" id="upload">
|
||||
<i class="material-icons" title="Upload">file_upload</i><span>Upload</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if not .IsDir }}
|
||||
<div class="action" id="open">
|
||||
<i class="material-icons" title="See raw">open_in_new</i>
|
||||
<span>See raw</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if and .User.AllowEdit (not .IsDir) }}
|
||||
<div class="action" id="delete">
|
||||
<i class="material-icons" title="Delete">delete</i><span>Delete</span>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
<div {{ if .IsDir }}data-dropdown{{ end }} class="action" id="download">
|
||||
{{- if not .IsDir}}<a href="?download=true">{{ end }}
|
||||
<i class="material-icons" title="Download">file_download</i><span>Download</span>
|
||||
{{- if not .IsDir}}</a>{{ end }}
|
||||
|
||||
{{- if .IsDir }}
|
||||
<ul class="dropdown" id="download-drop">
|
||||
<a data-format="zip" href="?download=zip"><li>zip</li></a>
|
||||
<a data-format="tar" href="?download=tar"><li>tar</li></a>
|
||||
<a data-format="targz" href="?download=targz"><li>tar.gz</li></a>
|
||||
<a data-format="tarbz2" href="?download=tarbz2"><li>tar.bz2</li></a>
|
||||
<a data-format="tarbz2" href="?download=tarxz"><li>tar.xz</li></a>
|
||||
</ul>
|
||||
{{- end }}
|
||||
</div>
|
||||
|
||||
<div class="action" id="info" onclick="notImplemented(event);">
|
||||
<i class="material-icons" title="Info">info</i><span>Info</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="click-overlay"></div>
|
||||
</header>
|
||||
|
||||
<div id="multiple-selection" class="mobile-only">
|
||||
<p>Multiple selection enabled</p>
|
||||
<div class="action" id="multiple-selection-cancel">
|
||||
<i class="material-icons" title="Clear">clear</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<main>
|
||||
{{- template "content" . }}
|
||||
</main>
|
||||
|
||||
<div class="overlay"></div>
|
||||
|
||||
{{- if and (.User.AllowNew) (.IsDir) }}
|
||||
<div class="floating">
|
||||
<div class="action" id="new">
|
||||
<i class="material-icons" title="New file or directory">add</i>
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
<template id="question-template">
|
||||
<form class="prompt">
|
||||
<h3></h3>
|
||||
<p></p>
|
||||
<input autofocus type="text">
|
||||
<div>
|
||||
<button type="submit" autofocus class="ok">OK</button>
|
||||
<button class="cancel" onclick="closePrompt(event);">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<template id="info-template">
|
||||
<div class="prompt">
|
||||
<h3></h3>
|
||||
<p></p>
|
||||
<div>
|
||||
<button type="submit" onclick="closePrompt(event);" class="ok">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="move-template">
|
||||
<!-- TODO: And the back button? :) -->
|
||||
<form class="prompt">
|
||||
<h3>Move</h3>
|
||||
<p>Choose new house for your file(s)/folder(s):</p>
|
||||
|
||||
<div class="file-list">
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<p>Currently navigating on: <code></code>.</p>
|
||||
|
||||
<div>
|
||||
<button type="submit" autofocus class="ok">Move</button>
|
||||
<button class="cancel" onclick="closePrompt(event);">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<div class="help">
|
||||
<h3>Help</h3>
|
||||
|
||||
<ul>
|
||||
<li><strong>F1</strong> - this information</li>
|
||||
<li><strong>F2</strong> - rename file</li>
|
||||
<li><strong>DEL</strong> - delete selected items</li>
|
||||
<li><strong>ESC</strong> - clear selection and/or close the prompt</li>
|
||||
<li><strong>CTRL + S</strong> - save a file or download the directory where you are</li>
|
||||
<li><strong>CTRL + Click</strong> - select multiple files or directories</li>
|
||||
<li><strong>Double click</strong> - open a file or directory</li>
|
||||
<li><strong>Click</strong> - select file or directory</li>
|
||||
</ul>
|
||||
|
||||
<p>Not available yet</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>Alt + Click</strong> - select a group of files</li>
|
||||
</ul>
|
||||
|
||||
<div>
|
||||
<button type="submit" onclick="closeHelp(event);" class="ok">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>. Revision {{ .Commit }}.</footer>
|
||||
</body>
|
||||
</html>
|
||||
57
_embed/templates/editor.tmpl
Normal file
57
_embed/templates/editor.tmpl
Normal file
@@ -0,0 +1,57 @@
|
||||
{{ define "content" }}
|
||||
{{- with .Data }}
|
||||
<form id="editor" {{ if eq .Mode "markdown" }}class="markdown"{{ end }} data-kind="{{ .Class }}" data-rune="{{ if eq .Class "complete" }}{{ .FrontMatter.Rune }}{{ end }}">
|
||||
{{- if or (eq .Class "frontmatter-only") (eq .Class "complete") }}
|
||||
{{- if (eq .Class "complete")}}
|
||||
<h2>Metadata</h2>
|
||||
{{- end }}
|
||||
<div class="frontmatter" data-type="parent">
|
||||
{{- template "blocks" .FrontMatter.Content }}
|
||||
<div class="button add">Add field</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{ if or (eq .Class "content-only") (eq .Class "complete") }}
|
||||
{{ if (eq .Class "complete")}}
|
||||
<h2>Body</h2>
|
||||
{{ end }}
|
||||
<div class="content">
|
||||
<div id="ace" data-mode="{{ .Mode }}"></div>
|
||||
<textarea class="source" name="content">{{ .Content }}</textarea>
|
||||
</div>
|
||||
{{ end }}
|
||||
</form>
|
||||
{{- end }}
|
||||
|
||||
<template id="base-template">
|
||||
<fieldset id="" data-type="">
|
||||
<h3></h3>
|
||||
<div class="action add">
|
||||
<i class="material-icons">add</i>
|
||||
</div>
|
||||
<div class="action delete" data-delete="">
|
||||
<i class="material-icons">close</i>
|
||||
</div>
|
||||
<div class="group"></div>
|
||||
</fieldset>
|
||||
</template>
|
||||
|
||||
<template id="object-item-template">
|
||||
<div class="block" id="block-${bid}" data-content="${bid}">
|
||||
<label for="${bid}">${name}</label>
|
||||
<input name="${bid}" id="${bid}" type="text" data-parent-type="object"></input>
|
||||
<div class="action delete" data-delete="block-${bid}">
|
||||
<i class="material-icons">close</i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="array-item-template">
|
||||
<div id="" data-type="array-item">
|
||||
<input name="" id="" type="text" data-parent-type="array"></input>
|
||||
<div class="action delete" data-delete="">
|
||||
<i class="material-icons">close</i>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
{{ end }}
|
||||
56
_embed/templates/frontmatter.tmpl
Normal file
56
_embed/templates/frontmatter.tmpl
Normal file
@@ -0,0 +1,56 @@
|
||||
{{ define "blocks" }}
|
||||
{{ if .Fields }}<div class="group">{{ end }}
|
||||
{{- range $key, $value := .Fields }}
|
||||
{{- if eq $value.Parent.Type "array" }}
|
||||
<div id="{{ $value.Name }}-{{ $key }}" data-type="array-item">
|
||||
{{- template "value" $value }}
|
||||
<div class="action delete" data-delete="{{ $value.Name }}-{{ $key }}">
|
||||
<i class="material-icons" title="Close">close</i>
|
||||
</div>
|
||||
</div>
|
||||
{{- else }}
|
||||
<div class="block" id="block-{{ $value.Name }}" data-content="{{ $value.Name }}">
|
||||
<label for="{{ $value.Name }}">{{ $value.Title }}</label>
|
||||
{{ template "value" $value }}
|
||||
<div class="action delete" data-delete="block-{{ $value.Name }}">
|
||||
<i class="material-icons" title="Close">close</i>
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Fields }}</div>{{ end }}
|
||||
|
||||
{{- range $key, $value := .Arrays }}
|
||||
{{- template "fielset" $value }}
|
||||
{{- end }}
|
||||
|
||||
{{- range $key, $value := .Objects }}
|
||||
{{- template "fielset" $value }}
|
||||
{{- end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ define "value" }}
|
||||
{{- if eq .HTMLType "textarea" }}
|
||||
<textarea class="scroll" name="{{ .Name }}" id="{{.Name }}" data-parent-type="{{ .Parent.Type }}">{{ .Content.Other }}</textarea>
|
||||
{{- else if eq .HTMLType "datetime" }}
|
||||
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other.Format "2006-01-02T15:04" }}" type="datetime-local" data-parent-type="{{ .Parent.Type }}"></input>
|
||||
{{- else }}
|
||||
<input name="{{ .Name }}" id="{{ .Name }}" value="{{ .Content.Other }}" type="{{ .HTMLType }}" data-parent-type="{{ .Parent.Type }}"></input>
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "fielset" }}
|
||||
<fieldset id="{{ .Name }}" data-type="{{ .Type }}">
|
||||
{{- if not (eq .Title "") }}
|
||||
<h3>{{ .Name }}</h3>
|
||||
{{- end }}
|
||||
<div class="action add">
|
||||
<i class="material-icons" title="Add">add</i>
|
||||
</div>
|
||||
<div class="action delete" data-delete="{{ .Name }}">
|
||||
<i class="material-icons" title="Close">close</i>
|
||||
</div>
|
||||
{{- template "blocks" .Content }}
|
||||
</fieldset>
|
||||
{{ end }}
|
||||
103
_embed/templates/listing.tmpl
Normal file
103
_embed/templates/listing.tmpl
Normal file
@@ -0,0 +1,103 @@
|
||||
{{ define "content" }}
|
||||
<div class="container {{ .Display }}" id="listing">
|
||||
{{- with .Data -}}
|
||||
<div>
|
||||
<div class="item header">
|
||||
<div></div>
|
||||
<div>
|
||||
<p class="name{{ if eq .Sort "name" }} active{{ end }}"><span>Name</span>
|
||||
{{- if eq .Sort "name" -}}
|
||||
{{- if eq .Order "asc" -}}
|
||||
<a href="?sort=name&order=desc"><i class="material-icons">arrow_downward</i></a>
|
||||
{{- else -}}
|
||||
<a href="?sort=name&order=asc"><i class="material-icons">arrow_upward</i></a>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a href="?sort=name&order=desc"><i class="material-icons">arrow_downward</i></a>
|
||||
{{- end -}}
|
||||
</p>
|
||||
<p class="size{{ if eq .Sort "size" }} active{{ end }}"><span>File Size</span>
|
||||
{{- if eq .Sort "size" -}}
|
||||
{{- if eq .Order "asc" -}}
|
||||
<a href="?sort=size&order=desc"><i class="material-icons">arrow_downward</i></a>
|
||||
{{- else -}}
|
||||
<a href="?sort=size&order=asc"><i class="material-icons">arrow_upward</i></a>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a href="?sort=size&order=desc"><i class="material-icons">arrow_downward</i></a>
|
||||
{{- end -}}
|
||||
</p>
|
||||
<p class="modified">Last modified</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ if and (eq .NumDirs 0) (eq .NumFiles 0) }}
|
||||
<h2 class="message">It feels lonely here :'(</h2>
|
||||
{{ end }}
|
||||
|
||||
{{- if not (eq .NumDirs 0)}}
|
||||
<h2>Folders</h2>
|
||||
<div>
|
||||
{{- range .Items }}
|
||||
{{- if (.IsDir) }}
|
||||
{{ template "item" .}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
|
||||
{{- if not (eq .NumFiles 0)}}
|
||||
<h2>Files</h2>
|
||||
<div>
|
||||
{{- range .Items }}
|
||||
{{- if (not .IsDir) }}
|
||||
{{ template "item" .}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
</div>
|
||||
|
||||
<input style="display:none" type="file" id="upload-input" onchange="listing.handleFiles(this.files, '')" value="Upload" multiple>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ define "item" }}
|
||||
<div ondragstart="listing.itemDragStart(event)"
|
||||
{{ if .IsDir}}ondragover="listing.itemDragOver(event)" ondrop="listing.itemDrop(event)"{{ end }}
|
||||
draggable="true"
|
||||
class="item"
|
||||
onclick="listing.selectItem(event)"
|
||||
ondblclick="listing.openItem(event)"
|
||||
data-dir="{{ .IsDir }}"
|
||||
data-url="{{ .URL }}"
|
||||
id="{{ EncodeBase64 .Name }}">
|
||||
<div>
|
||||
{{- if .IsDir}}
|
||||
<i class="material-icons">folder</i>
|
||||
{{- else}}
|
||||
{{ if eq .Type "image" }}
|
||||
<i class="material-icons">insert_photo</i>
|
||||
{{ else if eq .Type "audio" }}
|
||||
<i class="material-icons">volume_up</i>
|
||||
{{ else if eq .Type "video" }}
|
||||
<i class="material-icons">movie</i>
|
||||
{{ else }}
|
||||
<i class="material-icons">insert_drive_file</i>
|
||||
{{ end }}
|
||||
{{- end}}
|
||||
</div>
|
||||
<div>
|
||||
<p class="name">{{.Name}}</p>
|
||||
{{- if .IsDir}}
|
||||
<p class="size" data-order="-1">—</p>
|
||||
{{- else}}
|
||||
<p class="size" data-order="{{.Size}}">{{.HumanSize}}</p>
|
||||
{{- end}}
|
||||
<p class="modified">
|
||||
<time datetime="{{.HumanModTime "2006-01-02T15:04:05Z"}}">{{.HumanModTime "2 Jan 2006 03:04 PM"}}</time>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
1
_embed/templates/minimal.tmpl
Normal file
1
_embed/templates/minimal.tmpl
Normal file
@@ -0,0 +1 @@
|
||||
{{ template "content" . }}
|
||||
23
_embed/templates/single.tmpl
Normal file
23
_embed/templates/single.tmpl
Normal file
@@ -0,0 +1,23 @@
|
||||
{{ define "content" }}
|
||||
{{ with .Data}}
|
||||
<main class="container">
|
||||
{{ if eq .Type "image" }}
|
||||
<center><img src="{{ .URL }}?raw=true"></center>
|
||||
{{ else if eq .Type "audio" }}
|
||||
<audio src="{{ .URL }}?raw=true" controls></audio>
|
||||
{{ else if eq .Type "video" }}
|
||||
<video src="{{ .URL }}?raw=true" controls>
|
||||
Sorry, your browser doesn't support embedded videos,
|
||||
but don't worry, you can <a href="?download=true">download it</a>
|
||||
and watch it with your favorite video player!
|
||||
</video>
|
||||
{{ else if eq .Extension ".pdf" }}
|
||||
<object class="pdf" data="{{ .URL }}?raw=true"></object>
|
||||
{{ else if eq .Type "blob" }}
|
||||
<a href="?download=true"><h2 class="message">Download <i class="material-icons">file_download</i></h2></a>
|
||||
{{ else}}
|
||||
<pre>{{ .StringifyContent }}</pre>
|
||||
{{ end }}
|
||||
</main>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user