simplify some stuff

This commit is contained in:
Henrique Dias
2016-03-12 09:52:04 +00:00
parent 3301b60485
commit d41e4cc047
9 changed files with 33 additions and 54 deletions

View File

@@ -4,7 +4,6 @@ import (
"net/http"
"text/template"
"github.com/hacdias/caddy-hugo/config"
"github.com/hacdias/caddy-hugo/tools/templates"
"github.com/hacdias/caddy-hugo/tools/variables"
"github.com/mholt/caddy/middleware"
@@ -13,7 +12,7 @@ import (
// GET handles the GET method on browse page and shows the files listing Using
// the Browse Caddy middleware.
func GET(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error) {
func GET(w http.ResponseWriter, r *http.Request) (int, error) {
functions := template.FuncMap{
"CanBeEdited": templates.CanBeEdited,
"Defined": variables.Defined,
@@ -30,11 +29,11 @@ func GET(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error)
Next: middleware.HandlerFunc(func(w http.ResponseWriter, r *http.Request) (int, error) {
return 404, nil
}),
Root: c.Path,
Root: conf.Path,
Configs: []browse.Config{
{
PathScope: "/",
Variables: c,
Variables: conf,
Template: tpl,
},
},