mirror of
https://github.com/gmemstr/sliproad.git
synced 2024-09-20 00:21:15 +01:00
Add basic styling to listing page, fix previous directory link.
This commit is contained in:
parent
7b091438d4
commit
4bd60c6c1d
|
@ -10,16 +10,16 @@
|
|||
<body>
|
||||
<main>
|
||||
<div>
|
||||
<h1>{{$path}}</h1>
|
||||
<h1>{{$prefix}}/{{$path}}</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<a href="/{{$prefix}}{{$prev}}">..</a> <br>
|
||||
<p class="directory"><a href="/{{$prefix}}/{{$prev}}">..</a></p>
|
||||
{{range $file := .Files}}
|
||||
{{ if $file.IsDir }}
|
||||
<a href="/{{$prefix}}/{{$path}}/{{$file.Name}}">{{$file.Name}}</a> <br>
|
||||
<p class="directory"><a href="/{{$prefix}}/{{$path}}/{{$file.Name}}">{{$file.Name}}/</a></p>
|
||||
{{ end }}
|
||||
{{ if not $file.IsDir }}
|
||||
<a href="/{{$singleprefix}}/{{$path}}/{{$file.Name}}">{{$file.Name}}</a> <br>
|
||||
<p class="file"><a href="/{{$singleprefix}}/{{$path}}/{{$file.Name}}">{{$file.Name}}</a></p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
body {
|
||||
font-family: Open Sans, Arial, sans-serif;
|
||||
color: #454545;
|
||||
font-size: 16px;
|
||||
margin: 2em auto;
|
||||
max-width: 800px;
|
||||
padding: 1em;
|
||||
line-height: 1.4;
|
||||
text-align: justify;
|
||||
background-color: #fefefe;
|
||||
}
|
||||
|
||||
.directory, .file {
|
||||
margin: 0;
|
||||
border: 1px solid #454545;
|
||||
margin-top: -1px;
|
||||
padding: 0.5em;
|
||||
-webkit-transition: background-color 0.5s linear;
|
||||
-moz-transition: background-color 0.5s linear;
|
||||
-ms-transition: background-color 0.5s linear;
|
||||
-o-transition: background-color 0.5s linear;
|
||||
transition: background-color 0.5s linear;
|
||||
}
|
||||
|
||||
.directory:hover, .file:hover {
|
||||
background-color: lightgray;
|
||||
-webkit-transition: background-color 0.5s linear;
|
||||
-moz-transition: background-color 0.5s linear;
|
||||
-ms-transition: background-color 0.5s linear;
|
||||
-o-transition: background-color 0.5s linear;
|
||||
transition: background-color 0.5s linear;
|
||||
}
|
|
@ -2,7 +2,6 @@ package files
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gmemstr/nas/common"
|
||||
"github.com/gorilla/mux"
|
||||
"html/template"
|
||||
|
@ -75,7 +74,7 @@ func Listing(tier string) common.Handler {
|
|||
Prefix: prefix,
|
||||
SinglePrefix: singleprefix,
|
||||
}
|
||||
fmt.Println(prefix)
|
||||
|
||||
t, err := template.ParseFiles("assets/web/listing.html")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -93,7 +92,6 @@ func ViewFile(tier string) common.Handler {
|
|||
return func(rc *common.RouterContext, w http.ResponseWriter, r *http.Request) *common.HTTPError {
|
||||
vars := mux.Vars(r)
|
||||
id := vars["file"]
|
||||
fmt.Println(id)
|
||||
|
||||
d, err := ioutil.ReadFile("assets/config/config.json")
|
||||
if err != nil {
|
||||
|
|
|
@ -49,7 +49,7 @@ func Init() *mux.Router {
|
|||
rootHandler(),
|
||||
)).Methods("GET")
|
||||
|
||||
r.Handle("/files", Handle(
|
||||
r.Handle("/files/", Handle(
|
||||
files.Listing("hot"),
|
||||
)).Methods("GET")
|
||||
r.Handle(`/files/{file:[a-zA-Z0-9=\-\/.]+}`, Handle(
|
||||
|
@ -59,7 +59,7 @@ func Init() *mux.Router {
|
|||
files.ViewFile("hot"),
|
||||
)).Methods("GET")
|
||||
|
||||
r.Handle("/archive", Handle(
|
||||
r.Handle("/archive/", Handle(
|
||||
files.Listing("cold"),
|
||||
)).Methods("GET")
|
||||
r.Handle(`/archive/{file:[a-zA-Z0-9=\-\/.]+}`, Handle(
|
||||
|
|
Loading…
Reference in a new issue