s3manager-web/web/template/buckets.html.tmpl

88 lines
2.8 KiB
Cheetah
Raw Normal View History

2016-12-18 22:54:21 +01:00
{{ define "content" }}
2019-08-18 14:26:29 +02:00
<nav>
2017-05-08 23:07:07 +02:00
<div class="nav-wrapper container">
<a href="/" class="brand-logo">S3 Manager</a>
</div>
2016-12-21 00:32:40 +01:00
</nav>
<div class="container">
2017-05-08 23:07:07 +02:00
<div class="section">
<div class="row">
2016-12-18 22:54:21 +01:00
2017-05-08 23:07:07 +02:00
{{ if . }}
{{ range $bucket := . }}
2019-08-18 14:26:29 +02:00
<div class="col l6 m12">
<a href="/buckets/{{ $bucket.Name }}" style="color:black;">
2017-05-08 23:07:07 +02:00
<div class="card">
<div class="card-content">
2019-08-18 14:26:29 +02:00
<div class="row">
2017-05-08 23:07:07 +02:00
<div class="col">
<i class="material-icons large">folder_open</i>
</div>
<div class="col">
<span class="card-title">
{{ $bucket.Name }}
</span>
2019-08-18 14:26:29 +02:00
<p style="color:gray;">Created on {{ $bucket.CreationDate }}</p>
2017-05-08 23:07:07 +02:00
</div>
</div>
</div>
</div>
</a>
2016-12-18 22:54:21 +01:00
</div>
2017-05-08 23:07:07 +02:00
{{ end }}
{{ end }}
2016-12-21 22:29:12 +01:00
2017-05-08 23:07:07 +02:00
{{ if not . }}
2019-08-18 14:26:29 +02:00
<p style="text-align:center;margin-top:2em;color:gray;">No buckets yet</p>
2017-05-08 23:07:07 +02:00
{{ end }}
2016-12-18 22:54:21 +01:00
2017-05-08 23:07:07 +02:00
</div>
2016-12-21 00:32:40 +01:00
</div>
2016-12-18 22:54:21 +01:00
</div>
<div class="fixed-action-btn">
2019-08-18 14:26:29 +02:00
<button type="button" class="btn-floating btn-large red modal-trigger" data-target="modal-create-bucket">
<i class="material-icons large">add</i>
</button>
2016-12-18 22:54:21 +01:00
</div>
<div id="modal-create-bucket" class="modal">
2017-05-08 23:07:07 +02:00
<form id="create-bucket-form">
<div class="modal-content">
<h4>Create Bucket</h4>
<br>
<div class="row">
2019-08-18 14:26:29 +02:00
<div class="input-field col m6">
<input id="name" type="text" name="name" placeholder="My Bucket">
<label for="name">Name</label>
2017-05-08 23:07:07 +02:00
</div>
2016-12-18 22:54:21 +01:00
</div>
2017-05-08 23:07:07 +02:00
</div>
<div class="modal-footer">
2019-08-18 14:26:29 +02:00
<button type="button" class="modal-close waves-effect waves-green btn-flat">Cancel</button>
<button type="button" class="modal-close waves-effect waves-green btn" onclick="createBucket()">Create</button>
2017-05-08 23:07:07 +02:00
</div>
</form>
2016-12-18 22:54:21 +01:00
</div>
2016-12-21 00:32:40 +01:00
<script>
2019-08-18 14:26:29 +02:00
function createBucket() {
var formData = {};
$.each($('#create-bucket-form')
.serializeArray(), function(i, field) {
formData[field.name] = field.value;
});
$.ajax({
type: 'POST',
url: '/api/buckets',
data: JSON.stringify(formData),
dataType: 'json',
contentType: 'application/json; charset=utf-8',
success: function() { location.reload(); }
2017-05-08 23:07:07 +02:00
});
2019-08-18 14:26:29 +02:00
}
2016-12-21 00:32:40 +01:00
</script>
2016-12-18 22:54:21 +01:00
{{ end }}