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 != "" {
|
||||
switch action {
|
||||
case "loadupdate":
|
||||
parsedURL, err := url.Parse(r.FormValue("url"))
|
||||
if err != nil {
|
||||
a.serveError(w, r, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
post, err := a.getPost(parsedURL.Path)
|
||||
post, err := a.getPost(r.FormValue("path"))
|
||||
if err != nil {
|
||||
a.serveError(w, r, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
|
@ -42,7 +37,7 @@ func (a *goBlog) serveEditorPost(w http.ResponseWriter, r *http.Request) {
|
|||
a.render(w, r, templateEditor, &renderData{
|
||||
BlogString: blog,
|
||||
Data: map[string]interface{}{
|
||||
"UpdatePostURL": parsedURL.String(),
|
||||
"UpdatePostURL": a.fullPostURL(post),
|
||||
"UpdatePostContent": a.postToMfItem(post).Properties.Content[0],
|
||||
},
|
||||
})
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<div id="posteditactions" class="p">
|
||||
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
|
||||
<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" }}">
|
||||
</form>
|
||||
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}">
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div id="posteditactions" class="p">
|
||||
<form class="in" method="post" action="{{ .Blog.RelativePath "/editor" }}#update">
|
||||
<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" }}">
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue