Add ISBN to the metadata editor
This commit is contained in:
parent
0f627dcd53
commit
fcf9b1eb8d
2 changed files with 9 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"gitlab.com/trantor/trantor/lib/database"
|
"gitlab.com/trantor/trantor/lib/database"
|
||||||
|
"gitlab.com/trantor/trantor/lib/parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -94,6 +95,7 @@ func saveHandler(h handler) {
|
||||||
description := h.r.FormValue("description")
|
description := h.r.FormValue("description")
|
||||||
author := cleanEmptyStr(h.r.Form["author"])
|
author := cleanEmptyStr(h.r.Form["author"])
|
||||||
subject := cleanEmptyStr(h.r.Form["subject"])
|
subject := cleanEmptyStr(h.r.Form["subject"])
|
||||||
|
isbn := parser.ISBN(h.r.FormValue("isbn")) // XXX: check for errors
|
||||||
lang := cleanEmptyStr(h.r.Form["lang"])
|
lang := cleanEmptyStr(h.r.Form["lang"])
|
||||||
book := map[string]interface{}{"title": title,
|
book := map[string]interface{}{"title": title,
|
||||||
"publisher": publisher,
|
"publisher": publisher,
|
||||||
|
@ -101,6 +103,7 @@ func saveHandler(h handler) {
|
||||||
"description": description,
|
"description": description,
|
||||||
"author": author,
|
"author": author,
|
||||||
"subject": subject,
|
"subject": subject,
|
||||||
|
"isbn": isbn,
|
||||||
"lang": lang}
|
"lang": lang}
|
||||||
err := h.db.UpdateBook(id, book)
|
err := h.db.UpdateBook(id, book)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -43,6 +43,12 @@
|
||||||
<input class="input-xlarge" type="text" id="tags" placeholder="Add tags" name="subject">
|
<input class="input-xlarge" type="text" id="tags" placeholder="Add tags" name="subject">
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="control-group">
|
||||||
<label class="control-label" for="date">Date</label>
|
<label class="control-label" for="date">Date</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
|
Reference in a new issue