About page
This commit is contained in:
parent
f67d3f7aad
commit
7b78861384
@ -4,7 +4,6 @@ Bouquins in Go
|
||||
|
||||
## TODO
|
||||
|
||||
* About
|
||||
* translations
|
||||
* tests
|
||||
* UI book: cover in background
|
||||
|
@ -21,6 +21,7 @@ const (
|
||||
TPL_SERIES = "series.html"
|
||||
TPL_INDEX = "index.html"
|
||||
TPL_SEARCH = "search.html"
|
||||
TPL_ABOUT = "about.html"
|
||||
|
||||
PARAM_LIST = "list"
|
||||
PARAM_ORDER = "order"
|
||||
@ -38,6 +39,7 @@ const (
|
||||
URL_AUTHORS = "/authors/"
|
||||
URL_SERIES = "/series/"
|
||||
URL_SEARCH = "/search/"
|
||||
URL_ABOUT = "/about/"
|
||||
URL_JS = "/js/"
|
||||
URL_CSS = "/css/"
|
||||
URL_FONTS = "/fonts/"
|
||||
@ -134,12 +136,13 @@ type SeriesFull struct {
|
||||
}
|
||||
|
||||
type BouquinsModel struct {
|
||||
Title string `json:"title,omitempty"`
|
||||
Title string
|
||||
Page string
|
||||
}
|
||||
|
||||
// Constructor BouquinsModel
|
||||
func NewBouquinsModel(title string) *BouquinsModel {
|
||||
return &BouquinsModel{title}
|
||||
func NewBouquinsModel(title, page string) *BouquinsModel {
|
||||
return &BouquinsModel{title, page}
|
||||
}
|
||||
|
||||
type IndexModel struct {
|
||||
@ -149,7 +152,7 @@ type IndexModel struct {
|
||||
|
||||
// Constructor IndexModel
|
||||
func NewIndexModel(title string, count int64) *IndexModel {
|
||||
return &IndexModel{*NewBouquinsModel(title), count}
|
||||
return &IndexModel{*NewBouquinsModel(title, "index"), count}
|
||||
}
|
||||
|
||||
type SearchModel struct {
|
||||
@ -157,7 +160,7 @@ type SearchModel struct {
|
||||
}
|
||||
|
||||
func NewSearchModel() *SearchModel {
|
||||
return &SearchModel{*NewBouquinsModel("Recherche")}
|
||||
return &SearchModel{*NewBouquinsModel("Recherche", "search")}
|
||||
}
|
||||
|
||||
type ResultsModel struct {
|
||||
@ -320,7 +323,7 @@ func (app *Bouquins) BookPage(idParam string, res http.ResponseWriter, req *http
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return app.render(res, TPL_BOOKS, &BookModel{*NewBouquinsModel(book.Title), book})
|
||||
return app.render(res, TPL_BOOKS, &BookModel{*NewBouquinsModel(book.Title, "book"), book})
|
||||
}
|
||||
func (app *Bouquins) BooksPage(res http.ResponseWriter, req *http.Request) {
|
||||
var err error
|
||||
@ -359,7 +362,7 @@ func (app *Bouquins) AuthorPage(idParam string, res http.ResponseWriter, req *ht
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return app.render(res, TPL_AUTHORS, &AuthorModel{*NewBouquinsModel(author.Name), author})
|
||||
return app.render(res, TPL_AUTHORS, &AuthorModel{*NewBouquinsModel(author.Name, "author"), author})
|
||||
}
|
||||
func (app *Bouquins) AuthorsPage(res http.ResponseWriter, req *http.Request) {
|
||||
var err error
|
||||
@ -398,7 +401,7 @@ func (app *Bouquins) SeriePage(idParam string, res http.ResponseWriter, req *htt
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return app.render(res, TPL_SERIES, &SeriesModel{*NewBouquinsModel(series.Name), series})
|
||||
return app.render(res, TPL_SERIES, &SeriesModel{*NewBouquinsModel(series.Name, "series"), series})
|
||||
}
|
||||
func (app *Bouquins) SeriesPage(res http.ResponseWriter, req *http.Request) {
|
||||
var err error
|
||||
@ -425,3 +428,9 @@ func (app *Bouquins) SearchPage(res http.ResponseWriter, req *http.Request) {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
func (app *Bouquins) AboutPage(res http.ResponseWriter, req *http.Request) {
|
||||
err := app.render(res, TPL_ABOUT, NewBouquinsModel("A propos", "about"))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
}
|
||||
|
1
main.go
1
main.go
@ -89,6 +89,7 @@ func router(app *Bouquins) {
|
||||
http.HandleFunc(URL_AUTHORS, app.AuthorsPage)
|
||||
http.HandleFunc(URL_SERIES, app.SeriesPage)
|
||||
http.HandleFunc(URL_SEARCH, app.SearchPage)
|
||||
http.HandleFunc(URL_ABOUT, app.AboutPage)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
6
templates/about.html
Normal file
6
templates/about.html
Normal file
@ -0,0 +1,6 @@
|
||||
{{ template "header.html" . }}
|
||||
<div class="container" id="about">
|
||||
<p><b>bouquins</b> est une interface web pour le gestionnaire de livres numériques <a href="https://calibre-ebook.com/">calibre</a>. Cette version utilise le langage <a href="https://golang.org/">Go</a>, le framework <a href="https://getbootstrap.com/">bootstap</a> et le framework <a href="https://vuejs.org/">Vue.js</a>.</p>
|
||||
<p>Ce logiciel est open-source et distribué sous <a href="https://opensource.org/licenses/BSD-3-Clause">license BSD</a>. Le code source est disponible ici: <a href="https://git.meutel.net/meutel/go-bouquins">https://git.meutel.net/meutel/go-bouquins</a>.
|
||||
</div>
|
||||
{{ template "footer.html" . }}
|
@ -14,9 +14,9 @@
|
||||
<nav class="navbar navbar-inverse" id="nav">
|
||||
<div class="container">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="/">Accueil</a></li>
|
||||
<li><a href="/search">Recherche</a></li>
|
||||
<li><a href="#">A propos</a></li>
|
||||
<li{{ if ne .Page "search" }}{{ if (ne .Page "about") }} class="active"{{ end }}{{ end }}><a href="/">Accueil</a></li>
|
||||
<li{{ if eq .Page "search" }} class="active"{{ end }}><a href="/search/">Recherche</a></li>
|
||||
<li{{ if eq .Page "about" }} class="active"{{ end }}><a href="/about/">A propos</a></li>
|
||||
</ul>
|
||||
<form class="navbar-form navbar-right" role="search" method="get" action="/search/">
|
||||
<div class="form-group">
|
||||
|
Loading…
Reference in New Issue
Block a user