s3manager-web/templates/bucket.html

110 lines
3.4 KiB
HTML
Raw Normal View History

2016-12-18 22:54:21 +01:00
{{ define "content" }}
2016-12-21 00:32:40 +01:00
<nav class="purple" role="navigation">
<div class="nav-wrapper container">
<span href="#" class="brand-logo"><i class="material-icons">folder_open</i>{{ .BucketName }}</span>
2016-12-21 22:29:12 +01:00
{{ if not .Objects }}
<a href="#" class="right" onclick="deleteBucket({{ .BucketName }})"><i class="material-icons">delete</i> Delete</a>
{{ end }}
2016-12-21 00:32:40 +01:00
</div>
</nav>
2016-12-21 01:45:07 +01:00
<div class="section">
2016-12-21 22:29:12 +01:00
<a href="/buckets" style="padding-left: 25px; vertical-align: middle;"><i class="material-icons" style="vertical-align: middle;">arrow_back</i> Buckets</a>
2016-12-21 00:32:40 +01:00
2016-12-21 22:29:12 +01:00
{{ if .Objects }}
2016-12-21 01:45:07 +01:00
<table class="highlight bordered">
2016-12-21 00:32:40 +01:00
2016-12-21 01:45:07 +01:00
<thead>
<tr>
<th></th>
<th>Key</th>
<th>Size</th>
<th>Owner</th>
<th>Last Modified</th>
2016-12-21 15:15:12 +01:00
<th></th>
2016-12-21 01:45:07 +01:00
</tr>
</thead>
2016-12-21 00:32:40 +01:00
2016-12-21 01:45:07 +01:00
<tbody>
{{ range $index, $object := .Objects }}
<tr>
2016-12-21 22:29:12 +01:00
<td style="padding-left: 25px;"><i class="material-icons">{{ $object.Icon }}</i></td>
2016-12-21 01:45:07 +01:00
<td>{{ $object.Key }}</td>
<td>{{ $object.Size }} bytes</td>
<td>{{ $object.Owner }}</td>
<td>{{ $object.LastModified }}</td>
<td>
<!-- Dropdown Trigger -->
2016-12-21 02:11:13 +01:00
<a class="dropdown-button waves-effect waves-teal btn-flat" href="#" data-activates="actions-dropdown-{{ $index }}">
2016-12-21 01:45:07 +01:00
Actions <i class="material-icons right">arrow_drop_down</i>
</a>
2016-12-21 00:32:40 +01:00
2016-12-21 01:45:07 +01:00
<!-- Dropdown Structure -->
2016-12-21 02:11:13 +01:00
<ul id="actions-dropdown-{{ $index }}" class="dropdown-content">
2016-12-21 01:45:07 +01:00
<li><a href="/api/buckets/{{ $.BucketName }}/objects/{{ $object.Key }}">Download</a></li>
2016-12-21 22:29:12 +01:00
<li><a href="#" onclick="deleteObject({{ $.BucketName }}, {{ $object.Key }})">Delete</a></li>
2016-12-21 01:45:07 +01:00
</ul>
</td>
</tr>
{{ end }}
</tbody>
2016-12-21 00:32:40 +01:00
2016-12-21 01:45:07 +01:00
</table>
2016-12-21 22:29:12 +01:00
{{ end }}
2016-12-21 00:32:40 +01:00
2016-12-21 01:45:07 +01:00
{{ if not .Objects }}
2016-12-21 22:29:12 +01:00
<p style="text-align: center;margin-top: 2em;">No objects in <strong>{{ .BucketName }}</strong> yet</p>
2016-12-21 01:45:07 +01:00
{{ end }}
2016-12-21 00:32:40 +01:00
</div>
<div class="fixed-action-btn">
<a class="btn-floating btn-large red" href="#modal-create-object">
<i class="large material-icons">add</i>
</a>
</div>
<div id="modal-create-object" class="modal">
<div class="modal-content">
<h4>Create Object</h4>
<br>
<div class="row">
<div class="col s6">
2016-12-21 01:45:07 +01:00
<form action="/api/buckets/{{ .BucketName }}/objects" method="POST" id="create-object-form" enctype="multipart/form-data">
<div class="file-field input-field">
<div class="btn">
<span>File</span>
<input type="file" name="file">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
2016-12-21 00:32:40 +01:00
</div>
2016-12-21 01:45:07 +01:00
</div>
2016-12-21 00:32:40 +01:00
</form>
</div>
</div>
</div>
<div class="modal-footer">
2016-12-21 01:45:07 +01:00
<button type="submit" form="create-object-form" class="modal-action modal-close waves-effect waves-green btn-flat">Upload</button>
2016-12-21 00:32:40 +01:00
<button class="modal-action modal-close waves-effect waves-green btn-flat">Cancel</button>
</div>
</div>
2016-12-18 22:54:21 +01:00
2016-12-21 00:32:40 +01:00
<script>
2016-12-21 22:29:12 +01:00
function deleteObject(bucketName, objectName) {
2016-12-21 00:32:40 +01:00
$.ajax({
type: 'DELETE',
2016-12-21 22:29:12 +01:00
url: '/api/buckets/' + bucketName + '/objects/' + objectName,
2016-12-21 00:32:40 +01:00
success: function () { location.reload(); }
})
}
2016-12-21 22:29:12 +01:00
function deleteBucket(bucketName) {
$.ajax({
type: 'DELETE',
url: '/api/buckets/' + bucketName,
success: function () { window.location.replace('/buckets'); }
})
}
2016-12-21 00:32:40 +01:00
</script>
2016-12-18 22:54:21 +01:00
{{ end }}