Book cover

This commit is contained in:
Meutel 2017-01-08 17:22:50 +01:00
parent c69bf98f31
commit a2855f394a
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,9 @@
<li class="active">Livre</li>
</ol>
<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>
@ -26,7 +29,7 @@
</div>
<div class="col-xs-12 col-md-3 text-right">
<template v-for="data in book.data">
<a v-bind:href="bookLink(book, data)" class="btn btn-success">
<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>

View File

@ -49,6 +49,9 @@ var app = new Vue({
var i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
},
bookCover: function(book) {
return '/calibre/' + encodeURI(book.path) + '/cover.jpg';
},
bookLink: function(book, data) {
return '/calibre/' + encodeURI(book.path) + '/' + encodeURI(data.name) + '.' + data.format.toLowerCase();
},