structure changes

This commit is contained in:
Henrique Dias
2016-03-06 20:37:49 +00:00
parent 3f36200862
commit 1375038a66
43 changed files with 405 additions and 392 deletions

View File

@@ -8,7 +8,7 @@ import (
"strings"
"github.com/hacdias/caddy-hugo/config"
"github.com/hacdias/caddy-hugo/tools/utils"
"github.com/hacdias/caddy-hugo/tools/server"
)
// PUT handles the HTTP PUT request for all /admin/browse related requests.
@@ -31,7 +31,7 @@ func PUT(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error)
// Check if filename and archetype are specified in
// the request
if _, ok := info["filename"]; !ok {
return utils.RespondJSON(w, map[string]string{
return server.RespondJSON(w, map[string]string{
"message": "Filename not specified.",
}, 400, nil)
}
@@ -44,12 +44,12 @@ func PUT(w http.ResponseWriter, r *http.Request, c *config.Config) (int, error)
// Renames the file/folder
if err := os.Rename(old, new); err != nil {
return utils.RespondJSON(w, map[string]string{
return server.RespondJSON(w, map[string]string{
"message": "Something went wrong.",
}, 500, err)
}
return utils.RespondJSON(w, map[string]string{
return server.RespondJSON(w, map[string]string{
"message": "File renamed.",
}, 200, nil)
}