Class: NdlBooksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- NdlBooksController
- Defined in:
- app/controllers/ndl_books_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/ndl_books_controller.rb', line 18 def create if params[:book] @manifestation = NdlBook.import_from_sru_response(params[:book][:nbn]) if @manifestation flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.manifestation')) flash[:porta_import] == true redirect_to manifestation_items_url(@manifestation) else flash[:notice] = t('page.record_not_found') redirect_to ndl_books_url end end end |
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/ndl_books_controller.rb', line 5 def index if params[:page].to_i == 0 page = 1 else page = params[:page] end @query = params[:query].to_s.strip books = NdlBook.search(params[:query], page) @books = WillPaginate::Collection.create(page, NdlBook.per_page, books[:total_entries]) do |pager| pager.replace books[:items] end end |