enju_inter_library_loan 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +45 -0
  4. data/app/controllers/inter_library_loans_controller.rb +125 -0
  5. data/app/models/inter_library_loan.rb +111 -0
  6. data/app/views/inter_library_loans/edit.html.erb +149 -0
  7. data/app/views/inter_library_loans/index.atom.builder +11 -0
  8. data/app/views/inter_library_loans/index.html.erb +50 -0
  9. data/app/views/inter_library_loans/index.rss.builder +31 -0
  10. data/app/views/inter_library_loans/new.html.erb +42 -0
  11. data/app/views/inter_library_loans/show.html.erb +58 -0
  12. data/config/locales/translation_en.yml +20 -0
  13. data/config/locales/translation_ja.yml +20 -0
  14. data/config/routes.rb +6 -0
  15. data/db/migrate/148_create_inter_library_loans.rb +23 -0
  16. data/lib/enju_inter_library_loan.rb +4 -0
  17. data/lib/enju_inter_library_loan/engine.rb +13 -0
  18. data/lib/enju_inter_library_loan/version.rb +3 -0
  19. data/lib/tasks/enju_inter_library_loan_tasks.rake +4 -0
  20. data/spec/controllers/inter_library_loans_controller_spec.rb +185 -0
  21. data/spec/dummy/Rakefile +7 -0
  22. data/spec/dummy/app/assets/javascripts/application.js +9 -0
  23. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  24. data/spec/dummy/app/controllers/application_controller.rb +71 -0
  25. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  26. data/spec/dummy/app/models/ability.rb +12 -0
  27. data/spec/dummy/app/models/item.rb +7 -0
  28. data/spec/dummy/app/models/library.rb +128 -0
  29. data/spec/dummy/app/models/library_group.rb +86 -0
  30. data/spec/dummy/app/models/manifestation.rb +6 -0
  31. data/spec/dummy/app/models/patron.rb +167 -0
  32. data/spec/dummy/app/models/patron_type.rb +19 -0
  33. data/spec/dummy/app/models/role.rb +5 -0
  34. data/spec/dummy/app/models/shelf.rb +54 -0
  35. data/spec/dummy/app/models/user.rb +27 -0
  36. data/spec/dummy/app/models/user_has_role.rb +4 -0
  37. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  38. data/spec/dummy/app/views/page/403.html.erb +9 -0
  39. data/spec/dummy/app/views/page/403.mobile.erb +5 -0
  40. data/spec/dummy/app/views/page/403.xml.erb +4 -0
  41. data/spec/dummy/app/views/page/404.html.erb +9 -0
  42. data/spec/dummy/app/views/page/404.mobile.erb +5 -0
  43. data/spec/dummy/app/views/page/404.xml.erb +4 -0
  44. data/spec/dummy/config.ru +4 -0
  45. data/spec/dummy/config/application.rb +47 -0
  46. data/spec/dummy/config/boot.rb +10 -0
  47. data/spec/dummy/config/database.yml +25 -0
  48. data/spec/dummy/config/environment.rb +5 -0
  49. data/spec/dummy/config/environments/development.rb +30 -0
  50. data/spec/dummy/config/environments/production.rb +60 -0
  51. data/spec/dummy/config/environments/test.rb +39 -0
  52. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  53. data/spec/dummy/config/initializers/devise.rb +209 -0
  54. data/spec/dummy/config/initializers/inflections.rb +10 -0
  55. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  56. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  57. data/spec/dummy/config/initializers/session_store.rb +8 -0
  58. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  59. data/spec/dummy/config/locales/en.yml +5 -0
  60. data/spec/dummy/config/routes.rb +60 -0
  61. data/spec/dummy/db/migrate/001_create_patrons.rb +62 -0
  62. data/spec/dummy/db/migrate/005_create_manifestations.rb +68 -0
  63. data/spec/dummy/db/migrate/006_create_items.rb +36 -0
  64. data/spec/dummy/db/migrate/059_create_libraries.rb +34 -0
  65. data/spec/dummy/db/migrate/069_create_shelves.rb +19 -0
  66. data/spec/dummy/db/migrate/080_create_library_groups.rb +25 -0
  67. data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +16 -0
  68. data/spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb +9 -0
  69. data/spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb +9 -0
  70. data/spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb +9 -0
  71. data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +9 -0
  72. data/spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb +11 -0
  73. data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
  74. data/spec/dummy/db/migrate/20111201155456_create_users.rb +13 -0
  75. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +31 -0
  76. data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
  77. data/spec/dummy/db/schema.rb +289 -0
  78. data/spec/dummy/db/test.sqlite3 +0 -0
  79. data/spec/dummy/lib/master_model.rb +41 -0
  80. data/spec/dummy/lib/url_validator.rb +10 -0
  81. data/spec/dummy/log/test.log +5034 -0
  82. data/spec/dummy/public/404.html +26 -0
  83. data/spec/dummy/public/422.html +26 -0
  84. data/spec/dummy/public/500.html +26 -0
  85. data/spec/dummy/public/favicon.ico +0 -0
  86. data/spec/dummy/script/rails +6 -0
  87. data/spec/factories/inter_library_loan.rb +6 -0
  88. data/spec/factories/item.rb +7 -0
  89. data/spec/factories/library.rb +13 -0
  90. data/spec/factories/manifestation.rb +5 -0
  91. data/spec/factories/user.rb +31 -0
  92. data/spec/fixtures/inter_library_loans.yml +84 -0
  93. data/spec/fixtures/libraries.yml +108 -0
  94. data/spec/fixtures/library_groups.yml +34 -0
  95. data/spec/fixtures/patron_types.yml +35 -0
  96. data/spec/fixtures/patrons.yml +338 -0
  97. data/spec/fixtures/roles.yml +21 -0
  98. data/spec/fixtures/user_has_roles.yml +41 -0
  99. data/spec/fixtures/users.yml +69 -0
  100. data/spec/models/inter_library_loan_spec.rb +26 -0
  101. data/spec/spec_helper.rb +46 -0
  102. data/spec/support/controller_macros.rb +48 -0
  103. data/spec/support/devise.rb +4 -0
  104. metadata +386 -0
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'c796af7aa841faf5679c4ebefd82a776318c13e7e31e3a69a0a88542240da60f6af80f33147de515db6689eeda93c044a97ebcc700a60ef6804e3fc096372fe1'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,60 @@
1
+ Dummy::Application.routes.draw do
2
+ devise_for :users
3
+
4
+ # The priority is based upon order of creation:
5
+ # first created -> highest priority.
6
+
7
+ # Sample of regular route:
8
+ # match 'products/:id' => 'catalog#view'
9
+ # Keep in mind you can assign values other than :controller and :action
10
+
11
+ # Sample of named route:
12
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
13
+ # This route can be invoked with purchase_url(:id => product.id)
14
+
15
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
16
+ # resources :products
17
+
18
+ # Sample resource route with options:
19
+ # resources :products do
20
+ # member do
21
+ # get 'short'
22
+ # post 'toggle'
23
+ # end
24
+ #
25
+ # collection do
26
+ # get 'sold'
27
+ # end
28
+ # end
29
+
30
+ # Sample resource route with sub-resources:
31
+ # resources :products do
32
+ # resources :comments, :sales
33
+ # resource :seller
34
+ # end
35
+
36
+ # Sample resource route with more complex sub-resources
37
+ # resources :products do
38
+ # resources :comments
39
+ # resources :sales do
40
+ # get 'recent', :on => :collection
41
+ # end
42
+ # end
43
+
44
+ # Sample resource route within a namespace:
45
+ # namespace :admin do
46
+ # # Directs /admin/products/* to Admin::ProductsController
47
+ # # (app/controllers/admin/products_controller.rb)
48
+ # resources :products
49
+ # end
50
+
51
+ # You can have the root of your site routed with "root"
52
+ # just remember to delete public/index.html.
53
+ # root :to => 'welcome#index'
54
+
55
+ # See how all your routes lay out with "rake routes"
56
+
57
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
58
+ # Note: This route will make all actions in every controller accessible via GET requests.
59
+ # match ':controller(/:action(/:id(.:format)))'
60
+ end
@@ -0,0 +1,62 @@
1
+ class CreatePatrons < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :patrons do |t|
4
+ t.integer :user_id
5
+ t.string :last_name
6
+ t.string :middle_name
7
+ t.string :first_name
8
+ t.string :last_name_transcription
9
+ t.string :middle_name_transcription
10
+ t.string :first_name_transcription
11
+ t.string :corporate_name
12
+ t.string :corporate_name_transcription
13
+ t.string :full_name
14
+ t.text :full_name_transcription
15
+ t.text :full_name_alternative
16
+ t.timestamps
17
+ t.datetime :deleted_at
18
+ t.string :zip_code_1
19
+ t.string :zip_code_2
20
+ t.text :address_1
21
+ t.text :address_2
22
+ t.text :address_1_note
23
+ t.text :address_2_note
24
+ t.string :telephone_number_1
25
+ t.string :telephone_number_2
26
+ t.string :fax_number_1
27
+ t.string :fax_number_2
28
+ t.text :other_designation
29
+ t.text :place
30
+ t.string :postal_code
31
+ t.text :street
32
+ t.text :locality
33
+ t.text :region
34
+ t.datetime :date_of_birth
35
+ t.datetime :date_of_death
36
+ t.integer :language_id, :default => 1, :null => false
37
+ t.integer :country_id, :default => 1, :null => false
38
+ t.integer :patron_type_id, :default => 1, :null => false
39
+ t.integer :lock_version, :default => 0, :null => false
40
+ t.text :note
41
+ t.integer :creates_count, :default => 0, :null => false
42
+ t.integer :realizes_count, :default => 0, :null => false
43
+ t.integer :produces_count, :default => 0, :null => false
44
+ t.integer :owns_count, :default => 0, :null => false
45
+ #t.integer :resource_has_subjects_count, :default => 0, :null => false
46
+ t.integer :required_role_id, :default => 1, :null => false
47
+ t.integer :required_score, :default => 0, :null => false
48
+ t.string :state
49
+ t.text :email
50
+ t.text :url
51
+ end
52
+ add_index :patrons, :user_id, :unique => true
53
+ add_index :patrons, :language_id
54
+ add_index :patrons, :country_id
55
+ add_index :patrons, :required_role_id
56
+ add_index :patrons, :full_name
57
+ end
58
+
59
+ def self.down
60
+ drop_table :patrons
61
+ end
62
+ end
@@ -0,0 +1,68 @@
1
+ class CreateManifestations < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :manifestations do |t|
4
+ t.text :original_title, :null => false
5
+ t.text :title_alternative
6
+ t.text :title_transcription
7
+ t.string :classification_number
8
+ t.string :manifestation_identifier
9
+ t.datetime :date_of_publication
10
+ t.datetime :copyright_date
11
+ t.timestamps
12
+ t.datetime :deleted_at
13
+ t.string :access_address
14
+ t.integer :language_id, :default => 1, :null => false
15
+ t.integer :carrier_type_id, :default => 1, :null => false
16
+ t.integer :extent_id, :default => 1, :null => false
17
+ t.integer :start_page
18
+ t.integer :end_page
19
+ t.decimal :height
20
+ t.decimal :width
21
+ t.decimal :depth
22
+ t.string :isbn
23
+ t.string :isbn10
24
+ t.string :wrong_isbn
25
+ t.string :nbn
26
+ t.string :lccn
27
+ t.string :oclc_number
28
+ t.string :issn
29
+ t.integer :price # TODO: 通貨単位
30
+ #t.text :filename
31
+ #t.string :content_type
32
+ #t.integer :size
33
+ t.text :fulltext
34
+ t.string :volume_number_list
35
+ t.string :issue_number_list
36
+ t.string :serial_number_list
37
+ t.integer :edition
38
+ t.text :note
39
+ t.integer :produces_count, :default => 0, :null => false
40
+ t.integer :exemplifies_count, :default => 0, :null => false
41
+ t.integer :embodies_count, :default => 0, :null => false
42
+ t.integer :exemplifies_count, :default => 0, :null => false
43
+ t.integer :work_has_subjects_count, :default => 0, :null => false
44
+ t.boolean :repository_content, :default => false, :null => false
45
+ t.integer :lock_version, :default => 0, :null => false
46
+ t.integer :required_role_id, :default => 1, :null => false
47
+ t.string :state
48
+ t.integer :required_score, :default => 0, :null => false
49
+ t.integer :frequency_id, :default => 1, :null => false
50
+ t.boolean :subscription_master, :default => false, :null => false
51
+ end
52
+ add_index :manifestations, :carrier_type_id
53
+ add_index :manifestations, :required_role_id
54
+ add_index :manifestations, :isbn
55
+ add_index :manifestations, :nbn
56
+ add_index :manifestations, :lccn
57
+ add_index :manifestations, :oclc_number
58
+ add_index :manifestations, :issn
59
+ add_index :manifestations, :access_address
60
+ add_index :manifestations, :frequency_id
61
+ add_index :manifestations, :manifestation_identifier
62
+ add_index :manifestations, :updated_at
63
+ end
64
+
65
+ def self.down
66
+ drop_table :manifestations
67
+ end
68
+ end
@@ -0,0 +1,36 @@
1
+ class CreateItems < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :items do |t|
4
+ #t.integer :manifestation_id
5
+ t.string :call_number
6
+ t.string :item_identifier
7
+ t.integer :circulation_status_id, :default => 5, :null => false
8
+ t.integer :checkout_type_id, :default => 1, :null => false
9
+ t.timestamps
10
+ t.datetime :deleted_at
11
+ t.integer :shelf_id, :default => 1, :null => false
12
+ t.integer :basket_id
13
+ t.boolean :include_supplements, :default => false, :null => false
14
+ t.integer :checkouts_count, :default => 0, :null => false
15
+ t.integer :owns_count, :default => 0, :null => false
16
+ t.integer :resource_has_subjects_count, :default => 0, :null => false
17
+ t.text :note
18
+ t.string :url
19
+ t.integer :price
20
+ t.integer :lock_version, :default => 0, :null => false
21
+ t.integer :required_role_id, :default => 1, :null => false
22
+ t.string :state
23
+ t.integer :required_score, :default => 0, :null => false
24
+ end
25
+ #add_index :items, :manifestation_id
26
+ add_index :items, :circulation_status_id
27
+ add_index :items, :checkout_type_id
28
+ add_index :items, :shelf_id
29
+ add_index :items, :item_identifier
30
+ add_index :items, :required_role_id
31
+ end
32
+
33
+ def self.down
34
+ drop_table :items
35
+ end
36
+ end
@@ -0,0 +1,34 @@
1
+ class CreateLibraries < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :libraries do |t|
4
+ t.references :patron, :polymorphic => true
5
+ t.string :name, :null => false
6
+ t.text :display_name
7
+ t.string :short_display_name, :null => false
8
+ t.string :zip_code
9
+ t.text :street
10
+ t.text :locality
11
+ t.text :region
12
+ t.string :telephone_number_1
13
+ t.string :telephone_number_2
14
+ t.string :fax_number
15
+ t.text :note
16
+ t.integer :call_number_rows, :default => 1, :null => false
17
+ t.string :call_number_delimiter, :default => "|", :null => false
18
+ t.integer :library_group_id, :default => 1, :null => false
19
+ t.integer :users_count, :default => 0, :null => false
20
+ t.integer :position
21
+ t.integer :country_id
22
+
23
+ t.timestamps
24
+ t.datetime :deleted_at
25
+ end
26
+ add_index :libraries, :patron_id, :unique => true
27
+ add_index :libraries, :library_group_id
28
+ add_index :libraries, :name, :unique => true
29
+ end
30
+
31
+ def self.down
32
+ drop_table :libraries
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ class CreateShelves < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :shelves do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :library_id, :default => 1, :null => false
8
+ t.integer :items_count, :default => 0, :null => false
9
+ t.integer :position
10
+ t.timestamps
11
+ t.datetime :deleted_at
12
+ end
13
+ add_index :shelves, :library_id
14
+ end
15
+
16
+ def self.down
17
+ drop_table :shelves
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ class CreateLibraryGroups < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :library_groups do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.string :short_name, :null => false
7
+ t.string :email
8
+ t.text :my_networks
9
+ t.boolean :use_dsbl, :default => false, :null => false
10
+ t.text :dsbl_list
11
+ t.text :login_banner
12
+ t.text :note
13
+ t.integer :valid_period_for_new_user, :default => 365, :null => false
14
+ t.boolean :post_to_union_catalog, :default => false, :null => false
15
+ t.integer :country_id
16
+
17
+ t.timestamps
18
+ end
19
+ add_index :library_groups, :short_name
20
+ end
21
+
22
+ def self.down
23
+ drop_table :library_groups
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ class CreatePatronTypes < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :patron_types do |t|
4
+ t.string :name, :null => false
5
+ t.text :display_name
6
+ t.text :note
7
+ t.integer :position
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :patron_types
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ class AddAdminNetworksToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :admin_networks, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :admin_networks
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddAllowBookmarkExternalUrlToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :allow_bookmark_external_url, :boolean, :null => false, :default => false
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :allow_bookmark_external_url
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddPositionToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :position, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :position
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddUrlToLibraryGroup < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :library_groups, :url, :string, :default => 'http://localhost:3000/'
4
+ end
5
+
6
+ def self.down
7
+ remove_column :library_groups, :url
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class RemoveDsblFromLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ remove_column :library_groups, :use_dsbl
4
+ remove_column :library_groups, :dsbl_list
5
+ end
6
+
7
+ def down
8
+ add_column :library_groups, :dsbl_list, :text
9
+ add_column :library_groups, :use_dsbl, :boolean
10
+ end
11
+ end