enju_circulation 0.1.2 → 0.2.0.beta.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.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/app/controllers/carrier_type_has_checkout_types_controller.rb +14 -4
- data/app/controllers/checked_items_controller.rb +13 -2
- data/app/controllers/checkins_controller.rb +13 -3
- data/app/controllers/checkout_types_controller.rb +12 -2
- data/app/controllers/checkouts_controller.rb +26 -25
- data/app/controllers/circulation_statuses_controller.rb +11 -1
- data/app/controllers/concerns/enju_circulation/controller.rb +12 -0
- data/app/controllers/demands_controller.rb +12 -2
- data/app/controllers/item_has_use_restrictions_controller.rb +13 -2
- data/app/controllers/lending_policies_controller.rb +18 -4
- data/app/controllers/manifestation_checkout_stats_controller.rb +14 -6
- data/app/controllers/manifestation_reserve_stats_controller.rb +15 -4
- data/app/controllers/reserves_controller.rb +17 -9
- data/app/controllers/use_restrictions_controller.rb +11 -1
- data/app/controllers/user_checkout_stats_controller.rb +14 -4
- data/app/controllers/user_group_has_checkout_types_controller.rb +12 -2
- data/app/controllers/user_reserve_stats_controller.rb +14 -4
- data/app/helpers/items_helper.rb +2 -2
- data/app/jobs/manifestation_checkout_stat_job.rb +7 -0
- data/app/jobs/manifestation_reserve_stat_job.rb +7 -0
- data/app/jobs/user_checkout_stat_job.rb +7 -0
- data/app/jobs/user_reserve_stat_job.rb +7 -0
- data/app/models/checked_item.rb +1 -1
- data/app/models/concerns/enju_circulation/enju_accept.rb +16 -0
- data/app/models/concerns/enju_circulation/enju_basket.rb +30 -0
- data/app/models/concerns/enju_circulation/enju_carrier_type.rb +11 -0
- data/app/models/concerns/enju_circulation/enju_item.rb +157 -0
- data/app/models/concerns/enju_circulation/enju_manifestation.rb +77 -0
- data/app/models/concerns/enju_circulation/enju_profile.rb +13 -0
- data/app/models/concerns/enju_circulation/enju_user.rb +50 -0
- data/app/models/concerns/enju_circulation/enju_user_group.rb +17 -0
- data/app/models/concerns/enju_circulation/enju_withdraw.rb +16 -0
- data/app/models/manifestation_checkout_stat_state_machine.rb +1 -1
- data/app/models/reserve.rb +7 -2
- data/app/policies/carrier_type_has_checkout_type_policy.rb +21 -0
- data/app/policies/checked_item_policy.rb +21 -0
- data/app/policies/checkin_policy.rb +21 -0
- data/app/policies/checkout_policy.rb +39 -0
- data/app/policies/checkout_type_policy.rb +23 -0
- data/app/policies/circulation_status_policy.rb +23 -0
- data/app/policies/demand_policy.rb +21 -0
- data/app/policies/item_has_use_restriction_policy.rb +21 -0
- data/app/policies/item_policy.rb +27 -0
- data/app/policies/lending_policy_policy.rb +21 -0
- data/app/policies/manifestation_checkout_stat_policy.rb +21 -0
- data/app/policies/manifestation_reserve_stat_policy.rb +21 -0
- data/app/policies/reserve_policy.rb +37 -0
- data/app/policies/use_restriction_policy.rb +23 -0
- data/app/policies/user_checkout_stat_policy.rb +21 -0
- data/app/policies/user_group_has_checkout_type_policy.rb +21 -0
- data/app/policies/user_reserve_stat_policy.rb +21 -0
- data/app/views/carrier_type_has_checkout_types/index.html.erb +3 -3
- data/app/views/carrier_type_has_checkout_types/show.html.erb +1 -1
- data/app/views/carrier_types/_carrier_type_has_checkout_type_fields.html.erb +5 -0
- data/app/views/carrier_types/_checkout_form.html.erb +2 -4
- data/app/views/checkout_types/index.html.erb +4 -4
- data/app/views/checkout_types/show.html.erb +2 -2
- data/app/views/checkouts/_index.html.erb +1 -1
- data/app/views/checkouts/_index_overdue.html.erb +4 -5
- data/app/views/checkouts/_index_user.html.erb +5 -5
- data/app/views/checkouts/_list.html.erb +2 -2
- data/app/views/checkouts/_reserved_facet.html.erb +2 -2
- data/app/views/checkouts/edit.html.erb +1 -1
- data/app/views/checkouts/index.html.erb +2 -2
- data/app/views/checkouts/index.rss.builder +2 -2
- data/app/views/checkouts/index.txt.erb +1 -1
- data/app/views/checkouts/show.html.erb +10 -6
- data/app/views/circulation_statuses/index.html.erb +4 -4
- data/app/views/circulation_statuses/show.html.erb +1 -1
- data/app/views/reserves/_state_facet.html.erb +2 -2
- data/app/views/reserves/index.html.erb +6 -4
- data/app/views/reserves/show.html.erb +1 -1
- data/app/views/use_restrictions/index.html.erb +4 -4
- data/app/views/use_restrictions/show.html.erb +1 -1
- data/app/views/user_group_has_checkout_types/index.html.erb +3 -3
- data/app/views/user_group_has_checkout_types/show.html.erb +1 -1
- data/app/views/user_groups/_checkout_form.html.erb +2 -16
- data/app/views/user_groups/_user_group_has_checkout_type_fields.html.erb +14 -0
- data/db/migrate/20160703184619_add_most_recent_to_reserve_transitions.rb +9 -0
- data/db/migrate/20160703184650_add_most_recent_to_manifestation_checkout_stat_transitions.rb +9 -0
- data/db/migrate/20160703184723_add_most_recent_to_manifestation_reserve_stat_transitions.rb +9 -0
- data/db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb +9 -0
- data/db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb +9 -0
- data/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +5 -0
- data/lib/enju_circulation/version.rb +1 -1
- data/lib/enju_circulation.rb +0 -20
- data/lib/generators/enju_circulation/setup/setup_generator.rb +16 -4
- data/lib/tasks/enju_circulation_tasks.rake +1 -1
- data/spec/controllers/carrier_type_has_checkout_types_controller_spec.rb +13 -13
- data/spec/controllers/checked_items_controller_spec.rb +6 -6
- data/spec/controllers/checkins_controller_spec.rb +6 -6
- data/spec/controllers/checkout_types_controller_spec.rb +11 -11
- data/spec/controllers/checkouts_controller_spec.rb +72 -71
- data/spec/controllers/circulation_statuses_controller_spec.rb +12 -12
- data/spec/controllers/item_has_use_restrictions_controller_spec.rb +11 -11
- data/spec/controllers/lending_policies_controller_spec.rb +14 -14
- data/spec/controllers/manifestation_checkout_stats_controller_spec.rb +6 -6
- data/spec/controllers/manifestation_reserve_stats_controller_spec.rb +6 -6
- data/spec/controllers/reserves_controller_spec.rb +5 -5
- data/spec/controllers/use_restrictions_controller_spec.rb +14 -14
- data/spec/controllers/user_checkout_stats_controller_spec.rb +8 -8
- data/spec/controllers/user_group_has_checkout_types_controller_spec.rb +11 -11
- data/spec/controllers/user_reserve_stats_controller_spec.rb +8 -8
- data/spec/dummy/app/assets/javascripts/application.js +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +8 -4
- data/spec/dummy/app/models/user.rb +3 -5
- data/spec/dummy/config/application.rb +6 -37
- data/spec/dummy/config/environments/development.rb +22 -18
- data/spec/dummy/config/environments/production.rb +46 -34
- data/spec/dummy/config/environments/test.rb +19 -14
- data/spec/dummy/config/initializers/enju_leaf.rb +5 -0
- data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
- data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
- data/spec/dummy/db/schema.rb +30 -2
- data/spec/fixtures/profiles.yml +1 -1
- data/spec/models/manifestation_checkout_stat_spec.rb +3 -4
- data/spec/models/manifestation_reserve_stat_spec.rb +1 -1
- data/spec/models/user_checkout_stat_spec.rb +1 -1
- data/spec/models/user_reserve_stat_spec.rb +1 -1
- data/spec/support/devise.rb +2 -2
- data/spec/views/checkout_types/index.html.erb_spec.rb +1 -0
- data/spec/views/checkout_types/show.html.erb_spec.rb +1 -0
- data/spec/views/checkouts/index.html.erb_spec.rb +1 -3
- data/spec/views/checkouts/show.html.erb_spec.rb +5 -4
- data/spec/views/profiles/show.html.erb_spec.rb +2 -1
- data/spec/views/reserves/index.html.erb_spec.rb +3 -0
- data/spec/views/use_restrictions/index.html.erb_spec.rb +1 -0
- data/spec/views/use_restrictions/show.html.erb_spec.rb +1 -0
- metadata +147 -38
- data/app/models/enju_circulation/ability.rb +0 -114
- data/app/views/circulation_statuses/show.mobile.erb +0 -24
- data/app/workers/manifestation_checkout_stat_queue.rb +0 -7
- data/app/workers/manifestation_reserve_stat_queue.rb +0 -7
- data/app/workers/user_checkout_stat_queue.rb +0 -7
- data/app/workers/user_reserve_stat_queue.rb +0 -7
- data/lib/enju_circulation/accept.rb +0 -23
- data/lib/enju_circulation/basket.rb +0 -37
- data/lib/enju_circulation/carrier_type.rb +0 -15
- data/lib/enju_circulation/controller.rb +0 -21
- data/lib/enju_circulation/item.rb +0 -166
- data/lib/enju_circulation/manifestation.rb +0 -84
- data/lib/enju_circulation/profile.rb +0 -23
- data/lib/enju_circulation/user.rb +0 -61
- data/lib/enju_circulation/user_group.rb +0 -21
- data/lib/enju_circulation/withdraw.rb +0 -23
- data/spec/dummy/app/models/ability.rb +0 -111
- data/spec/dummy/app/models/local_agent.rb +0 -13
- data/spec/dummy/config/application.yml +0 -42
@@ -31,7 +31,7 @@ describe UserReserveStatsController do
|
|
31
31
|
|
32
32
|
it "assigns all user_reserve_stats as @user_reserve_stats" do
|
33
33
|
get :index
|
34
|
-
assigns(:user_reserve_stats).should
|
34
|
+
assigns(:user_reserve_stats).should be_nil
|
35
35
|
response.should be_forbidden
|
36
36
|
end
|
37
37
|
end
|
@@ -39,7 +39,7 @@ describe UserReserveStatsController do
|
|
39
39
|
describe "When not logged in" do
|
40
40
|
it "should not assign user_reserve_stats as @user_reserve_stats" do
|
41
41
|
get :index
|
42
|
-
assigns(:user_reserve_stats).should
|
42
|
+
assigns(:user_reserve_stats).should be_nil
|
43
43
|
response.should redirect_to(new_user_session_url)
|
44
44
|
end
|
45
45
|
end
|
@@ -111,7 +111,7 @@ describe UserReserveStatsController do
|
|
111
111
|
|
112
112
|
it "should not assign the requested user_reserve_stat as @user_reserve_stat" do
|
113
113
|
get :new
|
114
|
-
assigns(:user_reserve_stat).
|
114
|
+
assigns(:user_reserve_stat).should be_nil
|
115
115
|
response.should be_forbidden
|
116
116
|
end
|
117
117
|
end
|
@@ -119,7 +119,7 @@ describe UserReserveStatsController do
|
|
119
119
|
describe "When not logged in" do
|
120
120
|
it "should not assign the requested user_reserve_stat as @user_reserve_stat" do
|
121
121
|
get :new
|
122
|
-
assigns(:user_reserve_stat).
|
122
|
+
assigns(:user_reserve_stat).should be_nil
|
123
123
|
response.should redirect_to(new_user_session_url)
|
124
124
|
end
|
125
125
|
end
|
@@ -233,7 +233,7 @@ describe UserReserveStatsController do
|
|
233
233
|
describe "with valid params" do
|
234
234
|
it "assigns a newly created user_reserve_stat as @user_reserve_stat" do
|
235
235
|
post :create, :user_reserve_stat => @attrs
|
236
|
-
assigns(:user_reserve_stat).should
|
236
|
+
assigns(:user_reserve_stat).should be_nil
|
237
237
|
end
|
238
238
|
|
239
239
|
it "should be forbidden" do
|
@@ -245,7 +245,7 @@ describe UserReserveStatsController do
|
|
245
245
|
describe "with invalid params" do
|
246
246
|
it "assigns a newly created but unsaved user_reserve_stat as @user_reserve_stat" do
|
247
247
|
post :create, :user_reserve_stat => @invalid_attrs
|
248
|
-
assigns(:user_reserve_stat).
|
248
|
+
assigns(:user_reserve_stat).should be_nil
|
249
249
|
end
|
250
250
|
|
251
251
|
it "should be forbidden" do
|
@@ -259,7 +259,7 @@ describe UserReserveStatsController do
|
|
259
259
|
describe "with valid params" do
|
260
260
|
it "assigns a newly created user_reserve_stat as @user_reserve_stat" do
|
261
261
|
post :create, :user_reserve_stat => @attrs
|
262
|
-
assigns(:user_reserve_stat).should
|
262
|
+
assigns(:user_reserve_stat).should be_nil
|
263
263
|
end
|
264
264
|
|
265
265
|
it "should be forbidden" do
|
@@ -271,7 +271,7 @@ describe UserReserveStatsController do
|
|
271
271
|
describe "with invalid params" do
|
272
272
|
it "assigns a newly created but unsaved user_reserve_stat as @user_reserve_stat" do
|
273
273
|
post :create, :user_reserve_stat => @invalid_attrs
|
274
|
-
assigns(:user_reserve_stat).
|
274
|
+
assigns(:user_reserve_stat).should be_nil
|
275
275
|
end
|
276
276
|
|
277
277
|
it "should be forbidden" do
|
@@ -1,8 +1,12 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
include EnjuLeaf::Controller
|
5
|
+
include EnjuBiblio::Controller
|
6
|
+
include EnjuLibrary::Controller
|
7
|
+
include EnjuCirculation::Controller
|
8
|
+
before_action :set_paper_trail_whodunnit
|
9
|
+
after_action :verify_authorized
|
10
|
+
|
11
|
+
include Pundit
|
8
12
|
end
|
@@ -4,9 +4,7 @@ class User < ActiveRecord::Base
|
|
4
4
|
devise :database_authenticatable, #:registerable,
|
5
5
|
:recoverable, :rememberable, :trackable, :validatable
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
enju_circulation_user_model
|
11
|
-
enju_message_user_model
|
7
|
+
include EnjuLeaf::EnjuUser
|
8
|
+
include EnjuMessage::EnjuUser
|
9
|
+
include EnjuCirculation::EnjuUser
|
12
10
|
end
|
@@ -2,8 +2,10 @@ require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
|
-
Bundler.require
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require 'enju_leaf'
|
6
7
|
require 'enju_circulation'
|
8
|
+
require 'resque/server'
|
7
9
|
|
8
10
|
module Dummy
|
9
11
|
class Application < Rails::Application
|
@@ -11,49 +13,16 @@ module Dummy
|
|
11
13
|
# Application configuration should go into files in config/initializers
|
12
14
|
# -- all .rb files in that directory are automatically loaded.
|
13
15
|
|
14
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
15
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
16
|
-
|
17
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
18
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
19
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
20
|
-
|
21
|
-
# Activate observers that should always be running.
|
22
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
23
|
-
|
24
16
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
25
17
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
26
|
-
config.time_zone = '
|
18
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
27
19
|
|
28
20
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
21
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
22
|
# config.i18n.default_locale = :de
|
31
23
|
|
32
|
-
#
|
33
|
-
config.
|
34
|
-
|
35
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
36
|
-
config.filter_parameters += [:password]
|
37
|
-
|
38
|
-
# Use SQL instead of Active Record's schema dumper when creating the database.
|
39
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
40
|
-
# like if you have constraints or database-specific column types
|
41
|
-
# config.active_record.schema_format = :sql
|
42
|
-
|
43
|
-
# Enforce whitelist mode for mass assignment.
|
44
|
-
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
45
|
-
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
46
|
-
# parameters by using an attr_accessible or attr_protected declaration.
|
47
|
-
#config.active_record.whitelist_attributes = true
|
48
|
-
|
49
|
-
# Enable the asset pipeline
|
50
|
-
config.assets.enabled = true
|
51
|
-
|
52
|
-
# Version of your assets, change this if you want to expire all your assets
|
53
|
-
config.assets.version = '1.0'
|
24
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
25
|
+
config.active_record.raise_in_transactional_callbacks = true
|
54
26
|
end
|
55
27
|
end
|
56
28
|
|
57
|
-
require 'nkf'
|
58
|
-
require 'enju_leaf'
|
59
|
-
require 'mobylette'
|
@@ -1,37 +1,41 @@
|
|
1
|
-
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
5
5
|
# every request. This slows down response time but is perfect for development
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
|
-
#
|
10
|
-
config.
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
11
|
|
12
|
-
# Show full error reports and disable caching
|
12
|
+
# Show full error reports and disable caching.
|
13
13
|
config.consider_all_requests_local = true
|
14
14
|
config.action_controller.perform_caching = false
|
15
15
|
|
16
|
-
# Don't care if the mailer can't send
|
16
|
+
# Don't care if the mailer can't send.
|
17
17
|
config.action_mailer.raise_delivery_errors = false
|
18
18
|
|
19
|
-
# Print deprecation notices to the Rails logger
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
20
|
config.active_support.deprecation = :log
|
21
21
|
|
22
|
-
#
|
23
|
-
config.
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
24
|
|
25
|
-
#
|
26
|
-
#
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
27
29
|
|
28
|
-
#
|
29
|
-
#
|
30
|
-
|
30
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
+
# yet still be able to expire them through the digest params.
|
32
|
+
config.assets.digest = true
|
31
33
|
|
32
|
-
#
|
33
|
-
|
34
|
+
# Adds additional error checking when serving assets at runtime.
|
35
|
+
# Checks for improperly declared sprockets dependencies.
|
36
|
+
# Raises helpful error messages.
|
37
|
+
config.assets.raise_runtime_errors = true
|
34
38
|
|
35
|
-
#
|
36
|
-
config.
|
39
|
+
# Raises error for missing translations
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
37
41
|
end
|
@@ -1,67 +1,79 @@
|
|
1
|
-
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
|
-
# Code is not reloaded between requests
|
4
|
+
# Code is not reloaded between requests.
|
5
5
|
config.cache_classes = true
|
6
6
|
|
7
|
-
#
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
8
14
|
config.consider_all_requests_local = false
|
9
15
|
config.action_controller.perform_caching = true
|
10
16
|
|
11
|
-
#
|
12
|
-
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
+
# NGINX, varnish or squid.
|
21
|
+
# config.action_dispatch.rack_cache = true
|
22
|
+
|
23
|
+
# Disable serving static files from the `/public` folder by default since
|
24
|
+
# Apache or NGINX already handles this.
|
25
|
+
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
13
26
|
|
14
|
-
# Compress JavaScripts and CSS
|
15
|
-
config.assets.
|
27
|
+
# Compress JavaScripts and CSS.
|
28
|
+
config.assets.js_compressor = :uglifier
|
29
|
+
# config.assets.css_compressor = :sass
|
16
30
|
|
17
|
-
#
|
31
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
18
32
|
config.assets.compile = false
|
19
33
|
|
20
|
-
#
|
34
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
35
|
+
# yet still be able to expire them through the digest params.
|
21
36
|
config.assets.digest = true
|
22
37
|
|
23
|
-
#
|
24
|
-
# config.assets.manifest = YOUR_PATH
|
38
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
25
39
|
|
26
|
-
# Specifies the header that your server uses for sending files
|
27
|
-
# config.action_dispatch.x_sendfile_header =
|
28
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for
|
40
|
+
# Specifies the header that your server uses for sending files.
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
29
43
|
|
30
44
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
45
|
# config.force_ssl = true
|
32
46
|
|
33
|
-
#
|
34
|
-
#
|
47
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
48
|
+
# when problems arise.
|
49
|
+
config.log_level = :debug
|
35
50
|
|
36
|
-
# Prepend all log lines with the following tags
|
51
|
+
# Prepend all log lines with the following tags.
|
37
52
|
# config.log_tags = [ :subdomain, :uuid ]
|
38
53
|
|
39
|
-
# Use a different logger for distributed setups
|
54
|
+
# Use a different logger for distributed setups.
|
40
55
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
41
56
|
|
42
|
-
# Use a different cache store in production
|
57
|
+
# Use a different cache store in production.
|
43
58
|
# config.cache_store = :mem_cache_store
|
44
59
|
|
45
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
46
|
-
# config.action_controller.asset_host =
|
47
|
-
|
48
|
-
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
49
|
-
# config.assets.precompile += %w( search.js )
|
60
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
61
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
50
62
|
|
51
|
-
#
|
63
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
64
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
52
65
|
# config.action_mailer.raise_delivery_errors = false
|
53
66
|
|
54
|
-
# Enable threaded mode
|
55
|
-
# config.threadsafe!
|
56
|
-
|
57
67
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
58
|
-
# the I18n.default_locale when a translation
|
68
|
+
# the I18n.default_locale when a translation cannot be found).
|
59
69
|
config.i18n.fallbacks = true
|
60
70
|
|
61
|
-
# Send deprecation notices to registered listeners
|
71
|
+
# Send deprecation notices to registered listeners.
|
62
72
|
config.active_support.deprecation = :notify
|
63
73
|
|
64
|
-
#
|
65
|
-
|
66
|
-
|
74
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
|
+
config.log_formatter = ::Logger::Formatter.new
|
76
|
+
|
77
|
+
# Do not dump schema after migrations.
|
78
|
+
config.active_record.dump_schema_after_migration = false
|
67
79
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
5
|
# test suite. You never need to work with it otherwise. Remember that
|
@@ -7,33 +7,38 @@ Dummy::Application.configure do
|
|
7
7
|
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
13
14
|
|
14
|
-
#
|
15
|
-
config.
|
15
|
+
# Configure static file server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_files = true
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
16
18
|
|
17
|
-
# Show full error reports and disable caching
|
19
|
+
# Show full error reports and disable caching.
|
18
20
|
config.consider_all_requests_local = true
|
19
21
|
config.action_controller.perform_caching = false
|
20
22
|
|
21
|
-
# Raise exceptions instead of rendering exception templates
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
22
24
|
config.action_dispatch.show_exceptions = false
|
23
25
|
|
24
|
-
# Disable request forgery protection in test environment
|
25
|
-
config.action_controller.allow_forgery_protection
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
26
28
|
|
27
29
|
# Tell Action Mailer not to deliver emails to the real world.
|
28
30
|
# The :test delivery method accumulates sent emails in the
|
29
31
|
# ActionMailer::Base.deliveries array.
|
30
32
|
config.action_mailer.delivery_method = :test
|
31
33
|
|
32
|
-
#
|
33
|
-
|
34
|
+
# Randomize the order test cases are executed.
|
35
|
+
config.active_support.test_order = :random
|
34
36
|
|
35
|
-
# Print deprecation notices to the stderr
|
37
|
+
# Print deprecation notices to the stderr.
|
36
38
|
config.active_support.deprecation = :stderr
|
37
39
|
|
40
|
+
# Raises error for missing translations
|
41
|
+
# config.action_view.raise_on_missing_translations = true
|
42
|
+
|
38
43
|
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
|
39
44
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateWithdraws < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :withdraws do |t|
|
4
|
+
t.integer :basket_id
|
5
|
+
t.integer :item_id
|
6
|
+
t.integer :librarian_id
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_index :withdraws, :basket_id
|
11
|
+
add_index :withdraws, :item_id
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddTranslationTableToLibraryGroup < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
LibraryGroup.create_translation_table!({
|
4
|
+
login_banner: :text
|
5
|
+
}, {
|
6
|
+
migrate_data: true
|
7
|
+
})
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
LibraryGroup.drop_translation_table! migrate_data: true
|
12
|
+
end
|
13
|
+
end
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20160703190209) do
|
15
15
|
|
16
16
|
create_table "accepts", force: :cascade do |t|
|
17
17
|
t.integer "basket_id"
|
@@ -662,6 +662,18 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
662
662
|
add_index "libraries", ["library_group_id"], name: "index_libraries_on_library_group_id"
|
663
663
|
add_index "libraries", ["name"], name: "index_libraries_on_name", unique: true
|
664
664
|
|
665
|
+
create_table "library_group_translations", force: :cascade do |t|
|
666
|
+
t.integer "library_group_id", null: false
|
667
|
+
t.string "locale", null: false
|
668
|
+
t.datetime "created_at", null: false
|
669
|
+
t.datetime "updated_at", null: false
|
670
|
+
t.text "login_banner"
|
671
|
+
t.text "footer_banner"
|
672
|
+
end
|
673
|
+
|
674
|
+
add_index "library_group_translations", ["library_group_id"], name: "index_library_group_translations_on_library_group_id"
|
675
|
+
add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
|
676
|
+
|
665
677
|
create_table "library_groups", force: :cascade do |t|
|
666
678
|
t.string "name", null: false
|
667
679
|
t.text "display_name"
|
@@ -696,6 +708,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
696
708
|
t.integer "manifestation_checkout_stat_id"
|
697
709
|
t.datetime "created_at"
|
698
710
|
t.datetime "updated_at"
|
711
|
+
t.boolean "most_recent"
|
699
712
|
end
|
700
713
|
|
701
714
|
add_index "manifestation_checkout_stat_transitions", ["manifestation_checkout_stat_id"], name: "index_manifestation_checkout_stat_transitions_on_stat_id"
|
@@ -742,6 +755,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
742
755
|
t.integer "manifestation_reserve_stat_id"
|
743
756
|
t.datetime "created_at"
|
744
757
|
t.datetime "updated_at"
|
758
|
+
t.boolean "most_recent"
|
745
759
|
end
|
746
760
|
|
747
761
|
add_index "manifestation_reserve_stat_transitions", ["manifestation_reserve_stat_id"], name: "index_manifestation_reserve_stat_transitions_on_stat_id"
|
@@ -1050,11 +1064,12 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1050
1064
|
|
1051
1065
|
create_table "reserve_transitions", force: :cascade do |t|
|
1052
1066
|
t.string "to_state"
|
1053
|
-
t.text "metadata",
|
1067
|
+
t.text "metadata", default: "{}"
|
1054
1068
|
t.integer "sort_key"
|
1055
1069
|
t.integer "reserve_id"
|
1056
1070
|
t.datetime "created_at"
|
1057
1071
|
t.datetime "updated_at"
|
1072
|
+
t.boolean "most_recent"
|
1058
1073
|
end
|
1059
1074
|
|
1060
1075
|
add_index "reserve_transitions", ["reserve_id"], name: "index_reserve_transitions_on_reserve_id"
|
@@ -1279,6 +1294,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1279
1294
|
t.integer "user_checkout_stat_id"
|
1280
1295
|
t.datetime "created_at"
|
1281
1296
|
t.datetime "updated_at"
|
1297
|
+
t.boolean "most_recent"
|
1282
1298
|
end
|
1283
1299
|
|
1284
1300
|
add_index "user_checkout_stat_transitions", ["sort_key", "user_checkout_stat_id"], name: "index_user_checkout_stat_transitions_on_sort_key_and_stat_id", unique: true
|
@@ -1410,6 +1426,7 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1410
1426
|
t.integer "user_reserve_stat_id"
|
1411
1427
|
t.datetime "created_at"
|
1412
1428
|
t.datetime "updated_at"
|
1429
|
+
t.boolean "most_recent"
|
1413
1430
|
end
|
1414
1431
|
|
1415
1432
|
add_index "user_reserve_stat_transitions", ["sort_key", "user_reserve_stat_id"], name: "index_user_reserve_stat_transitions_on_sort_key_and_stat_id", unique: true
|
@@ -1466,4 +1483,15 @@ ActiveRecord::Schema.define(version: 20150221063719) do
|
|
1466
1483
|
|
1467
1484
|
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
|
1468
1485
|
|
1486
|
+
create_table "withdraws", force: :cascade do |t|
|
1487
|
+
t.integer "basket_id"
|
1488
|
+
t.integer "item_id"
|
1489
|
+
t.integer "librarian_id"
|
1490
|
+
t.datetime "created_at", null: false
|
1491
|
+
t.datetime "updated_at", null: false
|
1492
|
+
end
|
1493
|
+
|
1494
|
+
add_index "withdraws", ["basket_id"], name: "index_withdraws_on_basket_id"
|
1495
|
+
add_index "withdraws", ["item_id"], name: "index_withdraws_on_item_id"
|
1496
|
+
|
1469
1497
|
end
|
data/spec/fixtures/profiles.yml
CHANGED
@@ -9,7 +9,7 @@ profile_admin:
|
|
9
9
|
created_at: 2007-11-19 16:58:32.111941 +09:00
|
10
10
|
required_role_id: 4
|
11
11
|
user_number: "00001"
|
12
|
-
locale: "
|
12
|
+
locale: "en"
|
13
13
|
checkout_icalendar_token: 577830b08ecf9c4c4333d599a57a6f44a7fe76c0
|
14
14
|
save_checkout_history: true
|
15
15
|
profile_librarian1:
|
@@ -7,13 +7,12 @@ describe ManifestationCheckoutStat do
|
|
7
7
|
it "calculates manifestation count" do
|
8
8
|
old_message_count = Message.count
|
9
9
|
manifestation_checkout_stats(:one).transition_to!(:started).should be_truthy
|
10
|
-
|
11
|
-
Message.
|
12
|
-
#Message.order(:id).last.subject.should eq '集計が完了しました'
|
10
|
+
Message.count.should eq old_message_count + 1
|
11
|
+
Message.order(:id).last.subject.should eq '集計が完了しました'
|
13
12
|
end
|
14
13
|
|
15
14
|
it "should calculate in background" do
|
16
|
-
|
15
|
+
ManifestationCheckoutStatJob.perform_later(manifestation_checkout_stats(:one)).should be_truthy
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -12,7 +12,7 @@ describe ManifestationReserveStat do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should calculate in background" do
|
15
|
-
|
15
|
+
ManifestationReserveStatJob.perform_later(manifestation_reserve_stats(:one)).should be_truthy
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
data/spec/support/devise.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
RSpec.configure do |config|
|
2
|
-
config.include Devise::
|
3
|
-
config.include Devise::
|
2
|
+
config.include Devise::Test::ControllerHelpers, type: :controller
|
3
|
+
config.include Devise::Test::ControllerHelpers, type: :view
|
4
4
|
end
|
@@ -23,6 +23,7 @@ describe "checkout_types/index" do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "renders a list of checkout_types" do
|
26
|
+
allow(view).to receive(:policy).and_return double(create?: true, update?: true, destroy?: true)
|
26
27
|
render
|
27
28
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
28
29
|
assert_select "tr>td:nth-child(3)", /Book/
|
@@ -11,6 +11,7 @@ describe "checkout_types/show" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "renders attributes in <p>" do
|
14
|
+
allow(view).to receive(:policy).and_return double(create?: true, update?: true)
|
14
15
|
render
|
15
16
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
16
17
|
rendered.should match(/Name/)
|
@@ -5,15 +5,13 @@ describe "checkouts/index" do
|
|
5
5
|
fixtures :all
|
6
6
|
|
7
7
|
before(:each) do
|
8
|
-
view.extend EnjuLeaf::EnjuLeafHelper
|
9
|
-
view.extend EnjuBiblio::BiblioHelper
|
10
|
-
|
11
8
|
assign(:checkouts, Checkout.page(1))
|
12
9
|
assign(:checkouts_facet, [])
|
13
10
|
view.stub(:current_user).and_return(User.where(username: 'enjuadmin').first)
|
14
11
|
end
|
15
12
|
|
16
13
|
it "renders a list of checkouts" do
|
14
|
+
allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
|
17
15
|
render
|
18
16
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
19
17
|
assert_select "tr:nth-child(2)>td:nth-child(2)", /00001/
|