Fixed page editing. Fixes #44

This commit is contained in:
Jordan Wright 2015-10-23 18:35:42 -05:00
parent 014efb449e
commit 8141393480
2 changed files with 3 additions and 3 deletions

View file

@ -74,7 +74,7 @@ func PostPage(p *Page) error {
// PutPage edits an existing Page in the database. // PutPage edits an existing Page in the database.
// Per the PUT Method RFC, it presumes all data for a page is provided. // Per the PUT Method RFC, it presumes all data for a page is provided.
func PutPage(p *Page) error { func PutPage(p *Page) error {
err := db.Debug().Where("id=?", p.Id).Save(p).Error err := db.Where("id=?", p.Id).Save(p).Error
if err != nil { if err != nil {
Logger.Println(err) Logger.Println(err)
} }

View file

@ -10,8 +10,8 @@ function save(idx){
page.name = $("#name").val() page.name = $("#name").val()
page.html = CKEDITOR.instances["html_editor"].getData(); page.html = CKEDITOR.instances["html_editor"].getData();
if (idx != -1){ if (idx != -1){
page.id = page[idx].id page.id = pages[idx].id
api.landing_pageId.put(page) api.pageId.put(page)
.success(function(data){ .success(function(data){
successFlash("Page edited successfully!") successFlash("Page edited successfully!")
load() load()