filebrowser/templates/browse.tmpl
2016-02-07 17:16:09 +00:00

72 lines
3.3 KiB
Cheetah

{{ define "content" }}{{ $path := .Path }}
<main class="browse">
<div class="actions">
<div class="container">
{{if .CanGoUp}}<a data-pjax href=".." class="up" title="Up one level"><i class="fa fa-arrow-left fa-lg"></i></a>{{end}}
<span id="site-title">Path: {{ $path }}</span>
<div class="go-right">
<input type="file" value="Upload" multiple>
<button id="upload">Upload <i class="fa fa-cloud-upload"></i></button>
<button class="default new">New <i class="fa fa-plus"></i></button>
</div>
</div>
</div>
<div class="container">
<table>
<tr>
<th class="left">
{{if and (eq .Sort "name") (ne .Order "desc")}}
<a data-pjax href="?sort=name&order=desc">Name <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "name") (ne .Order "asc")}}
<a data-pjax href="?sort=name&order=asc">Name <i class="fa fa-arrow-down"></i></a> {{else}}
<a data-pjax href="?sort=name&order=asc">Name</a> {{end}}
</th>
<th class="right hideable">
{{if and (eq .Sort "size") (ne .Order "desc")}}
<a data-pjax href="?sort=size&order=desc">Size <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "size") (ne .Order "asc")}}
<a data-pjax href="?sort=size&order=asc">Size <i class="fa fa-arrow-down"></i></a> {{else}}
<a data-pjax href="?sort=size&order=asc">Size</a> {{end}}
</th>
<th class="hideable right">
{{if and (eq .Sort "time") (ne .Order "desc")}}
<a data-pjax href="?sort=time&order=desc">Modified <i class="fa fa-arrow-up"></i></a> {{else if and (eq .Sort "time") (ne .Order "asc")}}
<a data-pjax href="?sort=time&order=asc">Modified <i class="fa fa-arrow-down"></i></a> {{else}}
<a data-pjax href="?sort=time&order=asc">Modified</a> {{end}}
</th>
<th class="right buttons"></th>
</tr>
{{range .Items}}
<tr>
<td>
{{if .IsDir}}
<i class="fa fa-folder"></i> <a data-pjax href="{{.URL}}">{{.Name}}</a> {{else}} {{ if CanBeEdited .URL }}
<i class="fa fa-file"></i> <a data-pjax class="file" href="/admin/edit{{ $path }}{{.URL}}">{{.Name}}</a> {{ else }}
<i class="fa fa-file"></i> {{.Name}} {{ end }} {{ end }}
</td>
<td class="right hideable">{{.HumanSize}}</td>
<td class="right hideable">{{.HumanModTime "01/02/2006 3:04:05 PM"}}</td>
<td class="right"><button data-file="/admin/browse{{ $path }}{{.URL}}" data-message="File renamed." class="rename">&#9998;</button> <button data-file="/admin/browse{{ $path }}{{.URL}}" data-message="File deleted." class="delete">&#10006;</button></td>
</tr>
{{end}}
</table>
</div>
</main>
<div class="foreground hidden"></div>
<form id="new-file-form" class="input hidden">
<h3>New file</h3>
<p>Write the name of the new file. If you want to use an archetype, add <code>:archetype</code> in the end, replacing 'archetype' by its name.</p>
<input id="new-file-name" type="text" placeholder="Write here...">
<p class="right">
<input type="submit" value="Create">
</p>
</form>
<div class="input hidden" id="rename-form">
<h3>Rename file</h3>
<input id="new-file-name" type="text" placeholder="New name...">
</div>
{{ end }}