diff --git a/bouquins/bouquins.go b/bouquins/bouquins.go index e63f963..9d3ecb7 100644 --- a/bouquins/bouquins.go +++ b/bouquins/bouquins.go @@ -140,6 +140,11 @@ func NewIndexModel(title string, count int64) *IndexModel { } } +type BookModel struct { + BouquinsModel + *BookFull +} + func (app *Bouquins) render(res http.ResponseWriter, tpl string, model interface{}) { err := app.Template.ExecuteTemplate(res, tpl, model) if err != nil { @@ -182,7 +187,16 @@ func (app *Bouquins) IndexPage(res http.ResponseWriter, req *http.Request) { } } func (app *Bouquins) BooksPage(res http.ResponseWriter, req *http.Request) { - app.render(res, TPL_BOOKS, nil) + book, err := app.BookFull(123) + if err != nil { + // FIXME 500 + log.Fatalln(err) + } + model := &BookModel{ + *NewBouquinsModel(book.Title), + book, + } + app.render(res, TPL_BOOKS, model) } func (app *Bouquins) AuthorsPage(res http.ResponseWriter, req *http.Request) { app.render(res, TPL_AUTHORS, nil) diff --git a/bouquins/db.go b/bouquins/db.go index 3d7c34a..d51dab8 100644 --- a/bouquins/db.go +++ b/bouquins/db.go @@ -203,6 +203,13 @@ func (app *Bouquins) AuthorsAdv(limit, offset int, sort, order string) ([]*Autho panic("not implemented") } +func (app *Bouquins) BookFull(id int64) (*BookFull, error) { + b := new(BookFull) + b.Id = id + b.Title = "test" + return b, nil +} + func (app *Bouquins) BooksAdv(limit, offset int, sort, order string) ([]*BookAdv, error) { if limit == 0 { limit = DEF_LIM diff --git a/templates/book.html b/templates/book.html index 2a87ac2..e15102e 100644 --- a/templates/book.html +++ b/templates/book.html @@ -8,7 +8,7 @@

- {{ .Book.Title }} + {{ .Title }}

@@ -36,12 +36,12 @@ Serie
- {{ .Book.Series.Name }} - {{ .Book.Series.Idx }} + {{ .Series.Name }} + {{ .Series.Idx }}

Langue

- +

Tags @@ -54,8 +54,8 @@

Détails