filebrowser/_embed/templates/listing.tmpl

100 lines
3.4 KiB
Cheetah
Raw Normal View History

2016-06-10 21:18:44 +00:00
{{ define "content" }}
2016-12-30 22:57:14 +00:00
<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" -}}
2016-12-31 18:35:27 +00:00
<a href="?sort=name&order=desc"><i class="material-icons">arrow_downward</i></a>
2016-12-30 22:57:14 +00:00
{{- else -}}
2016-12-31 18:35:27 +00:00
<a href="?sort=name&order=asc"><i class="material-icons">arrow_upward</i></a>
2016-12-30 22:57:14 +00:00
{{- 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" -}}
2016-12-31 18:35:27 +00:00
<a href="?sort=size&order=desc"><i class="material-icons">arrow_downward</i></a>
2016-12-30 22:57:14 +00:00
{{- else -}}
2016-12-31 18:35:27 +00:00
<a href="?sort=size&order=asc"><i class="material-icons">arrow_upward</i></a>
2016-12-30 22:57:14 +00:00
{{- end -}}
{{- else -}}
<a href="?sort=size&order=desc"><i class="material-icons">arrow_downward</i></a>
{{- end -}}
</p>
<p class="modified">Last modified</p>
2016-08-21 19:10:12 +00:00
</div>
</div>
2016-12-30 22:57:14 +00:00
</div>
2016-12-31 15:29:36 +00:00
{{- if not (eq .NumDirs 0)}}
2016-12-30 22:57:14 +00:00
<h2>Folders</h2>
<div>
{{- range .Items }}
{{- if and (.UserAllowed) (.IsDir) }}
{{ template "item" .}}
{{- end }}
{{- end }}
</div>
2016-12-31 15:29:36 +00:00
{{- end }}
{{- if not (eq .NumFiles 0)}}
2016-12-30 22:57:14 +00:00
<h2>Files</h2>
<div>
{{- range .Items }}
{{- if and (.UserAllowed) (not .IsDir) }}
{{ template "item" .}}
{{- end }}
{{- end }}
2016-08-21 19:10:12 +00:00
</div>
2016-12-31 15:29:36 +00:00
{{- end }}
2016-08-21 19:10:12 +00:00
</div>
2016-06-23 07:22:39 +00:00
<input style="display:none" type="file" id="upload-input" onchange="handleFiles(this.files, '')" value="Upload" multiple>
2016-12-30 22:57:14 +00:00
{{- end -}}
{{- end -}}
2016-12-30 16:22:26 +00:00
{{ define "item" }}
2016-12-31 15:29:36 +00:00
<div ondragstart="listing.itemDragStart(event)"
{{ if .IsDir}}ondragover="listing.itemDragOver(event)" ondrop="listing.itemDrop(event)"{{ end }}
2016-12-30 16:22:26 +00:00
draggable="true"
class="item"
2016-12-31 15:29:36 +00:00
onclick="listing.selectItem(event)"
ondblclick="listing.openItem(event)"
2016-12-30 16:22:26 +00:00
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>
2016-12-30 22:57:14 +00:00
<p class="name">{{.Name}}</p>
2016-12-30 16:22:26 +00:00
{{- if .IsDir}}
2016-12-30 22:57:14 +00:00
<p class="size" data-order="-1">&mdash;</p>
2016-12-30 16:22:26 +00:00
{{- else}}
2016-12-30 22:57:14 +00:00
<p class="size" data-order="{{.Size}}">{{.HumanSize}}</p>
2016-12-30 16:22:26 +00:00
{{- end}}
2016-12-30 22:57:14 +00:00
<p class="modified">
2016-12-30 16:22:26 +00:00
<time datetime="{{.HumanModTime "2006-01-02T15:04:05Z"}}">{{.HumanModTime "2 Jan 2006 03:04 PM"}}</time>
</p>
</div>
</div>
{{ end }}