book cover
This commit is contained in:
parent
e5263033dd
commit
5f7dd8514f
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,3 +20,4 @@
|
|||||||
*~
|
*~
|
||||||
*.*.swp
|
*.*.swp
|
||||||
/vendor/ruby
|
/vendor/ruby
|
||||||
|
/public/calibre
|
||||||
|
@ -19,4 +19,8 @@ class Book < ActiveRecord::Base
|
|||||||
|
|
||||||
has_one :book_serie_link, foreign_key: "book"
|
has_one :book_serie_link, foreign_key: "book"
|
||||||
has_one :serie, through: :book_serie_link
|
has_one :serie, through: :book_serie_link
|
||||||
|
|
||||||
|
def has_cover?
|
||||||
|
has_cover == 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,50 +5,59 @@
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2>
|
<% if @book.has_cover? %>
|
||||||
<span class="glyphicon glyphicon-user"></span>
|
<div class="col-xs-12 col-md-6">
|
||||||
<%= "Author".pluralize(@book.authors.count) %>
|
<% end %>
|
||||||
</h2>
|
<h2>
|
||||||
<ul>
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
<% @book.authors.each do |author| %>
|
<%= "Author".pluralize(@book.authors.count) %>
|
||||||
<li><%= author.name %></li>
|
</h2>
|
||||||
|
<ul>
|
||||||
|
<% @book.authors.each do |author| %>
|
||||||
|
<li><%= author.name %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% if @book.serie %>
|
||||||
|
<h2>
|
||||||
|
<span class="glyphicon glyphicon-list"></span>
|
||||||
|
Serie
|
||||||
|
</h2>
|
||||||
|
<div>
|
||||||
|
<%= link_to @book.serie.name, @book.serie %>
|
||||||
|
<span class="badge"><%= @book.series_index.to_i %></span>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
<h2>
|
||||||
<% if @book.serie %>
|
<span class="glyphicon glyphicon-globe"></span>
|
||||||
<h2>
|
<%= "Language".pluralize(@book.languages.count) %>
|
||||||
<span class="glyphicon glyphicon-list"></span>
|
</h2>
|
||||||
Serie
|
<div>
|
||||||
</h2>
|
<% @book.languages.each do |language| %>
|
||||||
<div>
|
<%= language.lang_code %>
|
||||||
<%= link_to @book.serie.name, @book.serie %>
|
<% end %>
|
||||||
<span class="badge"><%= @book.series_index.to_i %></span>
|
</div>
|
||||||
|
<h2>
|
||||||
|
<span class="glyphicon glyphicon-tags"></span>
|
||||||
|
<%= "Tag".pluralize(@book.tags.count) %>
|
||||||
|
</h2>
|
||||||
|
<div>
|
||||||
|
<% @book.tags.each do |tag| %>
|
||||||
|
<span class="label label-info"><%= tag.name %></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<h2>Details</h2>
|
||||||
|
<ul>
|
||||||
|
<% if @book.pubdate %>
|
||||||
|
<li><strong>Publishing date</strong> <%= @book.pubdate.to_formatted_s(:date) %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if @book.publisher %>
|
||||||
|
<li><strong>Publisher</strong> <%= @book.publisher.name %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% if @book.has_cover? %>
|
||||||
<h2>
|
<div class="col-xs-12 col-md-6">
|
||||||
<span class="glyphicon glyphicon-globe"></span>
|
<img alt="No cover" class="img-responsive img-rounded" src="<%= "/calibre/#{url_encode(@book.path)}/cover.jpg" %>"/>
|
||||||
<%= "Language".pluralize(@book.languages.count) %>
|
|
||||||
</h2>
|
|
||||||
<div>
|
|
||||||
<% @book.languages.each do |language| %>
|
|
||||||
<%= language.lang_code %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
<h2>
|
<% end %>
|
||||||
<span class="glyphicon glyphicon-tags"></span>
|
|
||||||
<%= "Tag".pluralize(@book.tags.count) %>
|
|
||||||
</h2>
|
|
||||||
<div>
|
|
||||||
<% @book.tags.each do |tag| %>
|
|
||||||
<span class="label label-info"><%= tag.name %></span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<h2>Details</h2>
|
|
||||||
<ul>
|
|
||||||
<% if @book.pubdate %>
|
|
||||||
<li><strong>Publishing date</strong> <%= @book.pubdate.to_formatted_s(:date) %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if @book.publisher %>
|
|
||||||
<li><strong>Publisher</strong> <%= @book.publisher.name %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user