Rename author to authors and subject to tags
This commit is contained in:
parent
e72de38725
commit
7f9c172853
17 changed files with 37 additions and 39 deletions
10
lib/admin.go
10
lib/admin.go
|
@ -69,8 +69,8 @@ func editHandler(h handler) {
|
|||
data.Book = book
|
||||
data.S = GetStatus(h)
|
||||
author := ""
|
||||
if len(book.Author) > 0 {
|
||||
author = " by " + book.Author[0]
|
||||
if len(book.Authors) > 0 {
|
||||
author = " by " + book.Authors[0]
|
||||
}
|
||||
data.S.Title = book.Title + author + " -- Edit -- " + data.S.Title
|
||||
h.template.load(h, "edit", data)
|
||||
|
@ -98,7 +98,7 @@ func saveHandler(h handler) {
|
|||
date := h.r.FormValue("date")
|
||||
description := h.r.FormValue("description")
|
||||
author := cleanEmptyStr(h.r.Form["author"])
|
||||
subject := cleanEmptyStr(strings.Split(h.r.FormValue("subject"), ","))
|
||||
tags := cleanEmptyStr(strings.Split(h.r.FormValue("tags"), ","))
|
||||
isbn := parser.ISBN(h.r.FormValue("isbn")) // XXX: check for errors
|
||||
lang := cleanEmptyStr(h.r.Form["lang"])
|
||||
book := map[string]interface{}{"title": title,
|
||||
|
@ -106,7 +106,7 @@ func saveHandler(h handler) {
|
|||
"date": date,
|
||||
"description": description,
|
||||
"author": author,
|
||||
"subject": subject,
|
||||
"tags": tags,
|
||||
"isbn": isbn,
|
||||
"lang": lang}
|
||||
err := h.db.UpdateBook(id, book)
|
||||
|
@ -174,7 +174,7 @@ func newHandler(h handler) {
|
|||
for i, b := range res {
|
||||
data.Books[i].B = b
|
||||
_, data.Books[i].TitleFound, _ = h.db.GetBooks("title:"+b.Title, 1, 0)
|
||||
_, data.Books[i].AuthorFound, _ = h.db.GetBooks("author:"+strings.Join(b.Author, " author:"), 1, 0)
|
||||
_, data.Books[i].AuthorFound, _ = h.db.GetBooks("author:"+strings.Join(b.Authors, " author:"), 1, 0)
|
||||
}
|
||||
data.Page = page + 1
|
||||
if num > (page+1)*newItemsPage {
|
||||
|
|
Reference in a new issue