From 67f475ce4295e4e83f6e6254e3bce4abf9b9fe04 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Wed, 22 Jun 2016 21:32:33 +0100 Subject: [PATCH] update to caddy 0.9b2 --- assets/public/js/application.js | 13 +++++++++++++ post.go | 3 --- setup.go | 11 ++++++----- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/assets/public/js/application.js b/assets/public/js/application.js index a85c926e..8e556af2 100644 --- a/assets/public/js/application.js +++ b/assets/public/js/application.js @@ -1,5 +1,18 @@ "use strict"; +var deleteHandler = function(event) { + event.preventDefault(); + let name = this.dataset.delete; + + let element = document.getElementById(name); + document.removeChild(element); + + //$('label[for="' + name + '"]').fadeOut().remove(); +// $('#' + name).fadeOut().remove(); + + return false; +} + document.addEventListener("DOMContentLoaded", function(event) { //alert("hugo is working"); diff --git a/post.go b/post.go index a69199fd..ecdf5744 100644 --- a/post.go +++ b/post.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "errors" - "fmt" "io/ioutil" "net/http" "path/filepath" @@ -36,8 +35,6 @@ func (h Hugo) POST(w http.ResponseWriter, r *http.Request, filename string) (int rawBuffer.ReadFrom(r.Body) err := json.Unmarshal(rawBuffer.Bytes(), &data) - fmt.Println(string(rawBuffer.Bytes())) - if err != nil { return RespondJSON(w, &response{"Error decrypting json."}, http.StatusInternalServerError, err) } diff --git a/setup.go b/setup.go index e2582458..8152cc88 100644 --- a/setup.go +++ b/setup.go @@ -24,7 +24,7 @@ func init() { // Setup is the init function of Caddy plugins and it configures the whole // middleware thing. func setup(c *caddy.Controller) error { - cnf := httpserver.GetConfig(c.Key) + cnf := httpserver.GetConfig(c) conf, _ := ParseHugo(c, cnf.Root) // Checks if there is an Hugo website in the path that is provided. @@ -61,10 +61,11 @@ func setup(c *caddy.Controller) error { Next: next, Configs: []filemanager.Config{ filemanager.Config{ - PathScope: conf.Root, - Root: http.Dir(conf.Root), - BaseURL: conf.BaseURL, - StyleSheet: conf.Styles, + HugoEnabled: true, + PathScope: conf.Root, + Root: http.Dir(conf.Root), + BaseURL: conf.BaseURL, + StyleSheet: conf.Styles, }, }, },