Factorise templates

This commit is contained in:
Meutel 2017-07-30 18:09:27 +02:00
parent 8a06369839
commit 8df3f87a23
8 changed files with 293 additions and 369 deletions

View File

@ -99,42 +99,55 @@ type SeriesFull struct {
Books []*Book
}
type BouquinsModel struct {
Title string
}
// Constructor BouquinsModel
func NewBouquinsModel(title string) *BouquinsModel {
return &BouquinsModel{
title,
}
}
type IndexModel struct {
BouquinsModel
BooksCount int64
Books []*BookAdv
Series []*SeriesAdv
Authors []*AuthorAdv
}
func (app *Bouquins) IndexPage(res http.ResponseWriter, req *http.Request) {
series := make([]*SeriesAdv, 0)
a1 := make([]*Author, 0)
s1 := &SeriesAdv{
Series{
666,
"Serie 1",
},
12,
a1,
}
series = append(series, s1)
model := &IndexModel{
123,
// Constructor IndexModel
func NewIndexModel(title string, count int64) *IndexModel {
return &IndexModel{
*NewBouquinsModel(title),
count,
nil,
nil,
series,
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 {
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) {
panic("not implemented")
app.render(res, TPL_BOOKS, nil)
}
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) {
panic("not implemented")
app.render(res, TPL_SERIES, nil)
}

View File

@ -15,6 +15,7 @@ const (
SERIES = "/series"
JS = "/js/"
CSS = "/css/"
FONTS = "/fonts/"
)
func init() {
@ -22,11 +23,9 @@ func init() {
if err != nil {
log.Fatalln(err)
}
app := &bouquins.Bouquins{
tpl,
}
assets()
router(app)
}
@ -34,6 +33,7 @@ func init() {
func assets() {
http.Handle(JS, 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) {

View File

@ -1,73 +1,43 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Auteur | Bouquins</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" />
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="preload" href="/js/author.min.js" as="script">
<link rel="preload" href="/js/vue.min.js" as="script">
<link rel="prefetch" href="/js/author.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="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>
{{ template "header.html" . }}
<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>
<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 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>
<script src="js/vue.min.js"></script>
<script src="js/author.min.js"></script>
</body>
</html>
</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>
{{ template "footer.html" . }}

View File

@ -1,92 +1,62 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Livre | Bouquins</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<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>&nbsp;
</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 -->
{{ template "header.html" . }}
<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>
<script src="js/vue.min.js"></script>
<script src="js/book.min.js"></script>
</body>
</html>
<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>&nbsp;
</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
View File

@ -0,0 +1,3 @@
<script src="js/vue.min.js"></script>
</body>
</html>

23
templates/header.html Normal file
View 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>

View File

@ -1,128 +1,103 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Bouquins</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" />
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="preload" href="/js/index.min.js" as="script">
<link rel="preload" href="/js/vue.min.js" as="script">
<link rel="prefetch" href="/js/index.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 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>
{{ template "header.html" . }}
<div class="container" id="app">
<div class="jumbotron">
<h1>Bouquins</h1>
<p>Cette bibliothèque contient actuellement <strong>{{ .BooksCount }}</strong> livres et BD en format papier ou électronique.</p>
<button class="btn btn-primary" type="button" @click="showBooks">Livres</button>
<button class="btn btn-primary" type="button" @click="showAuthors">Auteurs</button>
<button class="btn btn-primary" type="button" @click="showSeries">Series</button>
</div>
<div class="table-responsive">
{{ if (ne (len .Books) 0) or (ne (len .Authors) 0) or (ne (len .Series) 0) }}
<nav aria-label="Pages">
<ul class="pager">
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">&larr;</span> Précédents</a></li>
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
<div class="container" id="app">
<div class="jumbotron">
<h1>Bouquins</h1>
<p>Cette bibliothèque contient actuellement <strong>{{ .BooksCount }}</strong> livres et BD en format papier ou électronique.</p>
<button class="btn btn-primary" type="button" @click="showBooks">Livres</button>
<button class="btn btn-primary" type="button" @click="showAuthors">Auteurs</button>
<button class="btn btn-primary" type="button" @click="showSeries">Series</button>
</div>
<div class="table-responsive" v-if="books.length > 0 || authors.length > 0 || series.length > 0">
<nav aria-label="Pages">
<ul class="pager">
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">&larr;</span> Précédents</a></li>
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
{{ if .Series }}
<table class="table table-striped">
<tr>
<th>
<a href="#" @click="sortBy('name')">Nom</a>
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
</th>
<th>Livre(s)</th>
<th>Auteur(s)</th>
</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>&nbsp;
{{ end }}
</td>
{{ end }}
</tr>
</table>
{{ end }}
{{ if .Series }}
<table class="table table-striped">
<tr>
<th>
<a href="#" @click="sortBy('name')">Nom</a>
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
</th>
<th>Livre(s)</th>
<th>Auteur(s)</th>
</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>&nbsp;
{{ end }}
</td>
{{ end }}
{{ if .Authors }}
<table class="table table-striped">
<tr>
<th>
<a href="#" @click="sortBy('name')">Nom</a>
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
</th>
<th>Livre(s)</th>
</tr>
<tr v-for="author in authors">
<td>
<span class="glyphicon glyphicon-user"></span>
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
</td>
<td>{{ .Author.Count }}</td>
</tr>
</table>
{{ end }}
{{ if .Books }}
<table class="table table-striped">
<tr>
<th>
<a href="#" @click="sortBy('title')">Nom</a>
<span v-if="sort_by == 'title'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
</th>
<th>Auteur(s)</th>
<th>Serie</th>
</tr>
<tr v-for="book in books">
<td><span class="glyphicon glyphicon-book"></span>
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a></td>
<td>
<template v-for="author in book.authors">
<span class="glyphicon glyphicon-user"></span>
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
</template>
</td>
<td>
<template v-if="book.series">
<span class="glyphicon glyphicon-list"></span>
<a :href="'series.html?id='+book.series.id">{{ .Book.Series.Name }}</a>
<span class="badge">{{/* .Book.Series ? Book.Series.Idx : '' */}}</span>
</template>
</td>
</tr>
</table>
{{ end }}
<nav aria-label="Pages">
<ul class="pager">
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">&larr;</span> Précédents</a></li>
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
</div>
</div>
<script src="js/vue.min.js"></script>
<script src="js/index.min.js"></script>
</body>
</html>
</tr>
</table>
{{ end }}
{{ if .Authors }}
<table class="table table-striped">
<tr>
<th>
<a href="#" @click="sortBy('name')">Nom</a>
<span v-if="sort_by == 'name'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
</th>
<th>Livre(s)</th>
</tr>
<tr v-for="author in authors">
<td>
<span class="glyphicon glyphicon-user"></span>
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
</td>
<td>{{ .Author.Count }}</td>
</tr>
</table>
{{ end }}
{{ if .Books }}
<table class="table table-striped">
<tr>
<th>
<a href="#" @click="sortBy('title')">Nom</a>
<span v-if="sort_by == 'title'" :class="['glyphicon', { 'glyphicon-chevron-up': order_desc , 'glyphicon-chevron-down': !order_desc}]"></span>
</th>
<th>Auteur(s)</th>
<th>Serie</th>
</tr>
<tr v-for="book in books">
<td><span class="glyphicon glyphicon-book"></span>
<a :href="'book.html?id='+book.id">{{ .Book.Title }}</a></td>
<td>
<template v-for="author in book.authors">
<span class="glyphicon glyphicon-user"></span>
<a :href="'author.html?id='+author.id">{{ .Author.Name }}</a>
</template>
</td>
<td>
<template v-if="book.series">
<span class="glyphicon glyphicon-list"></span>
<a :href="'series.html?id='+book.series.id">{{ .Book.Series.Name }}</a>
<span class="badge">{{/* .Book.Series ? Book.Series.Idx : '' */}}</span>
</template>
</td>
</tr>
</table>
{{ end }}
{{ if (ne (len .Books) 0) or (ne (len .Authors) 0) or (ne (len .Series) 0) }}
<nav aria-label="Pages">
<ul class="pager">
<li class="previous" v-bind:class="{ disabled: page <= 1 }"><a href="#" @click="prevPage"><span aria-hidden="true">&larr;</span> Précédents</a></li>
<li class="next"><a href="#" @click="nextPage">Suivants <span aria-hidden="true">&rarr;</span></a></li>
</ul>
</nav>
{{ end }}
</div>
</div>
{{ template "footer.html" . }}

View File

@ -1,60 +1,30 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Serie | Bouquins</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" />
<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="preload" href="/js/series.min.js" as="script">
<link rel="preload" href="/js/vue.min.js" as="script">
<link rel="prefetch" href="/js/series.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="series">
<h1>
<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>
{{ template "header.html" . }}
<div class="container" id="app">
<div class="page-header" v-if="series">
<h1>
<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>
{{ template "footer.html" . }}