go-bouquins/templates/index.html
2017-07-30 20:17:18 +02:00

104 lines
4.0 KiB
HTML

{{ 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>
{{ 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 }}
</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" . }}