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 @@ <input class="input-xlarge" type="text" id="tags" placeholder="Add tags" name="subject"> </div> </div> + <div class="control-group"> + <label class="control-label" for="tags">ISBN</label> + <div class="controls"> + <input class="input-xlarge" type="text" id="tags" value="{{.Isbn}}" name="isbn"> + </div> + </div> <div class="control-group"> <label class="control-label" for="date">Date</label> <div class="controls">