fixed a couple minor bugs

pull/8/head
Stephen Searles 8 years ago
parent 5d78da0f30
commit c8881bedfc
  1. 2
      caddyhugo.go
  2. 18
      templates.go

@ -477,7 +477,7 @@ func (ch CaddyHugo) NewContent(w http.ResponseWriter, r *http.Request) (int, err
}
// serve redirect
http.Redirect(w, r, filepath.Join("/hugo/edit/", ch.Site.Root, "content", filename), http.StatusFound)
http.Redirect(w, r, filepath.Join("/hugo/edit/", "content", filename), http.StatusFound)
return http.StatusFound, nil
}

@ -7,6 +7,7 @@ import (
"os"
"path"
"path/filepath"
"strings"
"git.stephensearles.com/stephen/acedoc"
@ -106,23 +107,18 @@ func baseNoExt(name string) string {
func (t tmplData) IframeSource() string {
name := baseNoExt(t.docref.name)
ctype := baseNoExt(path.Dir(t.docref.name))
return fmt.Sprintf("/hugo/draft/%s/%s/%s/", base64.RawURLEncoding.EncodeToString([]byte(t.docref.name)), ctype, name)
return fmt.Sprintf("/hugo/draft/%s/%s/%s/", base64.RawURLEncoding.EncodeToString([]byte(t.docref.name)), ctype, strings.Replace(name, " ", "-", -1))
}
var EditPage = `<html>
<head>
<script src="/hugo/simplemde.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ext-settings_menu.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ext-keybinding_menu.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/keybinding-vim.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/mode-markdown.js"></script>
<style type="text/css" media="screen">
#editor {
#editor-wrapper {
position: absolute;
top: 50px;
right: 0;
bottom: 0;
bottom: 150px;
left: 40%;
}
#draft {
@ -151,8 +147,10 @@ var EditPage = `<html>
<span v-else>saved</span>
<span v-if="connectionError">, ${connectionError}</span>
</div>
<textarea id="editor">{{ .LoadContent }}</textarea>
<div id="draft"><!--<iframe src="{{ .IframeSource }}">Loading draft...</iframe>--></div>
<div id="editor-wrapper">
<textarea id="editor">{{ .LoadContent }}</textarea>
</div>
<div id="draft"><iframe src="{{ .IframeSource }}">Loading draft...</iframe></div>
</div>
<script>
var uiBindings = {

Loading…
Cancel
Save