Skip to content

Commit

Permalink
Before code namespace reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
multiscan committed Apr 25, 2013
1 parent 1c37c19 commit 74865a5
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 36 deletions.
11 changes: 11 additions & 0 deletions GiovaReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# because of sphinx we use mysql also for development.
# remember to start mysqld as first thing:
su admin -c 'mysql.server start'

# remember to start sphinx before starting the server:
rake thinking_sphinx:start
rails server

# list rake tasks:
rake -T

90 changes: 90 additions & 0 deletions NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,97 @@ http://z3950.loc.gov:7090/voyager?version=1.1&operation=searchRetrieve&query=bat





a scuola ai buoni un premio, ai cattivi la punizione
ma in seguito nella vita è meno chiara la divisione
Giorgio Gaber





This XML file does not appear to have any style information associated with it. The document tree is shown below.
<zs:searchRetrieveResponse xmlns:zs="http://www.loc.gov/zing/srw/">
<zs:version>1.1</zs:version>
<zs:numberOfRecords>1</zs:numberOfRecords>
<zs:records>
<zs:record>
<zs:recordSchema>info:srw/schema/1/mods-v3.2</zs:recordSchema>
<zs:recordPacking>xml</zs:recordPacking>
<zs:recordData>
<mods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/mods/v3" version="3.2" xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-2.xsd">
<titleInfo>...</titleInfo>
<name type="personal">
<namePart>Buchberger, Bruno.</namePart>
</name>
<name type="personal">
<namePart>Winkler, Franz</namePart>
<namePart type="date">1955-</namePart>
</name>
<typeOfResource>text</typeOfResource>
<genre authority="marcgt">bibliography</genre>
<originInfo>
<place>
<placeTerm type="code" authority="marccountry">enk</placeTerm>
</place>
<place>
<placeTerm type="text">Cambridge, U.K</placeTerm>
</place>
<place>
<placeTerm type="text">New York</placeTerm>
</place>
<publisher>Cambridge University Press</publisher>
<dateIssued>1998</dateIssued>
<issuance>monographic</issuance>
</originInfo>
<language>
<languageTerm authority="iso639-2b" type="code">eng</languageTerm>
</language>
<physicalDescription>
<form authority="marcform">print</form>
<extent>viii, 552 p. : ill. ; 23 cm.</extent>
</physicalDescription>
<note type="statement of responsibility">edited by B. Buchberger & F. Winkler.</note>
<note>
Papers from an intensive course for researchers (Jan. 1998) and a conference "33 Years of Gröbner Bases" held at RISC-Linz, Feb. 2-4, 1998.
</note>
<note>Includes bibliographical references and index.</note>
<subject authority="lcsh">
<topic>Gröbner bases</topic>
</subject>
<classification authority="lcc">QA251.3 .G76 1998</classification>
<classification authority="ddc" edition="21">512/.24</classification>
<relatedItem type="series">
<titleInfo>
<title>
London Mathematical Society lecture note series ; 251
</title>
</titleInfo>
</relatedItem>
<identifier type="isbn">0521632986 (paperback)</identifier>
<identifier type="lccn">97044181</identifier>
<identifier type="uri">
http://www.loc.gov/catdir/description/cam028/97044181.html
</identifier>
<identifier type="uri">http://www.loc.gov/catdir/toc/cam027/97044181.html</identifier>
<location>
<url displayLabel="Publisher description">
http://www.loc.gov/catdir/description/cam028/97044181.html
</url>
</location>
<location>
<url displayLabel="Table of contents">http://www.loc.gov/catdir/toc/cam027/97044181.html</url>
</location>
<recordInfo>
<recordContentSource authority="marcorg">DLC</recordContentSource>
<recordCreationDate encoding="marc">971125</recordCreationDate>
<recordChangeDate encoding="iso8601">20020831182157.0</recordChangeDate>
<recordIdentifier>2600033</recordIdentifier>
</recordInfo>
</mods>
</zs:recordData>
<zs:recordPosition>1</zs:recordPosition>
</zs:record>
</zs:records>
</zs:searchRetrieveResponse>
10 changes: 8 additions & 2 deletions app/controllers/books_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ def index
if @search=params["search"]
@books = Book.search(@search, :match_mode => :extended)
else
@books = Book.order("created_at DESC", :include=>[:publisher, :items, :loans]).paginate(:page=>params[:page], :per_page=>50)
@items = Item.order("created_at DESC", :include=>[:book]).paginate(:page=>params[:page], :per_page=>50)
@books = @items.map{|i| i.book}.uniq
# @books = Book.order("created_at DESC", :include=>[:publisher, :items, :loans]).paginate(:page=>params[:page], :per_page=>50)
end
respond_to do |format|
format.html # index.html.erb
Expand Down Expand Up @@ -51,6 +53,10 @@ def create
if @books.count == 1
@book=@books.first
if @book.new_record?
# @labs = Lab.order('nick ASC').all
# @locations = Location.order('name ASC').all
# @currencies = ENV['CURRENCIES'].split
# @item = Item.new
@isbn_step = false
render "new"
else
Expand All @@ -70,7 +76,7 @@ def create

respond_to do |format|
if @book.save
format.html { redirect_to @book, notice: 'Book was successfully created.' }
format.html { redirect_to new_book_item_path(@book), notice: 'Book was successfully created.' }
format.json { render json: @book, status: :created, location: @book }
else
format.html { render action: "new" }
Expand Down
42 changes: 30 additions & 12 deletions app/controllers/items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class ItemsController < ApplicationController
# before_filter :authenticate_user!, :only => [:new, :edit, :create, :update, :destroy]
load_resource
# authorize_resource
before_filter :set_and_authorize_book, :only => [:new, :create]

# GET /items
# GET /items.json
def index
Expand All @@ -13,7 +18,6 @@ def index
# GET /items/1
# GET /items/1.json
def show
@item = Item.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @item }
Expand All @@ -23,11 +27,10 @@ def show
# GET /book/:book_id/items/new
# GET /book/:book_id/items/new.json
def new
@book = Book.find(params[:book_id])
@item = @book.items.new
# TODO: only list labs and locations that are manageable by this user.
@labs = Lab.all
@locations = Location.all
@labs = Lab.order('nick ASC').all
@locations = Location.order('name ASC').all
@currencies = ENV['CURRENCIES'].split
respond_to do |format|
format.html # new.html.erb
Expand All @@ -43,16 +46,21 @@ def edit
# POST /book/:book_id/items
# POST /book/:book_id//items.json
def create
@item = Item.new(params[:item])
@book = Book.find(params[:book_id])
if @book
@item = @book.items.new(params[:item])

respond_to do |format|
if @item.save
format.html { redirect_to @item, notice: 'Item was successfully created.' }
format.json { render json: @item, status: :created, location: @item }
else
format.html { render action: "new" }
format.json { render json: @item.errors, status: :unprocessable_entity }
respond_to do |format|
if @item.save
format.html { redirect_to @book, notice: 'Item was successfully created.' }
format.json { render json: @item, status: :created, location: @item }
else
format.html { render action: "new" }
format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
else

end
end

Expand Down Expand Up @@ -83,4 +91,14 @@ def destroy
format.json { head :no_content }
end
end

private
def set_and_authorize_book
if params.has_key?(:book_id) && @book = Book.find(params[:book_id])
# authorize! :manage, @book
true
else
false
end
end
end
2 changes: 2 additions & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def initialize(user)
end
if user.role? :operator
can :manage, :books
# can :manage, :items
can :manage, :publishers
end

end
Expand Down
1 change: 1 addition & 0 deletions app/models/google_book.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def tags
def language
volinfo["language"]
end

def imagelink
images["large"] || images["medium"] || images["small"] || images["thumbnail"] || images["smallThumbnail"]
end
Expand Down
21 changes: 9 additions & 12 deletions app/views/books/_book.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@
%br
=link_to 'more »', book
.span1
- if book.count_all > 1
- if book.count_on_loan > 0
%span.label.label-warning #{book.count_on_loan} on loan
%br
- if book.count_available > 0
%span.label.label-success #{book.count_available} available
%br
- if book.count_missing > 0
%span.label.label-inverse #{book.count_missing} missing
%br
- else
= item_status(book.items.first)
- if book.count_on_loan > 0
%span.label.label-warning #{book.count_on_loan} on loan
%br
- if book.count_available > 0
%span.label.label-success #{book.count_available} available
%br
- if book.count_missing > 0
%span.label.label-inverse #{book.count_missing} missing
%br
14 changes: 14 additions & 0 deletions app/views/books/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@
=f.input :toc, :label=>false, :input_html=>{:class=>"span10"}
.tab-pane{:id=>"nottab"}
=f.input :notes, :label=>false, :input_html=>{:class=>"span10"}
-# if @book.new_record?
= f.simple_fields_for :item do |item_form|
.row
.span4
= item_form.association :lab, :collection => @labs, :label_method => lambda { |l| l.nick }, :prompt => "Select the owner"
.span4
= item_form.association :location, :collection => @locations, :prompt => "Select a room for this copy"
.row
.span4
= item_form.input :currency, :collection=>@currencies, :selected => @currencies.first
.span4
= item_form.input :price
= f.input :status, :collection=>["Library", "Mystery", "Never Received", "Out of Print", "Waiting for Delivery"], :selected=>"Library"


.form-actions
= f.button :submit
4 changes: 2 additions & 2 deletions app/views/books/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@
.well
.tabbable
%ul.nav.nav-tabs
%li
%li.active
%a{:href=>"#abstab", "data-toggle" => "tab"} Abstract
%li
%a{:href=>"#idxtab", "data-toggle" => "tab"} Index
%li.active
%li
%a{:href=>"#nottab", "data-toggle" => "tab"} Notes
%li
%a{:href=>"#toctab", "data-toggle" => "tab"} TOC
Expand Down
2 changes: 1 addition & 1 deletion app/views/items/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.form-inputs
.row
.span4
= f.association :lab, :collection => @labs, :prompt => "Select the owner"
= f.association :lab, :collection => @labs, :label_method => lambda { |l| l.nick }, :prompt => "Select the owner"
.span4
= f.association :location, :collection => @locations, :prompt => "Select a room for this copy"
.row
Expand Down
12 changes: 10 additions & 2 deletions app/views/items/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
-content_for(:title) do
New Book Copy

= render 'form'
%h3=@book.title
%h4
- if @book.author.blank?
- unless @book.editor.blank?
edited by
=@book.editor
- else
by
=@book.author

= link_to 'Back', items_path
= render 'form'
1 change: 1 addition & 0 deletions app/views/layouts/_footer.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-#= link_to image_tag("http://www.worldcat.org/images/wc_badge_144x19.gif?ai=EPFL_giovanni.cangiani", :size=>"144x19", :alt=>"WorldCat lets people access the collections of libraries worldwide [WorldCat.org]", :title=>"WorldCat lets people access the collections of libraries worldwide [WorldCat.org]"), "http://www.worldcat.org/", :id=>"wcbadge", :target=>"_blank"
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@
= render 'layouts/messages'
= yield
%footer
=render 'layouts/footer'

28 changes: 25 additions & 3 deletions app/views/publisher_mergers/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
-@publishers.each do |p|
%li.ui-widget-content
%label.checkbox
%input{:name=>"mergenda_ids[]", :type=>"checkbox", :value=>p.id, :checked=>false, :class=>"ui-widget-content"}
=p.name
%input{:name=>"mergenda_ids[]", :type=>"checkbox", :value=>p.id, :checked=>false, :class=>"ui-widget-content"}= p.name

.span4
%p
Select the publisher's names that you want to merge and enter here the
new name for the new publisher that will replace those that you have selected.
You can also avoid typing by choising one of the names proposed in the selector below.
Field can be edited in any case.
.form-inputs
= f.input :name, :label => "New name"
= f.input :name, :label => "New name", :input_html=>{:class=>'span4'}
%select#selectedselector
%option uno
%option due
.form-actions
= f.button :submit, "Merge"

Expand All @@ -27,10 +32,27 @@
#selectable .ui-selected { background: #F39814; color: white; }
:javascript
jQuery(document).ready(function($) {
$("#selectedselector").hide();
$("#selectedselector").change(function(){
console.debug("cambiato selettore");
$("#publisher_name").val($(this).val());
});
$("#selectable").selectable({
stop: function() {
var choices=[];
$(".ui-widget-content input").prop('checked', false);
$(".ui-selected input").prop('checked', true);
var options=$("#selectedselector");
$("#publisher_name").val("");
options.empty();
$(".ui-selected label").each(function(index) {
var v=$(this).text().trim();
options.append($("<option></option>").attr("value", v).text(v));
});
options.show();
}
});
// $(.publisher_name).doubleclick(function() {
// alert('Double cliccked');
// });
});
2 changes: 0 additions & 2 deletions app/views/searches/new.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
%h1 New search

= render 'form'

= link_to 'Back', searches_path

0 comments on commit 74865a5

Please sign in to comment.