order books in serie
This commit is contained in:
parent
d2a8faad93
commit
46f6c55906
@ -4,7 +4,7 @@ class SeriesController < ApplicationController
|
||||
before_action :preferences, only: :index
|
||||
|
||||
def show
|
||||
@serie = Serie.find(params[:id])
|
||||
@serie = Serie.includes(books: :authors).references(:book).find(params[:id])
|
||||
@title = @serie.name
|
||||
end
|
||||
|
||||
@ -14,7 +14,7 @@ class SeriesController < ApplicationController
|
||||
.references(:books)
|
||||
.order(:sort)
|
||||
.paginate(pagination)
|
||||
@title = "Series"
|
||||
@title = t(:series)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
|
@ -1,5 +1,6 @@
|
||||
class Book < ActiveRecord::Base
|
||||
establish_connection Rails.configuration.database_configuration["calibre"]
|
||||
scope :in_serie, -> { order(:series_index) }
|
||||
|
||||
has_and_belongs_to_many :authors,
|
||||
join_table: "books_authors_link",
|
||||
|
@ -9,7 +9,7 @@
|
||||
<%= t(:serie_book, count: @serie.books.count) %>
|
||||
</h2>
|
||||
<ul>
|
||||
<% @serie.books.each do |book| %>
|
||||
<% @serie.books.in_serie.each do |book| %>
|
||||
<li><%= book.series_index.to_i %>. <%= link_to book.title, book %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user