Factorise templates
This commit is contained in:
parent
8a06369839
commit
8df3f87a23
@ -99,42 +99,55 @@ type SeriesFull struct {
|
|||||||
Books []*Book
|
Books []*Book
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BouquinsModel struct {
|
||||||
|
Title string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor BouquinsModel
|
||||||
|
func NewBouquinsModel(title string) *BouquinsModel {
|
||||||
|
return &BouquinsModel{
|
||||||
|
title,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type IndexModel struct {
|
type IndexModel struct {
|
||||||
|
BouquinsModel
|
||||||
BooksCount int64
|
BooksCount int64
|
||||||
Books []*BookAdv
|
Books []*BookAdv
|
||||||
Series []*SeriesAdv
|
Series []*SeriesAdv
|
||||||
Authors []*AuthorAdv
|
Authors []*AuthorAdv
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *Bouquins) IndexPage(res http.ResponseWriter, req *http.Request) {
|
// Constructor IndexModel
|
||||||
series := make([]*SeriesAdv, 0)
|
func NewIndexModel(title string, count int64) *IndexModel {
|
||||||
a1 := make([]*Author, 0)
|
return &IndexModel{
|
||||||
s1 := &SeriesAdv{
|
*NewBouquinsModel(title),
|
||||||
Series{
|
count,
|
||||||
666,
|
nil,
|
||||||
"Serie 1",
|
|
||||||
},
|
|
||||||
12,
|
|
||||||
a1,
|
|
||||||
}
|
|
||||||
series = append(series, s1)
|
|
||||||
model := &IndexModel{
|
|
||||||
123,
|
|
||||||
nil,
|
nil,
|
||||||
series,
|
|
||||||
nil,
|
nil,
|
||||||
}
|
}
|
||||||
err := app.Template.ExecuteTemplate(res, TPL_INDEX, model)
|
}
|
||||||
|
|
||||||
|
// ROUTES //
|
||||||
|
|
||||||
|
func (app *Bouquins) render(res http.ResponseWriter, tpl string, model interface{}) {
|
||||||
|
err := app.Template.ExecuteTemplate(res, tpl, model)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (app *Bouquins) IndexPage(res http.ResponseWriter, req *http.Request) {
|
||||||
|
model := NewIndexModel("", 123)
|
||||||
|
app.render(res, TPL_INDEX, model)
|
||||||
|
}
|
||||||
func (app *Bouquins) BooksPage(res http.ResponseWriter, req *http.Request) {
|
func (app *Bouquins) BooksPage(res http.ResponseWriter, req *http.Request) {
|
||||||
panic("not implemented")
|
app.render(res, TPL_BOOKS, nil)
|
||||||
}
|
}
|
||||||
func (app *Bouquins) AuthorsPage(res http.ResponseWriter, req *http.Request) {
|
func (app *Bouquins) AuthorsPage(res http.ResponseWriter, req *http.Request) {
|
||||||
panic("not implemented")
|
app.render(res, TPL_AUTHORS, nil)
|
||||||
}
|
}
|
||||||
func (app *Bouquins) SeriesPage(res http.ResponseWriter, req *http.Request) {
|
func (app *Bouquins) SeriesPage(res http.ResponseWriter, req *http.Request) {
|
||||||
panic("not implemented")
|
app.render(res, TPL_SERIES, nil)
|
||||||
}
|
}
|
||||||
|
4
main.go
4
main.go
@ -15,6 +15,7 @@ const (
|
|||||||
SERIES = "/series"
|
SERIES = "/series"
|
||||||
JS = "/js/"
|
JS = "/js/"
|
||||||
CSS = "/css/"
|
CSS = "/css/"
|
||||||
|
FONTS = "/fonts/"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -22,11 +23,9 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
app := &bouquins.Bouquins{
|
app := &bouquins.Bouquins{
|
||||||
tpl,
|
tpl,
|
||||||
}
|
}
|
||||||
|
|
||||||
assets()
|
assets()
|
||||||
router(app)
|
router(app)
|
||||||
}
|
}
|
||||||
@ -34,6 +33,7 @@ func init() {
|
|||||||
func assets() {
|
func assets() {
|
||||||
http.Handle(JS, http.FileServer(http.Dir("assets")))
|
http.Handle(JS, http.FileServer(http.Dir("assets")))
|
||||||
http.Handle(CSS, http.FileServer(http.Dir("assets")))
|
http.Handle(CSS, http.FileServer(http.Dir("assets")))
|
||||||
|
http.Handle(FONTS, http.FileServer(http.Dir("assets")))
|
||||||
}
|
}
|
||||||
|
|
||||||
func router(app *bouquins.Bouquins) {
|
func router(app *bouquins.Bouquins) {
|
||||||
|
@ -1,73 +1,43 @@
|
|||||||
<!DOCTYPE html>
|
{{ template "header.html" . }}
|
||||||
<html lang="fr">
|
<div class="container" id="app">
|
||||||
<head>
|
<div class="page-header" v-if="author.id">
|
||||||
<title>Auteur | Bouquins</title>
|
<h1>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
<meta charset="utf-8" />
|
{{ .Author.Name }}
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
</h1>
|
||||||
<link rel="preload" href="/js/author.min.js" as="script">
|
</div>
|
||||||
<link rel="preload" href="/js/vue.min.js" as="script">
|
<div class="alert alert-danger" role="alert" v-else>Aucun livre sélectionné</div>
|
||||||
<link rel="prefetch" href="/js/author.min.js">
|
<ul class="nav nav-pills">
|
||||||
<link rel="prefetch" href="/js/vue.min.js">
|
<li role="presentation" :class="{ active: tab == 'books' }"><a href="#" @click="showBooks">Livres</a></li>
|
||||||
</head>
|
<li v-if="author.series && author.series.length > 0" role="presentation" :class="{ active: tab == 'series' }"><a href="#" @click="showSeries">Series</a></li>
|
||||||
<body>
|
<li v-if="author.authors && author.authors.length > 0"role="presentation" :class="{ active: tab == 'authors' }"><a href="#" @click="showAuthors">Co-auteurs</a></li>
|
||||||
<nav class="navbar navbar-inverse" id="nav">
|
</ul>
|
||||||
<div class="container">
|
<div class="panel panel-default" :class="{ hidden: tab != 'books' }">
|
||||||
<ul class="nav navbar-nav">
|
<div class="panel-body">
|
||||||
<li><a href="index.html">Accueil</a></li>
|
<ul v-for="book in author.books" class="list-unstyled">
|
||||||
<li><a href="search.html">Recherche</a></li>
|
<li><span class="glyphicon glyphicon-book"></span>
|
||||||
<li><a href="#">A propos</a></li>
|
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a>
|
||||||
</ul>
|
</li>
|
||||||
<form class="navbar-form navbar-right" role="search" method="get" action="search.html">
|
|
||||||
<div class="form-group">
|
|
||||||
<input name="q" type="text" class="form-control" placeholder="Recherche">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<div class="container" id="app">
|
|
||||||
<div class="page-header" v-if="author.id">
|
|
||||||
<h1>
|
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
|
||||||
{{ .Author.Name }}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" role="alert" v-else>Aucun livre sélectionné</div>
|
|
||||||
<ul class="nav nav-pills">
|
|
||||||
<li role="presentation" :class="{ active: tab == 'books' }"><a href="#" @click="showBooks">Livres</a></li>
|
|
||||||
<li v-if="author.series && author.series.length > 0" role="presentation" :class="{ active: tab == 'series' }"><a href="#" @click="showSeries">Series</a></li>
|
|
||||||
<li v-if="author.authors && author.authors.length > 0"role="presentation" :class="{ active: tab == 'authors' }"><a href="#" @click="showAuthors">Co-auteurs</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="panel panel-default" :class="{ hidden: tab != 'books' }">
|
|
||||||
<div class="panel-body">
|
|
||||||
<ul v-for="book in author.books" class="list-unstyled">
|
|
||||||
<li><span class="glyphicon glyphicon-book"></span>
|
|
||||||
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel panel-default" :class="{ hidden: tab != 'series' }">
|
|
||||||
<div class="panel-body">
|
|
||||||
<ul v-for="series in author.series" class="list-unstyled">
|
|
||||||
<li><span class="glyphicon glyphicon-list"></span>
|
|
||||||
<a :href="'series.html?id='+series.id">{{ .Series.Name }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel panel-default" :class="{ hidden: tab != 'authors' }">
|
|
||||||
<div class="panel-body">
|
|
||||||
<ul v-for="coauthor in author.authors" class="list-unstyled">
|
|
||||||
<li> <span class="glyphicon glyphicon-user"></span>
|
|
||||||
<a :href="'author.html?id='+coauthor.id">{{ .Coauthor.Name }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<script src="js/vue.min.js"></script>
|
</div>
|
||||||
<script src="js/author.min.js"></script>
|
<div class="panel panel-default" :class="{ hidden: tab != 'series' }">
|
||||||
</body>
|
<div class="panel-body">
|
||||||
</html>
|
<ul v-for="series in author.series" class="list-unstyled">
|
||||||
|
<li><span class="glyphicon glyphicon-list"></span>
|
||||||
|
<a :href="'series.html?id='+series.id">{{ .Series.Name }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-default" :class="{ hidden: tab != 'authors' }">
|
||||||
|
<div class="panel-body">
|
||||||
|
<ul v-for="coauthor in author.authors" class="list-unstyled">
|
||||||
|
<li> <span class="glyphicon glyphicon-user"></span>
|
||||||
|
<a :href="'author.html?id='+coauthor.id">{{ .Coauthor.Name }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ template "footer.html" . }}
|
||||||
|
@ -1,92 +1,62 @@
|
|||||||
<!DOCTYPE html>
|
{{ template "header.html" . }}
|
||||||
<html lang="fr">
|
<div class="container" id="app">
|
||||||
<head>
|
<div class="page-header" v-if="book.id">
|
||||||
<title>Livre | Bouquins</title>
|
<div class="row" v-if="book.has_cover">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<img :src="bookCover(book)" alt="Pas de couverture" title="Couverture" class="img-responsive img-rounded"/>
|
||||||
<meta charset="utf-8" />
|
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
|
||||||
<link rel="preload" href="/js/book.min.js" as="script">
|
|
||||||
<link rel="preload" href="/js/vue.min.js" as="script">
|
|
||||||
<link rel="prefetch" href="/js/book.min.js">
|
|
||||||
<link rel="prefetch" href="/js/vue.min.js">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<nav class="navbar navbar-inverse" id="nav">
|
|
||||||
<div class="container">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<li><a href="index.html">Accueil</a></li>
|
|
||||||
<li><a href="search.html">Recherche</a></li>
|
|
||||||
<li><a href="#">A propos</a></li>
|
|
||||||
</ul>
|
|
||||||
<form class="navbar-form navbar-right" role="search" method="get" action="search.html">
|
|
||||||
<div class="form-group">
|
|
||||||
<input name="q" type="text" class="form-control" placeholder="Recherche">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
<div class="container" id="app">
|
|
||||||
<div class="page-header" v-if="book.id">
|
|
||||||
<div class="row" v-if="book.has_cover">
|
|
||||||
<img :src="bookCover(book)" alt="Pas de couverture" title="Couverture" class="img-responsive img-rounded"/>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12 col-md-9">
|
|
||||||
<h1>
|
|
||||||
<span class="glyphicon glyphicon-book"></span>
|
|
||||||
{{ .Book.Title }}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12 col-md-3 text-right">
|
|
||||||
<template v-for="data in book.data">
|
|
||||||
<a :href="bookLink(book, data)" class="btn btn-success">
|
|
||||||
<span class="glyphicon glyphicon-download-alt"></span> Télécharger
|
|
||||||
{{ .Data.Format }} ({{/* .FormatBytes(data.size) */}})
|
|
||||||
</a>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" role="alert" v-else>Aucun livre sélectionné</div>
|
|
||||||
<div class="row" v-if="book.id">
|
|
||||||
<h2>
|
|
||||||
<span class="glyphicon glyphicon-user"></span> Auteur{{/* .Book.Authors.Length > 1 ? 's' : '' */}}
|
|
||||||
</h2>
|
|
||||||
<ul>
|
|
||||||
<li v-for="author in book.authors">
|
|
||||||
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2 v-if="book.series">
|
|
||||||
<span class="glyphicon glyphicon-list"></span> Serie
|
|
||||||
</h2>
|
|
||||||
<div v-if="book.series">
|
|
||||||
<a :href="'series.html?id='+book.series.id">{{ .Book.Series.Name }}</a>
|
|
||||||
<span class="badge">{{ .Book.Series.Idx }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2><span class="glyphicon glyphicon-globe"></span> Langue</h2>
|
|
||||||
<ul><li>{{/* .Book.Lang.toUpperCase() */}}</li></ul>
|
|
||||||
|
|
||||||
<h2 v-if="book.tags">
|
|
||||||
<span class="glyphicon glyphicon-tags"></span> Tags
|
|
||||||
</h2>
|
|
||||||
<div v-if="book.tags">
|
|
||||||
<template v-for="tag in book.tags">
|
|
||||||
<span class="label label-info">{{ .Tag }}</span>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2>Détails</h2>
|
|
||||||
<ul>
|
|
||||||
<li v-if="book.pubdate"><strong>Date de publication</strong> {{ .Book.Pubdate }}</li>
|
|
||||||
<li v-if="book.publisher"><strong>Editeur</strong> {{ .Book.Publisher }}</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<!-- TODO cover -->
|
|
||||||
</div>
|
</div>
|
||||||
<script src="js/vue.min.js"></script>
|
<div class="row">
|
||||||
<script src="js/book.min.js"></script>
|
<div class="col-xs-12 col-md-9">
|
||||||
</body>
|
<h1>
|
||||||
</html>
|
<span class="glyphicon glyphicon-book"></span>
|
||||||
|
{{ .Book.Title }}
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-3 text-right">
|
||||||
|
<template v-for="data in book.data">
|
||||||
|
<a :href="bookLink(book, data)" class="btn btn-success">
|
||||||
|
<span class="glyphicon glyphicon-download-alt"></span> Télécharger
|
||||||
|
{{ .Data.Format }} ({{/* .FormatBytes(data.size) */}})
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="alert alert-danger" role="alert" v-else>Aucun livre sélectionné</div>
|
||||||
|
<div class="row" v-if="book.id">
|
||||||
|
<h2>
|
||||||
|
<span class="glyphicon glyphicon-user"></span> Auteur{{/* .Book.Authors.Length > 1 ? 's' : '' */}}
|
||||||
|
</h2>
|
||||||
|
<ul>
|
||||||
|
<li v-for="author in book.authors">
|
||||||
|
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2 v-if="book.series">
|
||||||
|
<span class="glyphicon glyphicon-list"></span> Serie
|
||||||
|
</h2>
|
||||||
|
<div v-if="book.series">
|
||||||
|
<a :href="'series.html?id='+book.series.id">{{ .Book.Series.Name }}</a>
|
||||||
|
<span class="badge">{{ .Book.Series.Idx }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2><span class="glyphicon glyphicon-globe"></span> Langue</h2>
|
||||||
|
<ul><li>{{/* .Book.Lang.toUpperCase() */}}</li></ul>
|
||||||
|
|
||||||
|
<h2 v-if="book.tags">
|
||||||
|
<span class="glyphicon glyphicon-tags"></span> Tags
|
||||||
|
</h2>
|
||||||
|
<div v-if="book.tags">
|
||||||
|
<template v-for="tag in book.tags">
|
||||||
|
<span class="label label-info">{{ .Tag }}</span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>Détails</h2>
|
||||||
|
<ul>
|
||||||
|
<li v-if="book.pubdate"><strong>Date de publication</strong> {{ .Book.Pubdate }}</li>
|
||||||
|
<li v-if="book.publisher"><strong>Editeur</strong> {{ .Book.Publisher }}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ template "footer.html" . }}
|
||||||
|
3
templates/footer.html
Normal file
3
templates/footer.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<script src="js/vue.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
23
templates/header.html
Normal file
23
templates/header.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<title>Bouquins{{ if .Title }} - {{ .Title }}{{ end }}</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<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.html">Recherche</a></li>
|
||||||
|
<li><a href="#">A propos</a></li>
|
||||||
|
</ul>
|
||||||
|
<form class="navbar-form navbar-right" role="search" method="get" action="search.html">
|
||||||
|
<div class="form-group">
|
||||||
|
<input name="q" type="text" class="form-control" placeholder="Recherche">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</nav>
|
@ -1,128 +1,103 @@
|
|||||||
<!DOCTYPE html>
|
{{ template "header.html" . }}
|
||||||
<html lang="fr">
|
<div class="container" id="app">
|
||||||
<head>
|
<div class="jumbotron">
|
||||||
<title>Bouquins</title>
|
<h1>Bouquins</h1>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<p>Cette bibliothèque contient actuellement <strong>{{ .BooksCount }}</strong> livres et BD en format papier ou électronique.</p>
|
||||||
<meta charset="utf-8" />
|
<button class="btn btn-primary" type="button" @click="showBooks">Livres</button>
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
<button class="btn btn-primary" type="button" @click="showAuthors">Auteurs</button>
|
||||||
<link rel="preload" href="/js/index.min.js" as="script">
|
<button class="btn btn-primary" type="button" @click="showSeries">Series</button>
|
||||||
<link rel="preload" href="/js/vue.min.js" as="script">
|
</div>
|
||||||
<link rel="prefetch" href="/js/index.min.js">
|
<div class="table-responsive">
|
||||||
<link rel="prefetch" href="/js/vue.min.js">
|
{{ if (ne (len .Books) 0) or (ne (len .Authors) 0) or (ne (len .Series) 0) }}
|
||||||
</head>
|
<nav aria-label="Pages">
|
||||||
<body>
|
<ul class="pager">
|
||||||
<nav class="navbar navbar-inverse" id="nav">
|
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">←</span> Précédents</a></li>
|
||||||
<div class="container">
|
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">→</span></a></li>
|
||||||
<ul class="nav navbar-nav">
|
</ul>
|
||||||
<li class="active"><a href="#">Accueil</a></li>
|
|
||||||
<li><a href="search.html">Recherche</a></li>
|
|
||||||
<li><a href="#">A propos</a></li>
|
|
||||||
</ul>
|
|
||||||
<form class="navbar-form navbar-right" role="search" method="get" action="search.html">
|
|
||||||
<div class="form-group">
|
|
||||||
<input name="q" type="text" class="form-control" placeholder="Recherche">
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</nav>
|
</nav>
|
||||||
<div class="container" id="app">
|
{{ end }}
|
||||||
<div class="jumbotron">
|
{{ if .Series }}
|
||||||
<h1>Bouquins</h1>
|
<table class="table table-striped">
|
||||||
<p>Cette bibliothèque contient actuellement <strong>{{ .BooksCount }}</strong> livres et BD en format papier ou électronique.</p>
|
<tr>
|
||||||
<button class="btn btn-primary" type="button" @click="showBooks">Livres</button>
|
<th>
|
||||||
<button class="btn btn-primary" type="button" @click="showAuthors">Auteurs</button>
|
<a href="#" @click="sortBy('name')">Nom</a>
|
||||||
<button class="btn btn-primary" type="button" @click="showSeries">Series</button>
|
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
|
||||||
</div>
|
</th>
|
||||||
<div class="table-responsive" v-if="books.length > 0 || authors.length > 0 || series.length > 0">
|
<th>Livre(s)</th>
|
||||||
<nav aria-label="Pages">
|
<th>Auteur(s)</th>
|
||||||
<ul class="pager">
|
</tr>
|
||||||
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">←</span> Précédents</a></li>
|
<tr v-for="serie in series">
|
||||||
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">→</span></a></li>
|
{{ range .Series }}
|
||||||
</ul>
|
<td>
|
||||||
</nav>
|
<span class="glyphicon glyphicon-list"></span>
|
||||||
{{ if .Series }}
|
<a href="/series?id={{ .Id }}">{{ .Name }}</a>
|
||||||
<table class="table table-striped">
|
</td>
|
||||||
<tr>
|
<td>{{ .Count }}</td>
|
||||||
<th>
|
<td>
|
||||||
<a href="#" @click="sortBy('name')">Nom</a>
|
{{ range .Authors }}
|
||||||
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
</th>
|
<a :href="/authors?id={{ .Id }}">{{ .Name }}</a>
|
||||||
<th>Livre(s)</th>
|
{{ end }}
|
||||||
<th>Auteur(s)</th>
|
</td>
|
||||||
</tr>
|
|
||||||
<tr v-for="serie in series">
|
|
||||||
{{ range .Series }}
|
|
||||||
<td>
|
|
||||||
<span class="glyphicon glyphicon-list"></span>
|
|
||||||
<a href="/series?id={{ .Id }}">{{ .Name }}</a>
|
|
||||||
</td>
|
|
||||||
<td>{{ .Count }}</td>
|
|
||||||
<td>
|
|
||||||
{{ range .Authors }}
|
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
|
||||||
<a :href="/authors?id={{ .Id }}">{{ .Name }}</a>
|
|
||||||
{{ end }}
|
|
||||||
</td>
|
|
||||||
{{ end }}
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .Authors }}
|
</tr>
|
||||||
<table class="table table-striped">
|
</table>
|
||||||
<tr>
|
{{ end }}
|
||||||
<th>
|
{{ if .Authors }}
|
||||||
<a href="#" @click="sortBy('name')">Nom</a>
|
<table class="table table-striped">
|
||||||
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
|
<tr>
|
||||||
</th>
|
<th>
|
||||||
<th>Livre(s)</th>
|
<a href="#" @click="sortBy('name')">Nom</a>
|
||||||
</tr>
|
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
|
||||||
<tr v-for="author in authors">
|
</th>
|
||||||
<td>
|
<th>Livre(s)</th>
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
</tr>
|
||||||
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
<tr v-for="author in authors">
|
||||||
</td>
|
<td>
|
||||||
<td>{{ .Author.Count }}</td>
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
</tr>
|
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
||||||
</table>
|
</td>
|
||||||
{{ end }}
|
<td>{{ .Author.Count }}</td>
|
||||||
{{ if .Books }}
|
</tr>
|
||||||
<table class="table table-striped">
|
</table>
|
||||||
<tr>
|
{{ end }}
|
||||||
<th>
|
{{ if .Books }}
|
||||||
<a href="#" @click="sortBy('title')">Nom</a>
|
<table class="table table-striped">
|
||||||
<span v-if="sort_by == 'title'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
|
<tr>
|
||||||
</th>
|
<th>
|
||||||
<th>Auteur(s)</th>
|
<a href="#" @click="sortBy('title')">Nom</a>
|
||||||
<th>Serie</th>
|
<span v-if="sort_by == 'title'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
|
||||||
</tr>
|
</th>
|
||||||
<tr v-for="book in books">
|
<th>Auteur(s)</th>
|
||||||
<td><span class="glyphicon glyphicon-book"></span>
|
<th>Serie</th>
|
||||||
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a></td>
|
</tr>
|
||||||
<td>
|
<tr v-for="book in books">
|
||||||
<template v-for="author in book.authors">
|
<td><span class="glyphicon glyphicon-book"></span>
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a></td>
|
||||||
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
<td>
|
||||||
</template>
|
<template v-for="author in book.authors">
|
||||||
</td>
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
<td>
|
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
||||||
<template v-if="book.series">
|
</template>
|
||||||
<span class="glyphicon glyphicon-list"></span>
|
</td>
|
||||||
<a :href="'series.html?id='+book.series.id">{{ .Book.Series.Name }}</a>
|
<td>
|
||||||
<span class="badge">{{/* .Book.Series ? Book.Series.Idx : '' */}}</span>
|
<template v-if="book.series">
|
||||||
</template>
|
<span class="glyphicon glyphicon-list"></span>
|
||||||
</td>
|
<a :href="'series.html?id='+book.series.id">{{ .Book.Series.Name }}</a>
|
||||||
</tr>
|
<span class="badge">{{/* .Book.Series ? Book.Series.Idx : '' */}}</span>
|
||||||
</table>
|
</template>
|
||||||
{{ end }}
|
</td>
|
||||||
<nav aria-label="Pages">
|
</tr>
|
||||||
<ul class="pager">
|
</table>
|
||||||
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">←</span> Précédents</a></li>
|
{{ end }}
|
||||||
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">→</span></a></li>
|
{{ if (ne (len .Books) 0) or (ne (len .Authors) 0) or (ne (len .Series) 0) }}
|
||||||
</ul>
|
<nav aria-label="Pages">
|
||||||
</nav>
|
<ul class="pager">
|
||||||
</div>
|
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">←</span> Précédents</a></li>
|
||||||
</div>
|
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">→</span></a></li>
|
||||||
<script src="js/vue.min.js"></script>
|
</ul>
|
||||||
<script src="js/index.min.js"></script>
|
</nav>
|
||||||
</body>
|
{{ end }}
|
||||||
</html>
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ template "footer.html" . }}
|
||||||
|
@ -1,60 +1,30 @@
|
|||||||
<!DOCTYPE html>
|
{{ template "header.html" . }}
|
||||||
<html lang="fr">
|
<div class="container" id="app">
|
||||||
<head>
|
<div class="page-header" v-if="series">
|
||||||
<title>Serie | Bouquins</title>
|
<h1>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<span class="glyphicon glyphicon-list"></span>
|
||||||
<meta charset="utf-8" />
|
{{ .Series.Name }}
|
||||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
</h1>
|
||||||
<link rel="preload" href="/js/series.min.js" as="script">
|
</div>
|
||||||
<link rel="preload" href="/js/vue.min.js" as="script">
|
<div class="alert alert-danger" role="alert" v-else>Aucune série sélectionnée</div>
|
||||||
<link rel="prefetch" href="/js/series.min.js">
|
<template v-if="series">
|
||||||
<link rel="prefetch" href="/js/vue.min.js">
|
<h2>
|
||||||
</head>
|
<span class="glyphicon glyphicon-book"></span> Livre(s)
|
||||||
<body>
|
</h2>
|
||||||
<nav class="navbar navbar-inverse" id="nav">
|
<ul>
|
||||||
<div class="container">
|
<li v-for="book in series.books" class="list-unstyled">{{ .Book.Series.Idx }}.
|
||||||
<ul class="nav navbar-nav">
|
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a>
|
||||||
<li><a href="index.html">Accueil</a></li>
|
</li>
|
||||||
<li><a href="search.html">Recherche</a></li>
|
</ul>
|
||||||
<li><a href="#">A propos</a></li>
|
<h2>
|
||||||
</ul>
|
<span class="glyphicon glyphicon-user"></span> Auteur(s)
|
||||||
<form class="navbar-form navbar-right" role="search" method="get" action="search.html">
|
</h2>
|
||||||
<div class="form-group">
|
<ul>
|
||||||
<input name="q" type="text" class="form-control" placeholder="Recherche">
|
<li v-for="author in series.authors" class="list-unstyled">
|
||||||
</div>
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
</form>
|
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
||||||
</div>
|
</li>
|
||||||
</nav>
|
</ul>
|
||||||
<div class="container" id="app">
|
</template>
|
||||||
<div class="page-header" v-if="series">
|
</div>
|
||||||
<h1>
|
{{ template "footer.html" . }}
|
||||||
<span class="glyphicon glyphicon-list"></span>
|
|
||||||
{{ .Series.Name }}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-danger" role="alert" v-else>Aucune série sélectionnée</div>
|
|
||||||
<template v-if="series">
|
|
||||||
<h2>
|
|
||||||
<span class="glyphicon glyphicon-book"></span> Livre(s)
|
|
||||||
</h2>
|
|
||||||
<ul>
|
|
||||||
<li v-for="book in series.books" class="list-unstyled">{{ .Book.Series.Idx }}.
|
|
||||||
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<h2>
|
|
||||||
<span class="glyphicon glyphicon-user"></span> Auteur(s)
|
|
||||||
</h2>
|
|
||||||
<ul>
|
|
||||||
<li v-for="author in series.authors" class="list-unstyled">
|
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
|
||||||
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
<script src="js/vue.min.js"></script>
|
|
||||||
<script src="js/series.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user