book cover
This commit is contained in:
parent
e5263033dd
commit
5f7dd8514f
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,3 +20,4 @@
|
||||
*~
|
||||
*.*.swp
|
||||
/vendor/ruby
|
||||
/public/calibre
|
||||
|
@ -19,4 +19,8 @@ class Book < ActiveRecord::Base
|
||||
|
||||
has_one :book_serie_link, foreign_key: "book"
|
||||
has_one :serie, through: :book_serie_link
|
||||
|
||||
def has_cover?
|
||||
has_cover == 1
|
||||
end
|
||||
end
|
||||
|
@ -5,6 +5,9 @@
|
||||
</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<% if @book.has_cover? %>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<% end %>
|
||||
<h2>
|
||||
<span class="glyphicon glyphicon-user"></span>
|
||||
<%= "Author".pluralize(@book.authors.count) %>
|
||||
@ -51,4 +54,10 @@
|
||||
<li><strong>Publisher</strong> <%= @book.publisher.name %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% if @book.has_cover? %>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<img alt="No cover" class="img-responsive img-rounded" src="<%= "/calibre/#{url_encode(@book.path)}/cover.jpg" %>"/>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user