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">
|
|
|
|
<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 := . }}
|
|
|
|
<div class="col m12 l6">
|
|
|
|
<a href="/buckets/{{ $bucket.Name }}" style="color: black;">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="row" style="margin-bottom: 0;">
|
|
|
|
<div class="col">
|
|
|
|
<i class="material-icons large">folder_open</i>
|
|
|
|
</div>
|
|
|
|
<div class="col">
|
|
|
|
<span class="card-title">
|
|
|
|
{{ $bucket.Name }}
|
|
|
|
</span>
|
|
|
|
<p style="color: gray;">Created on {{ $bucket.CreationDate }}</p>
|
|
|
|
</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 . }}
|
|
|
|
<p style="text-align: center;margin-top: 2em;">No buckets yet</p>
|
|
|
|
{{ 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">
|
2017-09-28 15:34:46 +02:00
|
|
|
<a class="btn-floating btn-large red modal-trigger" href="#modal-create-bucket">
|
2017-05-08 23:07:07 +02:00
|
|
|
<i class="large material-icons">add</i>
|
|
|
|
</a>
|
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">
|
|
|
|
<div class="col s6">
|
|
|
|
<div class="input-field">
|
|
|
|
<input placeholder="My Bucket" id="name" type="text" name="name">
|
|
|
|
<label for="name">Name</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-12-18 22:54:21 +01:00
|
|
|
</div>
|
2017-05-08 23:07:07 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
<button type="button" onclick="createBucket()" class="modal-action modal-close waves-effect waves-green btn-flat">Create</button>
|
|
|
|
<button class="modal-action modal-close waves-effect waves-green btn-flat">Cancel</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</form>
|
2016-12-18 22:54:21 +01:00
|
|
|
</div>
|
2016-12-21 00:32:40 +01:00
|
|
|
|
|
|
|
<script>
|
2017-05-08 23:07:07 +02:00
|
|
|
function createBucket() {
|
2016-12-21 00:32:40 +01:00
|
|
|
var formData = {};
|
|
|
|
$.each($('#create-bucket-form')
|
2017-05-08 23:07:07 +02:00
|
|
|
.serializeArray(), function(i, field) {
|
|
|
|
formData[field.name] = field.value;
|
|
|
|
});
|
2016-12-21 00:32:40 +01:00
|
|
|
$.ajax({
|
2017-05-08 23:07:07 +02:00
|
|
|
type: 'POST',
|
|
|
|
url: '/api/buckets',
|
|
|
|
data: JSON.stringify(formData),
|
|
|
|
dataType: 'json',
|
|
|
|
contentType: 'application/json',
|
|
|
|
success: function() { location.reload(); }
|
2016-12-21 00:32:40 +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 }}
|