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

106 lines
3.9 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 ne (len .Books) 0 }}
<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>
{{ range .Books }}
<tr>
<td><span class="glyphicon glyphicon-book"></span>
<a href="/books?id={{ .Id }}">{{ .Title }}</a></td>
<td>
{{ range .Authors }}
<span class="glyphicon glyphicon-user"></span>
<a href="/authors?id={{ .Id }}">{{ .Name }}</a>
{{ end }}
</td>
<td>
{{ if .Series }}
<span class="glyphicon glyphicon-list"></span>
<a href="/series?id={{ .Series.Id }}">{{ .Series.Name }}</a>
<span class="badge">{{ .Book.SeriesIndex }}</span>
{{ end }}
</td>
</tr>
{{ end }}
</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" . }}