dingoblog / dingo

Blog engine written in Go
MIT License
284 stars 37 forks source link

Can not save a page #27

Closed dinever closed 8 years ago

dinever commented 8 years ago

If we create a new page from /admin/pages/, edit and then save it, the page will be turned into a post, which is not an expected behavior.

The reason behind this is that when saving an existing page, we are actually using the route POST /admin/editor/:id/. The request is handled by PostSaveHandler, which sets p.IsPage = false.

We may need to create a new general handler(e.g. ContentSaveHandler) for POST /admin/editor/:id/. The handler should retrieve the existing post/page by id, change the fields according to form value and save it.

In addition, by doing this we will have some duplicate code among ContentSaveHandler, PostSaveHandler and PageSaveHandler. It would be great if we can extract some code from them and avoid the duplication.

dinever commented 8 years ago

Fixed by #44