more work done

This commit is contained in:
ston1th 2019-05-01 22:25:23 +02:00
commit abc6159044
24 changed files with 309 additions and 230 deletions

View file

@ -28,7 +28,8 @@ const (
{{if eq .Data 1}}<br>This will also remove all files and directories below.</p>{{end}}
<form class="form-horizontal" action="/delete{{.Path}}" method="post">
<input type="hidden" name="token" value="{{.Token}}">
<button class="btn btn-sm btn-primary" type="submit">Delete</button>
<button class="btn btn-sm btn-danger" type="submit">Delete</button>
<a href="{{.Path}}" class="btn btn-sm btn-primary">Back</a>
</form>
</div>
</div>
@ -36,23 +37,21 @@ const (
</div>
{{end}}`
dir = `{{define "body"}}
<div class="page-header">
<div class="row">
<h2>{{.BodyTitle}}</h2>
</div>
</div>
<div class="row">
<a href="/">root</a>&nbsp;/&nbsp;
{{range $item := .Paths}}
<a href="{{$item.Abs}}">{{$item.Name}}</a>&nbsp;/&nbsp;
{{end}}
<ol class="breadcrumb full-width">
<li class="breadcrumb-item"></li>
<li class="breadcrumb-item"><a href="/">root</a></li>
{{range $item := .Paths}}
<li class="breadcrumb-item{{if $item.Indexed}} active{{end}}">{{if $item.Indexed}}{{$item.Name}}{{else}}<a href="{{$item.Abs}}">{{$item.Name}}</a>{{end}}</li>
{{end}}
</ol>
</div>
<div class="row">
<table class="table table-stripped table-hover">
<thead>
<tr>
<th></th>
<th>Path</th>
<th>Type</th>
<th>Options</th>
</tr>
</thead>
@ -60,23 +59,26 @@ const (
{{if .Data.Dirs}}
{{range $item := .Data.Dirs}}
<tr>
<td><input type="checkbox" name="cb" value="{{$item.Name}}"></td>
<td><a href="{{$item.Abs}}">{{$item.Name}}/</a></td>
<td>Move</td>
<td>Directory</td>
<td><div class="btn-group">
<a href="/move{{$item.Abs}}" class="btn btn-sm btn-primary">Move</a>
<a href="/delete{{$item.Abs}}" class="btn btn-sm btn-danger">Delete</a>
</div></td>
</tr>
{{end}}
{{end}}
{{if .Data.Files}}
{{range $item := .Data.Files}}
<tr>
<td><input type="checkbox" name="cb" value="{{$item.Name}}"></td>
<td><a href="{{$item.Abs}}">{{$item.Name}}</a></td>
<td>File</td>
<td><div class="btn-group">
{{if not $item.Indexed}}
<a href="/index{{$item.Abs}}" class="btn btn-sm btn-primary">Index</a>
{{end}}
<a href="/move{{$item.Abs}}" class="btn btn-sm btn-primary">Move</a>
<a href="/delete{{$item.Abs}}" class="btn btn-sm btn-primary">Delete</a>
<a href="/delete{{$item.Abs}}" class="btn btn-sm btn-danger">Delete</a>
</div></td>
</tr>
{{end}}
@ -86,16 +88,14 @@ const (
</div>
{{end}}`
file = `{{define "body"}}
<div class="page-header">
<div class="row">
<h2>{{.BodyTitle}}</h2>
</div>
</div>
<div class="row">
<a href="/">root</a>
{{range $i, $item := .Paths}}
&nbsp;/&nbsp;<a href="{{$item.Abs}}">{{$item.Name}}</a>
{{end}}
<ol class="breadcrumb full-width">
<li class="breadcrumb-item"></li>
<li class="breadcrumb-item"><a href="/">root</a></li>
{{range $item := .Paths}}
<li class="breadcrumb-item{{if $item.Indexed}} active{{end}}">{{if $item.Indexed}}{{$item.Name}}{{else}}<a href="{{$item.Abs}}">{{$item.Name}}</a>{{end}}</li>
{{end}}
</ol>
</div>
<div class="row">
<embed src="{{.Data}}" width="100%" height="700px" toolbar="1" statusbar="1" navpanes="1"></embed>
@ -124,7 +124,7 @@ const (
<title>DocStore | {{.Title}}</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" integrity="sha256-bgotk/IPq4Yvt6s8AQGPTM5ZjPjQ6rrBRa2EyxpnFSc="></link>
<link rel="stylesheet" type="text/css" href="/bootstrap.css" media="screen" integrity="sha256-NeLmQ7cX66J4MdtgGlG3O/TgvsSyP1b9WbaQtxYZUbQ="></link>
<link rel="stylesheet" type="text/css" href="/custom.css" media="screen" integrity="sha256-5/Vbh+c9BC042HeSbJXZZVIc1dD2b9cy6uH9LFAOSfo="></link>
<link rel="stylesheet" type="text/css" href="/custom.css" media="screen" integrity="sha256-iYnSZSZLepCN7vabI6deUcbcw+1UNCmKhXlJ75O+S6Y="></link>
<meta name="theme-color" content="#375a7f">
<meta name="description" content="{{.Title}}">
</head>
@ -153,6 +153,7 @@ const (
<div class="col">
<ul class="list-unstyled">
<li class="float-md-right"><a href="#top">Back to top</a></li>
<li><a href="https://git.giftfish.de/ston1th/docstore">Git</a></li>
</ul>
<p>© DocStore {{.Version}} Request: <strong>{{.Time}}ms</strong></p>
</div>
@ -161,6 +162,13 @@ const (
</div>
</body>
</html>`
ise = `{{define "body"}}
<div class="alert alert-danger msg">
<h4>Error!</h4>
<p>{{.Data}}</p>
<a href="{{.Path}}" class="btn btn-sm btn-primary">Back</a>
</div>
{{end}}`
login = `{{define "body"}}
<div class="page-header">
<div class="row">
@ -566,7 +574,10 @@ html, body, .container, .content {
margin: 0 auto -60px;
}
.push {
height: 60px;
height: 20px;
}
.full-width {
width: 100%;
}
.footer-wrapper {
position: relative;
@ -614,6 +625,7 @@ func (s *HTTPServer) loadTemplates() {
s.templ["deleteHandler"] = parse(index, menu, delete)
s.templ["notFoundHandler"] = parse(index, menu, notFound)
s.templ["forbiddenHandler"] = parse(index, menu, forbidden)
s.templ["iseHandler"] = parse(index, menu, ise)
s.templ["loginHandler"] = parse(index, menu, login)
s.templ["loginTotpHandler"] = parse(index, menu, loginTotp)
s.templ["searchHandler"] = parse(index, menu, search)