enju_nii 0.0.4 → 0.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/Rakefile +1 -1
  2. data/app/controllers/cinii_books_controller.rb +48 -0
  3. data/app/helpers/cinii_books_helper.rb +15 -0
  4. data/app/models/cinii_book.rb +66 -0
  5. data/app/views/cinii_books/index.html.erb +49 -0
  6. data/app/views/layouts/cinii_books.html.erb +23 -0
  7. data/app/views/nii_types/index.html.erb +2 -2
  8. data/config/locales/en.yml +10 -0
  9. data/config/locales/ja.yml +8 -0
  10. data/config/routes.rb +1 -1
  11. data/db/migrate/20121113163717_add_ncid_to_manifestation.rb +6 -0
  12. data/lib/enju_nii.rb +22 -0
  13. data/lib/enju_nii/cinii_book.rb +156 -0
  14. data/lib/enju_nii/engine.rb +7 -3
  15. data/lib/enju_nii/version.rb +1 -1
  16. data/lib/generators/enju_nii/views_generator.rb +17 -0
  17. data/spec/cassette_library/enju_nii/search.yml +876 -0
  18. data/spec/controllers/cinii_books_controller_spec.rb +24 -0
  19. data/spec/dummy/app/models/role.rb +47 -0
  20. data/spec/dummy/app/models/setting.rb +4 -0
  21. data/spec/dummy/app/models/user.rb +28 -0
  22. data/spec/dummy/app/models/user_has_role.rb +4 -0
  23. data/spec/dummy/config/application.yml +38 -0
  24. data/spec/dummy/config/initializers/devise.rb +205 -0
  25. data/spec/dummy/config/routes.rb +2 -0
  26. data/spec/dummy/db/development.sqlite3 +0 -0
  27. data/spec/dummy/db/migrate/001_create_patrons.rb +53 -0
  28. data/spec/dummy/db/migrate/005_create_manifestations.rb +56 -0
  29. data/spec/dummy/db/migrate/006_create_items.rb +28 -0
  30. data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
  31. data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
  32. data/spec/dummy/db/migrate/029_create_subjects.rb +27 -0
  33. data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
  34. data/spec/dummy/db/migrate/073_create_carrier_types.rb +11 -0
  35. data/spec/dummy/db/migrate/112_create_frequencies.rb +12 -0
  36. data/spec/dummy/db/migrate/117_create_form_of_works.rb +12 -0
  37. data/spec/dummy/db/migrate/125_create_donates.rb +12 -0
  38. data/spec/dummy/db/migrate/142_create_classifications.rb +19 -0
  39. data/spec/dummy/db/migrate/143_create_subject_has_classifications.rb +16 -0
  40. data/spec/dummy/db/migrate/144_create_classification_types.rb +16 -0
  41. data/spec/dummy/db/migrate/145_create_subject_heading_types.rb +16 -0
  42. data/spec/dummy/db/migrate/146_create_subject_types.rb +16 -0
  43. data/spec/dummy/db/migrate/20080606052544_create_work_has_subjects.rb +18 -0
  44. data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
  45. data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
  46. data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +12 -0
  47. data/spec/dummy/db/migrate/20081025083323_create_countries.rb +28 -0
  48. data/spec/dummy/db/migrate/20081025083905_create_languages.rb +23 -0
  49. data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +15 -0
  50. data/spec/dummy/db/migrate/20081028083142_create_patron_import_files.rb +22 -0
  51. data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +22 -0
  52. data/spec/dummy/db/migrate/20090208044541_create_subject_heading_type_has_subjects.rb +16 -0
  53. data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +15 -0
  54. data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +15 -0
  55. data/spec/dummy/db/migrate/20090719201843_create_extents.rb +12 -0
  56. data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +12 -0
  57. data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +12 -0
  58. data/spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb +12 -0
  59. data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
  60. data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +12 -0
  61. data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
  62. data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
  63. data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +15 -0
  64. data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +13 -0
  65. data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
  66. data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +13 -0
  67. data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +13 -0
  68. data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
  69. data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +11 -0
  70. data/spec/dummy/db/migrate/20100925043847_create_resource_import_results.rb +15 -0
  71. data/spec/dummy/db/migrate/20100925074559_create_patron_import_results.rb +12 -0
  72. data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +9 -0
  73. data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +9 -0
  74. data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +11 -0
  75. data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
  76. data/spec/dummy/db/migrate/20110603184217_add_edit_mode_to_resource_import_file.rb +9 -0
  77. data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
  78. data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +9 -0
  79. data/spec/dummy/db/migrate/20110620173525_add_bookstore_id_to_item.rb +11 -0
  80. data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
  81. data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
  82. data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +13 -0
  83. data/spec/dummy/db/migrate/20110913120629_add_lft_and_rgt_to_classification.rb +11 -0
  84. data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +13 -0
  85. data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +13 -0
  86. data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
  87. data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +13 -0
  88. data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
  89. data/spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb +9 -0
  90. data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +12 -0
  91. data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
  92. data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
  93. data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
  94. data/spec/dummy/db/migrate/20111201121844_create_roles.rb +12 -0
  95. data/spec/dummy/db/migrate/20111201155456_create_users.rb +13 -0
  96. data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +52 -0
  97. data/spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb +10 -0
  98. data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
  99. data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +6 -0
  100. data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +6 -0
  101. data/spec/dummy/db/migrate/20120406020752_add_url_to_subject.rb +5 -0
  102. data/spec/dummy/db/migrate/20120410104851_add_year_of_publication_to_manifestation.rb +5 -0
  103. data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +5 -0
  104. data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +5 -0
  105. data/spec/dummy/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb +5 -0
  106. data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +5 -0
  107. data/spec/dummy/db/migrate/20120413170705_add_error_message_to_resource_import_file.rb +5 -0
  108. data/spec/dummy/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +5 -0
  109. data/spec/dummy/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +9 -0
  110. data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +9 -0
  111. data/spec/dummy/db/migrate/20120415164821_add_attachment_meta_to_manifestation.rb +5 -0
  112. data/spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb +5 -0
  113. data/spec/dummy/db/migrate/20120511072422_add_patron_identifier_to_patron.rb +6 -0
  114. data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +5 -0
  115. data/spec/dummy/db/schema.rb +738 -0
  116. data/spec/dummy/db/test.sqlite3 +0 -0
  117. data/spec/fixtures/carrier_types.yml +51 -0
  118. data/spec/fixtures/content_types.yml +19 -0
  119. data/spec/fixtures/countries.yml +2059 -0
  120. data/spec/fixtures/languages.yml +1901 -0
  121. data/spec/fixtures/patron_types.yml +35 -0
  122. data/spec/fixtures/roles.yml +21 -0
  123. data/spec/fixtures/subject_types.yml +28 -0
  124. data/spec/fixtures/user_has_roles.yml +41 -0
  125. data/spec/fixtures/users.yml +79 -0
  126. data/spec/models/cinii_book_spec.rb +18 -0
  127. data/spec/spec_helper.rb +12 -11
  128. data/spec/support/controller_macros.rb +1 -24
  129. data/spec/support/vcr.rb +4 -0
  130. metadata +309 -12
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ describe CiniiBooksController do
4
+ fixtures :all
5
+
6
+ it "should be a kind of enju_nii" do
7
+ assert_kind_of Module, EnjuNii
8
+ end
9
+
10
+ describe "GET index" do
11
+ login_fixture_admin
12
+ use_vcr_cassette "enju_nii/search", :record => :new_episodes
13
+
14
+ it "should get index" do
15
+ get :index, :query => 'library'
16
+ assigns(:books).should_not be_empty
17
+ end
18
+
19
+ it "should be empty if a query is not set" do
20
+ get :index
21
+ assigns(:books).should be_empty
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,47 @@
1
+ class Role < ActiveRecord::Base
2
+ attr_accessible :name, :display_name, :note
3
+ include MasterModel
4
+ default_scope :order => "roles.position"
5
+ has_many :user_has_roles
6
+ has_many :users, :through => :user_has_roles
7
+ after_save :clear_all_cache
8
+ after_destroy :clear_all_cache
9
+
10
+ extend FriendlyId
11
+ friendly_id :name
12
+
13
+ def localized_name
14
+ display_name.localize
15
+ end
16
+
17
+ def self.all_cache
18
+ if Rails.env == 'production'
19
+ Rails.cache.fetch('role_all'){Role.select(:name).all}
20
+ else
21
+ Role.select(:name)
22
+ end
23
+ end
24
+
25
+ def clear_all_cache
26
+ Rails.cache.delete('role_all')
27
+ end
28
+
29
+ def self.default_role
30
+ Rails.cache.fetch('default_role'){Role.find('Guest')}
31
+ end
32
+ end
33
+
34
+ # == Schema Information
35
+ #
36
+ # Table name: roles
37
+ #
38
+ # id :integer not null, primary key
39
+ # name :string(255) not null
40
+ # display_name :string(255)
41
+ # note :text
42
+ # created_at :datetime
43
+ # updated_at :datetime
44
+ # score :integer default(0), not null
45
+ # position :integer
46
+ #
47
+
@@ -0,0 +1,4 @@
1
+ class Setting < Settingslogic
2
+ source "#{Rails.root}/config/application.yml"
3
+ namespace Rails.env
4
+ end
@@ -0,0 +1,28 @@
1
+ class User < ActiveRecord::Base
2
+ # Include default devise modules. Others available are:
3
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4
+ devise :database_authenticatable, :registerable,
5
+ :recoverable, :rememberable, :trackable, :validatable
6
+
7
+ # Setup accessible (or protected) attributes for your model
8
+ attr_accessible :email, :password, :password_confirmation, :remember_me
9
+
10
+ has_one :user_has_role
11
+ has_one :role, :through => :user_has_role
12
+ belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
13
+ has_many :purchase_requests
14
+ has_many :order_lists
15
+
16
+ def has_role?(role_in_question)
17
+ return false unless role
18
+ return true if role.name == role_in_question
19
+ case role.name
20
+ when 'Administrator'
21
+ return true
22
+ when 'Librarian'
23
+ return true if role_in_question == 'User'
24
+ else
25
+ false
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,4 @@
1
+ class UserHasRole < ActiveRecord::Base
2
+ belongs_to :user
3
+ belongs_to :role
4
+ end
@@ -0,0 +1,38 @@
1
+ defaults: &defaults
2
+ enju:
3
+ web_hostname: localhost
4
+ web_port_number: 3000
5
+
6
+ family_name_first: true
7
+ max_number_of_results: 500
8
+ write_search_log_to_file: true
9
+ csv_charset_conversion: true
10
+
11
+ # Choose a locale from 'ca', 'de', 'fr', 'jp', 'uk', 'us'
12
+ #AMAZON_AWS_HOSTNAME = 'ecs.amazonaws.com'
13
+ amazon:
14
+ aws_hostname: ecs.amazonaws.jp
15
+ hostname: www.amazon.co.jp
16
+ access_key: REPLACE_WITH_YOUR_AMAZON_ACCESS_KEY
17
+ secret_access_key: REPLACE_WITH_YOUR_AMAZON_SECRET_ACCESS_KEY
18
+
19
+ # :google, :amazon
20
+ book_jacket:
21
+ source: :google
22
+ unknown_resource:
23
+
24
+ # :mozshot, :simpleapi, :heartrails, :thumbalizr
25
+ screenshot:
26
+ generator: :mozshot
27
+
28
+ uploaded_file:
29
+ storage: :local
30
+
31
+ development:
32
+ <<: *defaults
33
+
34
+ test:
35
+ <<: *defaults
36
+
37
+ production:
38
+ <<: *defaults
@@ -0,0 +1,205 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # ==> Mailer Configuration
5
+ # Configure the e-mail address which will be shown in Devise::Mailer,
6
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
8
+
9
+ # Configure the class responsible to send e-mails.
10
+ # config.mailer = "Devise::Mailer"
11
+
12
+ # ==> ORM configuration
13
+ # Load and configure the ORM. Supports :active_record (default) and
14
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
15
+ # available as additional gems.
16
+ require 'devise/orm/active_record'
17
+
18
+ # ==> Configuration for any authentication mechanism
19
+ # Configure which keys are used when authenticating a user. The default is
20
+ # just :email. You can configure it to use [:username, :subdomain], so for
21
+ # authenticating a user, both parameters are required. Remember that those
22
+ # parameters are used only when authenticating and not when retrieving from
23
+ # session. If you need permissions, you should implement that in a before filter.
24
+ # You can also supply a hash where the value is a boolean determining whether
25
+ # or not authentication should be aborted when the value is not present.
26
+ # config.authentication_keys = [ :email ]
27
+
28
+ # Configure parameters from the request object used for authentication. Each entry
29
+ # given should be a request method and it will automatically be passed to the
30
+ # find_for_authentication method and considered in your model lookup. For instance,
31
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
32
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
33
+ # config.request_keys = []
34
+
35
+ # Configure which authentication keys should be case-insensitive.
36
+ # These keys will be downcased upon creating or modifying a user and when used
37
+ # to authenticate or find a user. Default is :email.
38
+ config.case_insensitive_keys = [ :email ]
39
+
40
+ # Configure which authentication keys should have whitespace stripped.
41
+ # These keys will have whitespace before and after removed upon creating or
42
+ # modifying a user and when used to authenticate or find a user. Default is :email.
43
+ config.strip_whitespace_keys = [ :email ]
44
+
45
+ # Tell if authentication through request.params is enabled. True by default.
46
+ # config.params_authenticatable = true
47
+
48
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
49
+ # config.http_authenticatable = false
50
+
51
+ # If http headers should be returned for AJAX requests. True by default.
52
+ # config.http_authenticatable_on_xhr = true
53
+
54
+ # The realm used in Http Basic Authentication. "Application" by default.
55
+ # config.http_authentication_realm = "Application"
56
+
57
+ # It will change confirmation, password recovery and other workflows
58
+ # to behave the same regardless if the e-mail provided was right or wrong.
59
+ # Does not affect registerable.
60
+ # config.paranoid = true
61
+
62
+ # ==> Configuration for :database_authenticatable
63
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
64
+ # using other encryptors, it sets how many times you want the password re-encrypted.
65
+ #
66
+ # Limiting the stretches to just one in testing will increase the performance of
67
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
68
+ # a value less than 10 in other environments.
69
+ config.stretches = Rails.env.test? ? 1 : 10
70
+
71
+ # Setup a pepper to generate the encrypted password.
72
+ # config.pepper = "3125870d8e124367f0d9acbd3ea99f180abc4deede5a2c7b449169713dc3cb6a1ef7518e823bcd208650c4d4da3a6894e07da1c527ba411820d6571c445c8c71"
73
+
74
+ # ==> Configuration for :confirmable
75
+ # A period that the user is allowed to access the website even without
76
+ # confirming his account. For instance, if set to 2.days, the user will be
77
+ # able to access the website for two days without confirming his account,
78
+ # access will be blocked just in the third day. Default is 0.days, meaning
79
+ # the user cannot access the website without confirming his account.
80
+ # config.confirm_within = 2.days
81
+
82
+ # Defines which key will be used when confirming an account
83
+ # config.confirmation_keys = [ :email ]
84
+
85
+ # ==> Configuration for :rememberable
86
+ # The time the user will be remembered without asking for credentials again.
87
+ # config.remember_for = 2.weeks
88
+
89
+ # If true, a valid remember token can be re-used between multiple browsers.
90
+ # config.remember_across_browsers = true
91
+
92
+ # If true, extends the user's remember period when remembered via cookie.
93
+ # config.extend_remember_period = false
94
+
95
+ # Options to be passed to the created cookie. For instance, you can set
96
+ # :secure => true in order to force SSL only cookies.
97
+ # config.cookie_options = {}
98
+
99
+ # ==> Configuration for :validatable
100
+ # Range for password length. Default is 6..128.
101
+ # config.password_length = 6..128
102
+
103
+ # Email regex used to validate email formats. It simply asserts that
104
+ # an one (and only one) @ exists in the given string. This is mainly
105
+ # to give user feedback and not to assert the e-mail validity.
106
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
107
+
108
+ # ==> Configuration for :timeoutable
109
+ # The time you want to timeout the user session without activity. After this
110
+ # time the user will be asked for credentials again. Default is 30 minutes.
111
+ # config.timeout_in = 30.minutes
112
+
113
+ # ==> Configuration for :lockable
114
+ # Defines which strategy will be used to lock an account.
115
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
116
+ # :none = No lock strategy. You should handle locking by yourself.
117
+ # config.lock_strategy = :failed_attempts
118
+
119
+ # Defines which key will be used when locking and unlocking an account
120
+ # config.unlock_keys = [ :email ]
121
+
122
+ # Defines which strategy will be used to unlock an account.
123
+ # :email = Sends an unlock link to the user email
124
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
125
+ # :both = Enables both strategies
126
+ # :none = No unlock strategy. You should handle unlocking by yourself.
127
+ # config.unlock_strategy = :both
128
+
129
+ # Number of authentication tries before locking an account if lock_strategy
130
+ # is failed attempts.
131
+ # config.maximum_attempts = 20
132
+
133
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
134
+ # config.unlock_in = 1.hour
135
+
136
+ # ==> Configuration for :recoverable
137
+ #
138
+ # Defines which key will be used when recovering the password for an account
139
+ # config.reset_password_keys = [ :email ]
140
+
141
+ # Time interval you can reset your password with a reset password key.
142
+ # Don't put a too small interval or your users won't have the time to
143
+ # change their passwords.
144
+ config.reset_password_within = 2.hours
145
+
146
+ # ==> Configuration for :encryptable
147
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
148
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
149
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
150
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
151
+ # REST_AUTH_SITE_KEY to pepper)
152
+ # config.encryptor = :sha512
153
+
154
+ # ==> Configuration for :token_authenticatable
155
+ # Defines name of the authentication token params key
156
+ # config.token_authentication_key = :auth_token
157
+
158
+ # If true, authentication through token does not store user in session and needs
159
+ # to be supplied on each request. Useful if you are using the token as API token.
160
+ # config.stateless_token = false
161
+
162
+ # ==> Scopes configuration
163
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
164
+ # "users/sessions/new". It's turned off by default because it's slower if you
165
+ # are using only default views.
166
+ # config.scoped_views = false
167
+
168
+ # Configure the default scope given to Warden. By default it's the first
169
+ # devise role declared in your routes (usually :user).
170
+ # config.default_scope = :user
171
+
172
+ # Configure sign_out behavior.
173
+ # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
174
+ # The default is true, which means any logout action will sign out all active scopes.
175
+ # config.sign_out_all_scopes = true
176
+
177
+ # ==> Navigation configuration
178
+ # Lists the formats that should be treated as navigational. Formats like
179
+ # :html, should redirect to the sign in page when the user does not have
180
+ # access, but formats like :xml or :json, should return 401.
181
+ #
182
+ # If you have any extra navigational formats, like :iphone or :mobile, you
183
+ # should add them to the navigational formats lists.
184
+ #
185
+ # The :"*/*" and "*/*" formats below is required to match Internet
186
+ # Explorer requests.
187
+ # config.navigational_formats = [:"*/*", "*/*", :html]
188
+
189
+ # The default HTTP method used to sign out a resource. Default is :delete.
190
+ config.sign_out_via = :delete
191
+
192
+ # ==> OmniAuth
193
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
194
+ # up on your models and hooks.
195
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
196
+
197
+ # ==> Warden configuration
198
+ # If you want to use other strategies, that are not supported by Devise, or
199
+ # change the failure app, you can configure them inside the config.warden block.
200
+ #
201
+ # config.warden do |manager|
202
+ # manager.intercept_401 = false
203
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
204
+ # end
205
+ end
@@ -1,4 +1,6 @@
1
1
  Dummy::Application.routes.draw do
2
+ devise_for :users
3
+
2
4
  # The priority is based upon order of creation:
3
5
  # first created -> highest priority.
4
6
 
@@ -0,0 +1,53 @@
1
+ class CreatePatrons < ActiveRecord::Migration
2
+ def change
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 :required_role_id, :default => 1, :null => false
42
+ t.integer :required_score, :default => 0, :null => false
43
+ t.string :state
44
+ t.text :email
45
+ t.text :url
46
+ end
47
+ add_index :patrons, :user_id, :unique => true
48
+ add_index :patrons, :language_id
49
+ add_index :patrons, :country_id
50
+ add_index :patrons, :required_role_id
51
+ add_index :patrons, :full_name
52
+ end
53
+ end
@@ -0,0 +1,56 @@
1
+ class CreateManifestations < ActiveRecord::Migration
2
+ def change
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.integer :height
20
+ t.integer :width
21
+ t.integer :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 :fulltext
31
+ t.string :volume_number_list
32
+ t.string :issue_number_list
33
+ t.string :serial_number_list
34
+ t.integer :edition
35
+ t.text :note
36
+ t.boolean :repository_content, :default => false, :null => false
37
+ t.integer :lock_version, :default => 0, :null => false
38
+ t.integer :required_role_id, :default => 1, :null => false
39
+ t.string :state
40
+ t.integer :required_score, :default => 0, :null => false
41
+ t.integer :frequency_id, :default => 1, :null => false
42
+ t.boolean :subscription_master, :default => false, :null => false
43
+ end
44
+ add_index :manifestations, :carrier_type_id
45
+ add_index :manifestations, :required_role_id
46
+ add_index :manifestations, :isbn
47
+ add_index :manifestations, :nbn
48
+ add_index :manifestations, :lccn
49
+ add_index :manifestations, :oclc_number
50
+ add_index :manifestations, :issn
51
+ add_index :manifestations, :access_address
52
+ add_index :manifestations, :frequency_id
53
+ add_index :manifestations, :manifestation_identifier
54
+ add_index :manifestations, :updated_at
55
+ end
56
+ end