s3manager-web/templates/bucket.html.tmpl

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