mirror of https://github.com/jlelse/GoBlog
Fix update button on home-posts
This commit is contained in:
parent
4123871fd9
commit
64732af4d3
|
@ -29,12 +29,7 @@ func (a *goBlog) serveEditorPost(w http.ResponseWriter, r *http.Request) {
|
||||||
if action := r.FormValue("editoraction"); action != "" {
|
if action := r.FormValue("editoraction"); action != "" {
|
||||||
switch action {
|
switch action {
|
||||||
case "loadupdate":
|
case "loadupdate":
|
||||||
parsedURL, err := url.Parse(r.FormValue("url"))
|
post, err := a.getPost(r.FormValue("path"))
|
||||||
if err != nil {
|
|
||||||
a.serveError(w, r, err.Error(), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
post, err := a.getPost(parsedURL.Path)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.serveError(w, r, err.Error(), http.StatusBadRequest)
|
a.serveError(w, r, err.Error(), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
|
@ -42,7 +37,7 @@ func (a *goBlog) serveEditorPost(w http.ResponseWriter, r *http.Request) {
|
||||||
a.render(w, r, templateEditor, &renderData{
|
a.render(w, r, templateEditor, &renderData{
|
||||||
BlogString: blog,
|
BlogString: blog,
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
"UpdatePostURL": parsedURL.String(),
|
"UpdatePostURL": a.fullPostURL(post),
|
||||||
"UpdatePostContent": a.postToMfItem(post).Properties.Content[0],
|
"UpdatePostContent": a.postToMfItem(post).Properties.Content[0],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<div id="posteditactions" class="p">
|
<div id="posteditactions" class="p">
|
||||||
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
|
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
|
||||||
<input type="hidden" name="editoraction" value="loadupdate">
|
<input type="hidden" name="editoraction" value="loadupdate">
|
||||||
<input type="hidden" name="url" value="{{ .Canonical }}">
|
<input type="hidden" name="path" value="{{ .Data.Path }}">
|
||||||
<input type="submit" value="{{ string .Blog.Lang "update" }}">
|
<input type="submit" value="{{ string .Blog.Lang "update" }}">
|
||||||
</form>
|
</form>
|
||||||
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}">
|
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}">
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div id="posteditactions" class="p">
|
<div id="posteditactions" class="p">
|
||||||
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
|
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
|
||||||
<input type="hidden" name="editoraction" value="loadupdate">
|
<input type="hidden" name="editoraction" value="loadupdate">
|
||||||
<input type="hidden" name="url" value="{{ .Canonical }}">
|
<input type="hidden" name="path" value="{{ .Data.Path }}">
|
||||||
<input type="submit" value="{{ string .Blog.Lang "update" }}">
|
<input type="submit" value="{{ string .Blog.Lang "update" }}">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue