s3manager-web/views/buckets.html

89 lines
2.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">
<a href="/" class="brand-logo">S3 Manager</a>
</div>
</nav>
<div class="container">
<div class="section">
<div class="row">
2016-12-18 22:54:21 +01:00
2016-12-21 22:29:12 +01:00
{{ if . }}
2016-12-21 00:32:40 +01:00
{{ 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>
2016-12-21 22:29:12 +01:00
</div>
2016-12-21 00:32:40 +01:00
</div>
2016-12-18 22:54:21 +01:00
</div>
</div>
2016-12-21 00:32:40 +01:00
</a>
2016-12-18 22:54:21 +01:00
</div>
2016-12-21 00:32:40 +01:00
{{ end }}
2016-12-21 22:29:12 +01:00
{{ end }}
{{ if not . }}
<p style="text-align: center;margin-top: 2em;">No buckets yet</p>
{{ end }}
2016-12-18 22:54:21 +01:00
2016-12-21 00:32:40 +01:00
</div>
2016-12-18 22:54:21 +01:00
</div>
</div>
<div class="fixed-action-btn">
<a class="btn-floating btn-large red" href="#modal-create-bucket">
<i class="large material-icons">add</i>
</a>
</div>
<div id="modal-create-bucket" class="modal">
<div class="modal-content">
<h4>Create Bucket</h4>
<br>
<div class="row">
<div class="col s6">
2016-12-21 22:29:12 +01:00
<form id="create-bucket-form">
2016-12-18 22:54:21 +01:00
<div class="input-field">
2016-12-21 00:32:40 +01:00
<input placeholder="My Bucket" id="name" type="text" name="name">
2016-12-18 22:54:21 +01:00
<label for="name">Name</label>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
2016-12-21 22:29:12 +01:00
<button type="button" onclick="createBucket()" class="modal-action modal-close waves-effect waves-green btn-flat">Create</button>
2016-12-21 00:32:40 +01:00
<button class="modal-action modal-close waves-effect waves-green btn-flat">Cancel</button>
2016-12-18 22:54:21 +01:00
</div>
</div>
2016-12-21 00:32:40 +01:00
<script>
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',
success: function() { location.reload(); }
});
}
</script>
2016-12-18 22:54:21 +01:00
{{ end }}