bouquins-ror/app/controllers/books_controller.rb
Meutel 346ccf6449 download book
refactoring cover, layouts
2015-07-05 13:01:47 +02:00

28 lines
542 B
Ruby

class BooksController < ApplicationController
include PreferencesHelper
include ERB::Util
before_action :preferences, only: :index
def show
@book = Book.find(params[:id])
@title = @book.title
end
def index
@books = Book.where(initial_filter).order(:sort)
.paginate(page: params[:page], per_page: session[:current_per_page])
@title = "Books"
respond_to do |format|
format.html
format.js
end
end
def cover
@book = Book.find(params[:id])
redirect_to "/calibre/#{url_encode(@book.path)}/cover.jpg"
end
end