Finally, to get the layout fully working, you also need to add a style sheet, in the file
public/stylesheets/liblib.css. This is the same style sheet that you used in the earlier
applications, so just copy it from the Shoplet application to the new name.
Searching and Looking at Books
The first part to implement should reasonably be the functionality to list and search books.
Lending and returning should be a part of this also, but because you don??™t implement authentication
until later, you??™ll skip those parts too, by just putting links for them in the code, which
you provide functionality for later.
The first step, before you start creating the book listing code, is to make sure this is what
gets seen when first visiting the application. So, remove public/index.html and change
config/routes.rb to include this:
map.connect '', :controller => "book"
Next, open up book_controller.rb, and first of all add the filters that need to be in place
for authentication to work, later:
before_filter :authenticate_borrower, :only => [:lend, :ret]
before_filter :authenticate_librarian, :only => [:add_instance,
:remove_instance, :add_description, :remove_description]
before_filter :try_librarian, :only => [:index, :search, :book]
You only require authentication to be in place for certain specific operations, as you
can see, and you try to add librarian information for the index, search, and book actions.
The index action just delegates to the search action:
def index
search
render :action => 'search'
end
The search action looks like this:
def search
if params[:searching]
@search = params[:search]
@results = LegacySystem.
Pages:
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389