✨🚧 Implement admin interface to manage shares and users
This commit is contained in:
42
templates/base.html
Normal file
42
templates/base.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ShareDAV</title>
|
||||
<style>
|
||||
thead {
|
||||
font-weight: bold;
|
||||
}
|
||||
#content {
|
||||
float: right;
|
||||
width: 100%;
|
||||
background-color: #F0F0F0;
|
||||
}
|
||||
#menu {
|
||||
float: left;
|
||||
width: 200px;
|
||||
margin-left: -200px;
|
||||
background-color: #CCCCCC;
|
||||
}
|
||||
#menu span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-left: 200px
|
||||
}
|
||||
</style>
|
||||
{{ block "page-styles" . }}{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
{{ block "page-content" . }}{{ end }}
|
||||
</div>
|
||||
<div id="menu">
|
||||
<span><a href="./">ShareDAV</a></span>
|
||||
<span><a href="users">Users</a></span>
|
||||
<span><a href="shares">Shares</a></span>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</body>
|
||||
</html>
|
||||
17
templates/confirm.html
Normal file
17
templates/confirm.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{ define "page-styles"}}
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ define "page-content" }}
|
||||
<form method="post" action="{{ $.URL }}">
|
||||
{{ range $k, $v := .Fields }}
|
||||
<input type="hidden" name="{{ $k }}" value="{{ $v }}"/>
|
||||
{{ end }}
|
||||
<div class="confirm message">
|
||||
{{ $.Message }}
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" name="_yes" value="Yes"/> <input type="submit" name="_no" value="No"/>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
24
templates/create-share.html
Normal file
24
templates/create-share.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{{ define "page-styles"}}
|
||||
<style>
|
||||
#content label,
|
||||
#content label > * {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
{{ end }}
|
||||
|
||||
{{ define "page-content" }}
|
||||
<form method="post">
|
||||
<div>
|
||||
<label>
|
||||
Name: <input type="text" width="40" name="name" placeholder="Enter name"/>
|
||||
</label>
|
||||
<label>
|
||||
Role: <textarea rows="5" cols="40" name="description" placeholder="Enter description"></textarea>
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" value="Create share"/>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
8
templates/error.html
Normal file
8
templates/error.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ define "page-content" }}
|
||||
<div class="error">
|
||||
<div class="message">{{ .ErrorMessage }}</div>
|
||||
{{ if $.ReturnURL }}
|
||||
<a href="{{ $.ReturnURL }}">Go back</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
3
templates/index.html
Normal file
3
templates/index.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "page-content" }}
|
||||
Test {{.foo}}
|
||||
{{ end }}
|
||||
22
templates/share-add-user.html
Normal file
22
templates/share-add-user.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ define "page-content" }}
|
||||
<form method="post">
|
||||
<input name="share" type="hidden" value="{{ .ShareId }}"/>
|
||||
<label>
|
||||
User:
|
||||
<select name="user">
|
||||
{{ range $user := .Users}}
|
||||
<option value="{{ $user.Username }}">{{ $user.Username }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Role:
|
||||
<select name="role">
|
||||
<option value="reader">Reader</option>
|
||||
<option value="writer" selected>Writer</option>
|
||||
<option value="admin">Admin</option>
|
||||
</select>
|
||||
</label>
|
||||
<input type="submit" value="Add User"/>
|
||||
</form>
|
||||
{{ end }}
|
||||
47
templates/shares.html
Normal file
47
templates/shares.html
Normal file
@@ -0,0 +1,47 @@
|
||||
{{ define "page-styles"}}
|
||||
<style>
|
||||
div.share-user {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
a.share-add-user {
|
||||
margin-left: 2em;
|
||||
margin-top: .5em;
|
||||
font-style: italic;
|
||||
}
|
||||
div.share {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
:target {
|
||||
background-color: #c4e1ff;
|
||||
}
|
||||
</style>
|
||||
{{ end }}
|
||||
|
||||
{{ define "page-content" }}
|
||||
<div id="shares">
|
||||
{{ range $share := . }}
|
||||
<div id="share-{{$share.UUID}}" class="share">
|
||||
UUID: {{ $share.UUID }} <form style="display: inline-block;" action="delete-share" method="post">
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="submit" value="Delete"/>
|
||||
</form>
|
||||
<br/>
|
||||
Name: {{ $share.Name }}<br/>
|
||||
{{ range $user := .Users }}
|
||||
<div id="user-{{$share.UUID}}-{{$user.Username}}" class="share-user">
|
||||
User {{ $user.Username }} ({{ $user.Role }})
|
||||
<form style="display: inline-block;" action="share-delete-user" method="post">
|
||||
<input type="hidden" name="share" value="{{ $share.UUID }}"/>
|
||||
<input type="hidden" name="user" value="{{ $user.Username }}"/>
|
||||
<input type="submit" value="Delete"/>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="share-add-user?share={{ $share.UUID }}" class="share-add-user">Add User</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
<a href="create-share" class="create-share">Create Share</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
16
templates/users.html
Normal file
16
templates/users.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{{ define "page-content" }}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>User</td>
|
||||
<td>Role</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range $user := .}}<tr>
|
||||
<td>{{ $user.Username }}</td>
|
||||
<td>{{ $user.Role }}</td>
|
||||
</tr>{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user