From fcf9b1eb8d32d798263ee46f32c45833fec43a59 Mon Sep 17 00:00:00 2001 From: Las Zenow Date: Tue, 31 Jan 2017 10:45:28 +0000 Subject: [PATCH] Add ISBN to the metadata editor --- lib/admin.go | 3 +++ templates/edit.html | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/lib/admin.go b/lib/admin.go index 020dac6..23bc414 100644 --- a/lib/admin.go +++ b/lib/admin.go @@ -9,6 +9,7 @@ import ( "github.com/gorilla/mux" "gitlab.com/trantor/trantor/lib/database" + "gitlab.com/trantor/trantor/lib/parser" ) const ( @@ -94,6 +95,7 @@ func saveHandler(h handler) { description := h.r.FormValue("description") author := cleanEmptyStr(h.r.Form["author"]) subject := cleanEmptyStr(h.r.Form["subject"]) + isbn := parser.ISBN(h.r.FormValue("isbn")) // XXX: check for errors lang := cleanEmptyStr(h.r.Form["lang"]) book := map[string]interface{}{"title": title, "publisher": publisher, @@ -101,6 +103,7 @@ func saveHandler(h handler) { "description": description, "author": author, "subject": subject, + "isbn": isbn, "lang": lang} err := h.db.UpdateBook(id, book) if err != nil { diff --git a/templates/edit.html b/templates/edit.html index 90186d7..1a695f3 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -43,6 +43,12 @@ +
+ +
+ +
+