Sha256: 3d3c6df9b3a1b9534616c296ff1610fd5b25b3a30c7fbda5aa0e4bcb1184b9bf
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
class NdlBooksController < ApplicationController before_filter :authenticate_user! before_filter :check_librarian 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 = Kaminari.paginate_array( books[:items], total_count: books[:total_entries], page: page ).page(page).per(10) respond_to do |format| format.html end end def create if params[:book] begin @manifestation = NdlBook.import_from_sru_response(params[:book][:iss_itemno]) rescue EnjuNdl::RecordNotFound end respond_to do |format| if @manifestation.try(:save) format.html { redirect_to manifestation_url(@manifestation), notice: t('controller.successfully_created', model: t('activerecord.models.manifestation')) } else format.html { redirect_to ndl_books_url, notice: t('enju_ndl.record_not_found') } end end end end private def check_librarian unless current_user.try(:has_role?, 'Librarian') access_denied end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
enju_ndl-0.1.1 | app/controllers/ndl_books_controller.rb |
enju_ndl-0.1.0 | app/controllers/ndl_books_controller.rb |
enju_ndl-0.1.0.pre38 | app/controllers/ndl_books_controller.rb |