Recalculate keywords after edit record
This commit is contained in:
parent
ddbb5d946a
commit
f167d6a12f
1 changed files with 4 additions and 2 deletions
6
admin.go
6
admin.go
|
@ -92,13 +92,15 @@ func saveHandler(coll *mgo.Collection) func(http.ResponseWriter, *http.Request)
|
||||||
author := cleanEmptyStr(r.Form["author"])
|
author := cleanEmptyStr(r.Form["author"])
|
||||||
subject := cleanEmptyStr(r.Form["subject"])
|
subject := cleanEmptyStr(r.Form["subject"])
|
||||||
lang := cleanEmptyStr(r.Form["lang"])
|
lang := cleanEmptyStr(r.Form["lang"])
|
||||||
err := coll.Update(bson.M{"_id": id}, bson.M{"$set": bson.M{"title": title,
|
book := map[string]interface{}{"title": title,
|
||||||
"publisher": publisher,
|
"publisher": publisher,
|
||||||
"date": date,
|
"date": date,
|
||||||
"description": description,
|
"description": description,
|
||||||
"author": author,
|
"author": author,
|
||||||
"subject": subject,
|
"subject": subject,
|
||||||
"lang": lang}})
|
"lang": lang}
|
||||||
|
book["keywords"] = keywords(book)
|
||||||
|
err := coll.Update(bson.M{"_id": id}, bson.M{"$set": book})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
return
|
return
|
||||||
|
|
Reference in a new issue