Added file management.
This commit is contained in:
parent
09b8393c8a
commit
3eab2f5562
12 changed files with 201 additions and 21 deletions
|
|
@ -30,6 +30,7 @@
|
|||
<li>{{link (url "contact") "Contact" .Path}}</li>
|
||||
<li>{{link (url "cache") "Cache" .Path}}</li>
|
||||
<li>{{link (url "task") "Task" .Path}}</li>
|
||||
<li>{{link (url "files") "Files" .Path}}</li>
|
||||
</ul>
|
||||
|
||||
<p class="menu-label">Account</p>
|
||||
|
|
|
|||
51
templates/pages/files.gohtml
Normal file
51
templates/pages/files.gohtml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{{define "content"}}
|
||||
<article class="message is-link">
|
||||
<div class="message-body">
|
||||
<p>This is a very basic example of how to handle file uploads. Files uploaded will be saved to the directory specified in your configuration.</p>
|
||||
</div>
|
||||
</article>
|
||||
<form id="files" method="post" action="{{url "files.submit"}}" enctype="multipart/form-data">
|
||||
<div class="field file">
|
||||
<label class="file-label">
|
||||
<input class="file-input" type="file" name="file" />
|
||||
<span class="file-cta">
|
||||
<span class="file-label">Choose a file… </span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field is-grouped">
|
||||
<div class="control">
|
||||
<button class="button is-link">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{template "csrf" .}}
|
||||
</form>
|
||||
|
||||
<hr/>
|
||||
<h3 class="title">Uploaded files</h3>
|
||||
<article class="message is-warning">
|
||||
<div class="message-body">
|
||||
<p>Below are all files in the configured upload directory.</p>
|
||||
</div>
|
||||
</article>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Filename</th>
|
||||
<th>Size</th>
|
||||
<th>Modified on</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{- range .Data}}
|
||||
<tr>
|
||||
<td>{{.Name}}</td>
|
||||
<td>{{.Size}}</td>
|
||||
<td>{{.Modified}}</td>
|
||||
</tr>
|
||||
{{- end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
|
|
@ -25,6 +25,7 @@ const (
|
|||
PageCache Page = "cache"
|
||||
PageContact Page = "contact"
|
||||
PageError Page = "error"
|
||||
PageFiles Page = "files"
|
||||
PageForgotPassword Page = "forgot-password"
|
||||
PageHome Page = "home"
|
||||
PageLogin Page = "login"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue