move assets
This commit is contained in:
16
_embed/templates/.jsbeautifyrc
Normal file
16
_embed/templates/.jsbeautifyrc
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"html": {
|
||||
"allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg"],
|
||||
"brace_style": "collapse", // [collapse|expand|end-expand|none] Put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are
|
||||
"end_with_newline": false, // End output with newline
|
||||
"indent_char": " ", // Indentation character
|
||||
"indent_handlebars": false, // e.g. {{#foo}}, {{/foo}}
|
||||
"indent_inner_html": false, // Indent <head> and <body> sections
|
||||
"indent_scripts": "keep", // [keep|separate|normal]
|
||||
"indent_size": 4, // Indentation size
|
||||
"max_preserve_newlines": 0, // Maximum number of line breaks to be preserved in one chunk (0 disables)
|
||||
"preserve_newlines": true, // Whether existing line breaks before elements should be preserved (only works before elements, not inside tags or for text)
|
||||
"unformatted": ["a", "span", "img", "code", "pre", "sub", "sup", "em", "strong", "b", "i", "u", "strike", "big", "small", "pre", "h1", "h2", "h3", "h4", "h5", "h6"], // List of tags that should not be reformatted
|
||||
"wrap_line_length": 0 // Lines should wrap at next opportunity after this number of characters (0 disables)
|
||||
}
|
||||
}
|
||||
18
_embed/templates/actions.tmpl
Normal file
18
_embed/templates/actions.tmpl
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ define "actions" }}
|
||||
<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 }}
|
||||
<div class="action" id="download">
|
||||
<i class="material-icons" title="Download">file_download</i> <span>Download</span>
|
||||
</div>
|
||||
{{ if .User.AllowEdit }}
|
||||
<div class="action" id="delete">
|
||||
<i class="material-icons" title="Delete">delete</i> <span>Delete</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
139
_embed/templates/base.tmpl
Normal file
139
_embed/templates/base.tmpl
Normal file
@@ -0,0 +1,139 @@
|
||||
{{ $absURL := .Config.AbsoluteURL }}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{{.Name}}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto:400,500' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="{{ .Config.AbsoluteURL }}/_filemanagerinternal/css/styles.css">
|
||||
|
||||
{{ if ne .User.StyleSheet "" }}
|
||||
<style>
|
||||
{{ CSS .User.StyleSheet }}
|
||||
</style>
|
||||
{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div>
|
||||
{{ $lnk := .PreviousLink }}
|
||||
|
||||
<div class="action{{ if eq $lnk ""}} disabled{{ end }}" id="prev">
|
||||
{{ if ne $lnk ""}}
|
||||
<a href="{{ $lnk }}">
|
||||
{{ end }}
|
||||
<i class="material-icons" title="Previous">subdirectory_arrow_left</i>
|
||||
{{ if ne $lnk ""}}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
|
||||
{{ if ne $lnk ""}}
|
||||
<ul class="prev-links">
|
||||
{{ range $link, $name := .BreadcrumbMap }}
|
||||
<a href="{{ $absURL }}{{ $link }}"><li>{{ $name }}</li></a>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
||||
<div class="action" id="open-nav">
|
||||
<i class="material-icons" title="Menu">menu</i>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
{{ if ne .Name "/"}}
|
||||
{{ .Name }}
|
||||
</p>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="only-side">
|
||||
{{ $lnk := .PreviousLink }}
|
||||
{{ if ne $lnk ""}}
|
||||
<a href="{{ $lnk }}">
|
||||
{{ end }}
|
||||
<div class="action{{ if eq $lnk ""}} disabled{{ end }}" id="prev">
|
||||
<i class="material-icons" title="Previous">subdirectory_arrow_left</i>
|
||||
</div>
|
||||
|
||||
{{ if ne $lnk ""}}
|
||||
</a>
|
||||
{{ end }}
|
||||
|
||||
<p>
|
||||
<a href="{{ if eq .Config.AbsoluteURL "" }}/{{ else }}{{ .Config.AbsoluteURL }}{{ end }}">
|
||||
File Manager
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{ if .IsDir}}
|
||||
|
||||
{{ if .User.AllowCommands }}
|
||||
<div id="search">
|
||||
<i class="material-icons" title="Storage">storage</i>
|
||||
<input type="text" placeholder="Execute a command...">
|
||||
<div>Write your git, mercurial or svn command and press enter.</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="action" id="view">
|
||||
<i class="material-icons" title="Switch view">view_headline</i> <span>Switch view</span>
|
||||
</div>
|
||||
{{ if .User.AllowNew }}
|
||||
<div class="action" id="upload">
|
||||
<i class="material-icons" title="Upload">file_upload</i> <span>Upload</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ template "actions" . }}
|
||||
{{ end }}
|
||||
|
||||
<div class="action" id="logout">
|
||||
<i class="material-icons" title="Logout">exit_to_app</i> <span>Logout</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="overlay"></div>
|
||||
</header>
|
||||
|
||||
{{ if .IsDir }}
|
||||
<div id="toolbar">
|
||||
<div>
|
||||
<div class="action" id="back">
|
||||
<i class="material-icons" title="Back">arrow_back</i>
|
||||
</div>
|
||||
<p>
|
||||
<span id="selected-number">0</span>
|
||||
selected.</p>
|
||||
</div>
|
||||
<div>
|
||||
{{ template "actions" . }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<main>
|
||||
{{ template "content" . }}
|
||||
<span id="token">{{ .Config.Token }}</span>
|
||||
</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>
|
||||
|
||||
<!-- SCRIPTS -->
|
||||
<!-- User Data and Permissions; WebDavURL -->
|
||||
<script>var user = JSON.parse('{{ Marshal .User }}'), webdavURL = "{{.Config.WebDavURL}}", baseURL = "{{.Config.BaseURL}}";</script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/ace.js"></script>
|
||||
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/form2js.js"></script>
|
||||
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/application.js"></script>
|
||||
{{ if .Config.HugoEnabled }}<script src="{{ .Config.AbsoluteURL }}/_hugointernal/js/application.js"></script>{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
34
_embed/templates/editor.tmpl
Normal file
34
_embed/templates/editor.tmpl
Normal file
@@ -0,0 +1,34 @@
|
||||
{{ define "content" }}
|
||||
{{ with .Data }}
|
||||
<div id="editor" class="container" data-kind="{{ .Class }}">
|
||||
<form method="POST" action="./">
|
||||
{{ if or (eq .Class "frontmatter-only") (eq .Class "complete") }}
|
||||
<div class="frontmatter" data-type="parent">
|
||||
{{ template "blocks" .FrontMatter }}
|
||||
<div class="button add">Add field</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if or (eq .Class "content-only") (eq .Class "complete") }}
|
||||
|
||||
{{ if (eq .Class "complete")}}
|
||||
<h3>Body</h3>
|
||||
{{ end }}
|
||||
<div class="content">
|
||||
<div id="editor-source" data-mode="{{ .Mode }}"></div>
|
||||
<textarea name="content">{{ .Content }}</textarea>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div>
|
||||
<button id="submit" type="submit" data-type="{{ .Class }}">
|
||||
<span>
|
||||
<i class="material-icons" title="Save">save</i>
|
||||
</span>
|
||||
<span>save</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
60
_embed/templates/frontmatter.tmpl
Normal file
60
_embed/templates/frontmatter.tmpl
Normal file
@@ -0,0 +1,60 @@
|
||||
{{ 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>{{ .Title }}</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 }}
|
||||
48
_embed/templates/listing.tmpl
Normal file
48
_embed/templates/listing.tmpl
Normal file
@@ -0,0 +1,48 @@
|
||||
{{ define "content" }}
|
||||
{{ with .Data }}
|
||||
<div class="listing">
|
||||
<div class="container" id="listing">
|
||||
{{- range .Items}}
|
||||
{{ if .UserAllowed }}
|
||||
<div class="item" data-dir="{{- if .IsDir}}true{{ else }}false{{ end }}" id="{{.URL}}">
|
||||
<div>
|
||||
<a href="{{.URL}}">
|
||||
{{- if .IsDir}}
|
||||
<i class="material-icons">folder</i>
|
||||
{{- else}}
|
||||
<i class="material-icons">insert_drive_file</i>
|
||||
{{- end}}
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<a href="{{.URL}}">
|
||||
<span class="name">{{.Name}}</span>
|
||||
{{- if .IsDir}}
|
||||
<p data-order="-1">—</p>
|
||||
{{- else}}
|
||||
<p data-order="{{.Size}}">{{.HumanSize}}</p>
|
||||
{{- end}}
|
||||
<p>
|
||||
<time datetime="{{.HumanModTime " 2006-01-02T15:04:05Z"}}">{{.HumanModTime "01/02/2006 03:04:05 PM -07:00"}}</time>
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
<span class="checkbox" data-href="{{.URL}}"><i class="material-icons">check</i>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{- end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input style="display:none" type="file" id="upload-input" onchange="handleFiles(this.files)" value="Upload" multiple>
|
||||
{{ end }}
|
||||
|
||||
{{ if .User.AllowNew }}
|
||||
<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. If you don't write an extension, a directory will be created.">add</i>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
2
_embed/templates/minimal.tmpl
Normal file
2
_embed/templates/minimal.tmpl
Normal file
@@ -0,0 +1,2 @@
|
||||
{{ template "content" . }}
|
||||
<span id="token">{{ .Config.Token }}</span>
|
||||
17
_embed/templates/single.tmpl
Normal file
17
_embed/templates/single.tmpl
Normal file
@@ -0,0 +1,17 @@
|
||||
{{ define "content" }}
|
||||
{{ with .Data}}
|
||||
<main class="container">
|
||||
{{ if eq .Type "image" }}
|
||||
<img src="{{ .URL }}?raw=true">
|
||||
{{ else if eq .Type "audio" }}
|
||||
<audio src="{{ .URL }}?raw=true"></audio>
|
||||
{{ else if eq .Type "video" }}
|
||||
<!-- TODO: SHOW VIDEO ? -->
|
||||
{{ else if eq .Type "blob" }}
|
||||
<a href="?download=true">Download</a>
|
||||
{{ else}}
|
||||
<pre>{{ .StringifyContent }}</pre>
|
||||
{{ end }}
|
||||
</main>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user