Refactoring templates
This commit is contained in:
parent
ff0c3eabfe
commit
e171731d62
@ -16,81 +16,14 @@
|
||||
</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>
|
||||
{{ end }}
|
||||
</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
</table>
|
||||
{{ if ne (len .Series) 0 }}
|
||||
{{ template "index_series.html" .Series }}
|
||||
{{ 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>
|
||||
{{ if ne (len .Authors) 0 }}
|
||||
{{ template "index_authors.html" .Authors }}
|
||||
{{ 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>
|
||||
{{ template "index_books.html" .Books }}
|
||||
{{ end }}
|
||||
{{ if (ne (len .Books) 0) or (ne (len .Authors) 0) or (ne (len .Series) 0) }}
|
||||
<nav aria-label="Pages">
|
||||
|
18
templates/index_authors.html
Normal file
18
templates/index_authors.html
Normal file
@ -0,0 +1,18 @@
|
||||
<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>
|
||||
{{ range . }}
|
||||
<tr>
|
||||
<td>
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
<a href="/authors/{{ .Id }}">{{ .Name }}</a>
|
||||
</td>
|
||||
<td>{{ .Count }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
29
templates/index_books.html
Normal file
29
templates/index_books.html
Normal file
@ -0,0 +1,29 @@
|
||||
<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 . }}
|
||||
<tr>
|
||||
<td><span class="glyphicon glyphicon-book"></span>
|
||||
<a href="/books/{{ .Id }}">{{ .Title }}</a></td>
|
||||
<td>
|
||||
{{ range .Authors }}
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
<a href="/authors/{{ .Id }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
{{ if .Series }}
|
||||
<span class="glyphicon glyphicon-list"></span>
|
||||
<a href="/series/{{ .Series.Id }}">{{ .Series.Name }}</a>
|
||||
<span class="badge">{{ .Book.SeriesIndex }}</span>
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
25
templates/index_series.html
Normal file
25
templates/index_series.html
Normal file
@ -0,0 +1,25 @@
|
||||
<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 . }}
|
||||
<td>
|
||||
<span class="glyphicon glyphicon-list"></span>
|
||||
<a href="/series/{{ .Id }}">{{ .Name }}</a>
|
||||
</td>
|
||||
<td>{{ .Count }}</td>
|
||||
<td>
|
||||
{{ range .Authors }}
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
<a href="/authors/{{ .Id }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
</table>
|
Loading…
Reference in New Issue
Block a user