enju_leaf 1.1.4 → 1.2.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +3 -3
  3. data/app/assets/javascripts/autocomplete_agent.js +30 -0
  4. data/app/assets/javascripts/{menu.enju.js → enju.menu.js} +5 -0
  5. data/app/assets/javascripts/enju_leaf.js +3 -3
  6. data/app/assets/javascripts/portlets.js +2 -2
  7. data/app/assets/stylesheets/enju.css +52 -18
  8. data/app/assets/stylesheets/enju_leaf.css +2 -0
  9. data/app/controllers/concerns/enju_leaf/controller.rb +225 -0
  10. data/app/controllers/my_accounts_controller.rb +9 -7
  11. data/app/controllers/names_controller.rb +60 -0
  12. data/app/controllers/page_controller.rb +5 -4
  13. data/app/controllers/profiles_controller.rb +13 -4
  14. data/app/controllers/roles_controller.rb +11 -2
  15. data/app/controllers/user_export_files_controller.rb +13 -3
  16. data/app/controllers/user_groups_controller.rb +12 -3
  17. data/app/controllers/user_import_files_controller.rb +14 -4
  18. data/app/controllers/user_import_results_controller.rb +11 -1
  19. data/app/jobs/user_export_file_job.rb +7 -0
  20. data/app/jobs/user_import_file_job.rb +7 -0
  21. data/app/mailers/notifier.rb +0 -2
  22. data/app/models/concerns/calculate_stat.rb +35 -0
  23. data/app/models/concerns/enju_leaf/enju_user.rb +309 -0
  24. data/app/models/concerns/export_file.rb +19 -0
  25. data/app/models/concerns/import_file.rb +89 -0
  26. data/app/models/concerns/master_model.rb +38 -0
  27. data/app/models/profile.rb +2 -2
  28. data/app/models/user_export_file.rb +0 -2
  29. data/app/models/user_group.rb +0 -3
  30. data/app/models/user_import_file.rb +0 -1
  31. data/app/policies/application_policy.rb +53 -0
  32. data/app/policies/name_policy.rb +21 -0
  33. data/app/policies/profile_policy.rb +55 -0
  34. data/app/policies/role_policy.rb +21 -0
  35. data/app/policies/user_export_file_policy.rb +21 -0
  36. data/app/policies/user_group_policy.rb +22 -0
  37. data/app/policies/user_import_file_policy.rb +21 -0
  38. data/app/policies/user_import_result_policy.rb +21 -0
  39. data/app/views/devise/sessions/{new.mobile.erb → new.html+phone.erb} +0 -0
  40. data/app/views/layouts/{application.mobile.erb → application.html+phone.erb} +0 -0
  41. data/app/views/layouts/application.html.erb +2 -2
  42. data/app/views/layouts/devise/{passwords.mobile.erb → passwords.html+phone.erb} +0 -0
  43. data/app/views/layouts/devise/{sessions.mobile.erb → sessions.html+phone.erb} +0 -0
  44. data/app/views/my_accounts/{show.mobile.erb → show.html+phone.erb} +0 -0
  45. data/app/views/my_accounts/show.html.erb +3 -3
  46. data/app/views/names/_form.html.erb +41 -0
  47. data/app/views/names/edit.html.erb +6 -0
  48. data/app/views/names/index.html.erb +37 -0
  49. data/app/views/names/new.html.erb +5 -0
  50. data/app/views/names/show.html.erb +34 -0
  51. data/app/views/page/{403.mobile.erb → 403.html+phone.erb} +0 -0
  52. data/app/views/page/{404.mobile.erb → 404.html+phone.erb} +0 -0
  53. data/app/views/page/{500.mobile.erb → 500.html+phone.erb} +0 -0
  54. data/app/views/page/_footer.html+phone.erb +3 -0
  55. data/app/views/page/_footer.html.erb +3 -10
  56. data/app/views/page/{_index.mobile.erb → _index.html+phone.erb} +0 -0
  57. data/app/views/page/_menu.html.erb +1 -1
  58. data/app/views/page/{_mobile.mobile.erb → _mobile.html+phone.erb} +0 -0
  59. data/app/views/page/{_search_form.mobile.erb → _search_form.html+phone.erb} +0 -0
  60. data/app/views/page/_select_locale.html.erb +1 -1
  61. data/app/views/page/configuration.html.erb +1 -1
  62. data/app/views/page/{index.mobile.erb → index.html+phone.erb} +0 -0
  63. data/app/views/profiles/edit.html.erb +1 -1
  64. data/app/views/profiles/index.html.erb +5 -5
  65. data/app/views/profiles/{show.mobile.erb → show.html+phone.erb} +0 -0
  66. data/app/views/profiles/show.html.erb +9 -4
  67. data/app/views/roles/index.html.erb +2 -2
  68. data/app/views/roles/show.html.erb +1 -1
  69. data/app/views/user_groups/_form.html.erb +1 -1
  70. data/app/views/user_groups/index.html.erb +4 -4
  71. data/app/views/user_groups/show.html.erb +2 -2
  72. data/config/locales/translation_ja.yml +2 -2
  73. data/config/routes.rb +1 -4
  74. data/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
  75. data/db/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +9 -0
  76. data/db/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +9 -0
  77. data/lib/enju_leaf/engine.rb +4 -8
  78. data/lib/enju_leaf/helper.rb +1 -1
  79. data/lib/enju_leaf/version.rb +1 -1
  80. data/lib/enju_leaf.rb +0 -249
  81. data/lib/generators/enju_leaf/setup/setup_generator.rb +19 -26
  82. data/lib/generators/enju_leaf/setup/templates/config/initializers/enju_leaf.rb +1 -0
  83. data/lib/tasks/enju_leaf_tasks.rake +2 -2
  84. data/spec/controllers/profiles_controller_spec.rb +22 -12
  85. data/spec/controllers/user_export_files_controller_spec.rb +9 -10
  86. data/spec/controllers/user_groups_controller_spec.rb +9 -9
  87. data/spec/controllers/user_import_files_controller_spec.rb +6 -6
  88. data/spec/controllers/user_import_results_controller_spec.rb +3 -3
  89. data/spec/dummy/app/controllers/application_controller.rb +6 -7
  90. data/spec/dummy/app/models/user.rb +4 -5
  91. data/spec/dummy/config/application.rb +6 -38
  92. data/spec/dummy/config/environments/development.rb +22 -18
  93. data/spec/dummy/config/environments/production.rb +46 -34
  94. data/spec/dummy/config/environments/test.rb +19 -14
  95. data/spec/dummy/config/initializers/enju_leaf.rb +2 -0
  96. data/spec/dummy/config/routes.rb +5 -1
  97. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +13 -0
  98. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +9 -0
  99. data/spec/dummy/db/schema.rb +15 -0
  100. data/spec/factories/profile.rb +6 -6
  101. data/spec/models/user_export_file_spec.rb +1 -1
  102. data/spec/models/user_import_file_spec.rb +5 -5
  103. data/spec/rails_helper.rb +4 -11
  104. data/spec/routing/users_spec.rb +14 -0
  105. data/spec/spec_helper.rb +1 -1
  106. data/spec/support/devise.rb +2 -2
  107. data/spec/views/my_accounts/show.html.erb_spec.rb +43 -0
  108. data/spec/views/page/about.html.erb_spec.rb +0 -3
  109. data/spec/views/page/advanced_search.html.erb_spec.rb +1 -4
  110. data/spec/views/page/configuration.html.erb_spec.rb +0 -3
  111. data/spec/views/page/export.html.erb_spec.rb +0 -3
  112. data/spec/views/page/import.html.erb_spec.rb +0 -3
  113. data/spec/views/page/index.html.erb_spec.rb +1 -4
  114. data/spec/views/page/opensearch.xml.builder_spec.rb +1 -4
  115. data/spec/views/page/statistics.html.erb_spec.rb +0 -3
  116. data/spec/views/profiles/edit.html.erb_spec.rb +11 -14
  117. data/spec/views/profiles/index.html.erb_spec.rb +3 -4
  118. data/spec/views/profiles/show.html.erb_spec.rb +3 -8
  119. data/spec/views/user_import_results/index.html.erb_spec.rb +0 -3
  120. data/vendor/assets/javascripts/jquery.highlight.js +97 -56
  121. metadata +114 -288
  122. data/app/assets/javascripts/tab_view.js +0 -4
  123. data/app/models/enju_leaf/ability.rb +0 -102
  124. data/app/views/page/_footer.mobile.erb +0 -3
  125. data/app/workers/user_export_file_queue.rb +0 -7
  126. data/app/workers/user_import_file_queue.rb +0 -7
  127. data/config/initializers/resque.rb +0 -1
  128. data/lib/enju_leaf/calculate_stat.rb +0 -42
  129. data/lib/enju_leaf/controller.rb +0 -24
  130. data/lib/enju_leaf/export_file.rb +0 -26
  131. data/lib/enju_leaf/import_file.rb +0 -99
  132. data/lib/enju_leaf/master_model.rb +0 -42
  133. data/lib/enju_leaf/user.rb +0 -317
  134. data/lib/plugins/ext/mobylette/resolvers/chained_fallback_resolver.rb +0 -73
  135. data/lib/plugins/ext/mobylette.rb +0 -2
  136. data/lib/plugins/ext/sunspot/abstract_search.rb +0 -12
  137. data/lib/plugins/ext/sunspot/dismax.rb +0 -41
  138. data/lib/plugins/ext/sunspot/start_record.rb +0 -55
  139. data/lib/plugins/ext/sunspot.rb +0 -3
  140. data/lib/plugins/ext.rb +0 -2
  141. data/lib/plugins.rb +0 -2
  142. data/spec/dummy/config/application.yml +0 -47
  143. data/spec/routing/accounts_spec.rb +0 -14
@@ -103,7 +103,7 @@ describe UserGroupsController do
103
103
 
104
104
  it "should not assign the requested user_group as @user_group" do
105
105
  get :new
106
- assigns(:user_group).should_not be_valid
106
+ assigns(:user_group).should be_nil
107
107
  expect(response).to be_forbidden
108
108
  end
109
109
  end
@@ -113,7 +113,7 @@ describe UserGroupsController do
113
113
 
114
114
  it "should not assign the requested user_group as @user_group" do
115
115
  get :new
116
- assigns(:user_group).should_not be_valid
116
+ assigns(:user_group).should be_nil
117
117
  expect(response).to be_forbidden
118
118
  end
119
119
  end
@@ -121,7 +121,7 @@ describe UserGroupsController do
121
121
  describe "When not logged in" do
122
122
  it "should not assign the requested user_group as @user_group" do
123
123
  get :new
124
- assigns(:user_group).should_not be_valid
124
+ assigns(:user_group).should be_nil
125
125
  expect(response).to redirect_to(new_user_session_url)
126
126
  end
127
127
  end
@@ -207,7 +207,7 @@ describe UserGroupsController do
207
207
  describe "with valid params" do
208
208
  it "assigns a newly created user_group as @user_group" do
209
209
  post :create, user_group: @attrs
210
- assigns(:user_group).should be_valid
210
+ assigns(:user_group).should be_nil
211
211
  end
212
212
 
213
213
  it "should be forbidden" do
@@ -219,7 +219,7 @@ describe UserGroupsController do
219
219
  describe "with invalid params" do
220
220
  it "assigns a newly created but unsaved user_group as @user_group" do
221
221
  post :create, user_group: @invalid_attrs
222
- assigns(:user_group).should_not be_valid
222
+ assigns(:user_group).should be_nil
223
223
  end
224
224
 
225
225
  it "should be forbidden" do
@@ -235,7 +235,7 @@ describe UserGroupsController do
235
235
  describe "with valid params" do
236
236
  it "assigns a newly created user_group as @user_group" do
237
237
  post :create, user_group: @attrs
238
- assigns(:user_group).should be_valid
238
+ assigns(:user_group).should be_nil
239
239
  end
240
240
 
241
241
  it "should be forbidden" do
@@ -247,7 +247,7 @@ describe UserGroupsController do
247
247
  describe "with invalid params" do
248
248
  it "assigns a newly created but unsaved user_group as @user_group" do
249
249
  post :create, user_group: @invalid_attrs
250
- assigns(:user_group).should_not be_valid
250
+ assigns(:user_group).should be_nil
251
251
  end
252
252
 
253
253
  it "should be forbidden" do
@@ -261,7 +261,7 @@ describe UserGroupsController do
261
261
  describe "with valid params" do
262
262
  it "assigns a newly created user_group as @user_group" do
263
263
  post :create, user_group: @attrs
264
- assigns(:user_group).should be_valid
264
+ assigns(:user_group).should be_nil
265
265
  end
266
266
 
267
267
  it "should be forbidden" do
@@ -273,7 +273,7 @@ describe UserGroupsController do
273
273
  describe "with invalid params" do
274
274
  it "assigns a newly created but unsaved user_group as @user_group" do
275
275
  post :create, user_group: @invalid_attrs
276
- assigns(:user_group).should_not be_valid
276
+ assigns(:user_group).should be_nil
277
277
  end
278
278
 
279
279
  it "should be forbidden" do
@@ -27,7 +27,7 @@ describe UserImportFilesController do
27
27
 
28
28
  it "assigns empty as @user_import_files" do
29
29
  get :index
30
- assigns(:user_import_files).should be_empty
30
+ assigns(:user_import_files).should be_nil
31
31
  expect(response).to be_forbidden
32
32
  end
33
33
  end
@@ -35,7 +35,7 @@ describe UserImportFilesController do
35
35
  describe "When not logged in" do
36
36
  it "assigns empty as @user_import_files" do
37
37
  get :index
38
- assigns(:user_import_files).should be_empty
38
+ assigns(:user_import_files).should be_nil
39
39
  expect(response).to redirect_to(new_user_session_url)
40
40
  end
41
41
  end
@@ -114,7 +114,7 @@ describe UserImportFilesController do
114
114
 
115
115
  it "should not assign the requested user_import_file as @user_import_file" do
116
116
  get :new
117
- assigns(:user_import_file).should_not be_valid
117
+ assigns(:user_import_file).should be_nil
118
118
  expect(response).to be_forbidden
119
119
  end
120
120
  end
@@ -122,7 +122,7 @@ describe UserImportFilesController do
122
122
  describe "When not logged in" do
123
123
  it "should not assign the requested user_import_file as @user_import_file" do
124
124
  get :new
125
- assigns(:user_import_file).should_not be_valid
125
+ assigns(:user_import_file).should be_nil
126
126
  expect(response).to redirect_to(new_user_session_url)
127
127
  end
128
128
  end
@@ -155,7 +155,7 @@ describe UserImportFilesController do
155
155
 
156
156
  it "should be forbidden" do
157
157
  post :create, user_import_file: {user_import: fixture_file_upload("/../../examples/user_import_file_sample.tsv", 'text/csv') }
158
- assigns(:user_import_file).user.should be_nil
158
+ assigns(:user_import_file).should be_nil
159
159
  expect(response).to be_forbidden
160
160
  end
161
161
  end
@@ -163,7 +163,7 @@ describe UserImportFilesController do
163
163
  describe "When not logged in" do
164
164
  it "should be redirected to new session url" do
165
165
  post :create, user_import_file: {user_import: fixture_file_upload("/../../examples/user_import_file_sample.tsv", 'text/csv') }
166
- assigns(:user_import_file).user.should be_nil
166
+ assigns(:user_import_file).should be_nil
167
167
  expect(response).to redirect_to new_user_session_url
168
168
  end
169
169
  end
@@ -19,7 +19,7 @@ describe UserImportResultsController do
19
19
  @file.default_user_group = UserGroup.find(2)
20
20
  @file.default_library = Library.find(3)
21
21
  @file.save
22
- result = @file.import_start
22
+ @file.import_start
23
23
  end
24
24
  render_views
25
25
  it "should assign all user_import_results for the user_import_file with a page parameter" do
@@ -48,7 +48,7 @@ describe UserImportResultsController do
48
48
 
49
49
  it "assigns empty as @user_import_results" do
50
50
  get :index
51
- assigns(:user_import_results).should be_empty
51
+ assigns(:user_import_results).should be_nil
52
52
  response.should be_forbidden
53
53
  end
54
54
  end
@@ -56,7 +56,7 @@ describe UserImportResultsController do
56
56
  describe "When not logged in" do
57
57
  it "assigns empty as @user_import_results" do
58
58
  get :index
59
- assigns(:user_import_results).should be_empty
59
+ assigns(:user_import_results).should be_nil
60
60
  response.should redirect_to(new_user_session_url)
61
61
  end
62
62
  end
@@ -1,11 +1,10 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
- enju_leaf
4
- enju_biblio
5
- enju_library
3
+ include EnjuLeaf::Controller
4
+ include EnjuBiblio::Controller
5
+ include EnjuLibrary::Controller
6
+ before_action :set_paper_trail_whodunnit
7
+ after_action :verify_authorized
6
8
 
7
- mobylette_config do |config|
8
- config[:skip_xhr_requests] = false
9
- #config[:skip_user_agents] = Setting.enju.skip_mobile_agents.map{|a| a.to_sym}
10
- end
9
+ include Pundit
11
10
  end
@@ -1,11 +1,10 @@
1
- # -*- encoding: utf-8 -*-
2
1
  class User < ActiveRecord::Base
3
2
  devise :database_authenticatable, #:registerable,
4
3
  :recoverable, :rememberable, :trackable, #, :validatable
5
4
  :lockable, :lock_strategy => :none, :unlock_strategy => :none
6
5
 
7
- enju_leaf_user_model
8
- enju_message_user_model
9
- enju_circulation_user_model
10
- enju_bookmark_user_model
6
+ include EnjuLeaf::EnjuUser
7
+ include EnjuMessage::EnjuUser
8
+ include EnjuCirculation::EnjuUser
9
+ include EnjuBookmark::EnjuUser
11
10
  end
@@ -4,6 +4,10 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require
6
6
  require 'enju_leaf'
7
+ require 'resque/server'
8
+ require 'enju_circulation'
9
+ require 'enju_bookmark'
10
+ require 'enju_search_log'
7
11
 
8
12
  module Dummy
9
13
  class Application < Rails::Application
@@ -11,16 +15,6 @@ module Dummy
11
15
  # Application configuration should go into files in config/initializers
12
16
  # -- all .rb files in that directory are automatically loaded.
13
17
 
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
18
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
19
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
26
20
  # config.time_zone = 'Central Time (US & Canada)'
@@ -29,34 +23,8 @@ module Dummy
29
23
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
30
24
  # config.i18n.default_locale = :de
31
25
 
32
- # Configure the default encoding used in templates for Ruby 1.9.
33
- config.encoding = "utf-8"
34
-
35
- # Configure sensitive parameters which will be filtered from the log file.
36
- config.filter_parameters += [:password]
37
-
38
- # Enable escaping HTML in JSON.
39
- config.active_support.escape_html_entities_in_json = true
40
-
41
- # Use SQL instead of Active Record's schema dumper when creating the database.
42
- # This is necessary if your schema can't be completely dumped by the schema dumper,
43
- # like if you have constraints or database-specific column types
44
- # config.active_record.schema_format = :sql
45
-
46
- # Enforce whitelist mode for mass assignment.
47
- # This will create an empty whitelist of attributes available for mass-assignment for all models
48
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
49
- # parameters by using an attr_accessible or attr_protected declaration.
50
- #config.active_record.whitelist_attributes = true
51
-
52
- # Enable the asset pipeline
53
- config.assets.enabled = true
54
-
55
- # Version of your assets, change this if you want to expire all your assets
56
- config.assets.version = '1.0'
26
+ # Do not swallow errors in after_commit/after_rollback callbacks.
27
+ config.active_record.raise_in_transactional_callbacks = true
57
28
  end
58
29
  end
59
30
 
60
- require 'enju_circulation'
61
- require 'enju_bookmark'
62
- require 'enju_search_log'
@@ -1,37 +1,41 @@
1
- Dummy::Application.configure do
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
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
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
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
24
 
25
- # Raise exception on mass assignment protection for Active Record models
26
- config.active_record.mass_assignment_sanitizer = :strict
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
- # Log the query plan for queries taking more than this (works
29
- # with SQLite, MySQL, and PostgreSQL)
30
- config.active_record.auto_explain_threshold_in_seconds = 0.5
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
- # Do not compress assets
33
- config.assets.compress = false
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
- # Expands the lines which load the assets
36
- config.assets.debug = true
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
37
41
  end
@@ -1,67 +1,79 @@
1
- Dummy::Application.configure do
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
- # Full error reports are disabled and caching is turned on
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
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
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.compress = true
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
16
30
 
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
18
32
  config.assets.compile = false
19
33
 
20
- # Generate digests for assets URLs
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
- # Defaults to nil and saved in location specified by config.assets.prefix
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 = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
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
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
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 = "http://assets.example.com"
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
- # Disable delivery errors, bad email addresses will be ignored
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 can not be found)
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
- # Log the query plan for queries taking more than this (works
65
- # with SQLite, MySQL, and PostgreSQL)
66
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
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
- Dummy::Application.configure do
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
- # Configure static asset server for tests with Cache-Control for performance
11
- config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
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
- # Log error messages when you accidentally call methods on nil
15
- config.whiny_nils = true
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 = false
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
- # Raise exception on mass assignment protection for Active Record models
33
- #config.active_record.mass_assignment_sanitizer = :strict
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,2 @@
1
+ Profile.include(EnjuCirculation::EnjuProfile)
2
+ UserGroup.include(EnjuCirculation::EnjuUserGroup)
@@ -1,5 +1,9 @@
1
1
  Dummy::Application.routes.draw do
2
- devise_for :users, :path => 'accounts'
2
+ devise_for :users
3
+ authenticate :user, lambda {|u| u.role.try(:name) == 'Administrator' } do
4
+ mount Resque::Server.new, at: "/resque", as: :resque
5
+ end
6
+
3
7
  # The priority is based upon order of creation:
4
8
  # first created -> highest priority.
5
9
 
@@ -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
@@ -0,0 +1,9 @@
1
+ class AddFooterBannerToLibraryGroup < ActiveRecord::Migration
2
+ def up
3
+ LibraryGroup.add_translation_fields! footer_banner: :text
4
+ end
5
+
6
+ def down
7
+ remove_column :library_group_translations, :footer_banner
8
+ end
9
+ end
@@ -505,6 +505,7 @@ ActiveRecord::Schema.define(version: 20160703185015) do
505
505
  t.integer "profile_id"
506
506
  t.datetime "created_at", null: false
507
507
  t.datetime "updated_at", null: false
508
+ t.string "provider"
508
509
  end
509
510
 
510
511
  add_index "identities", ["email"], name: "index_identities_on_email"
@@ -649,6 +650,18 @@ ActiveRecord::Schema.define(version: 20160703185015) do
649
650
  add_index "libraries", ["library_group_id"], name: "index_libraries_on_library_group_id"
650
651
  add_index "libraries", ["name"], name: "index_libraries_on_name", unique: true
651
652
 
653
+ create_table "library_group_translations", force: :cascade do |t|
654
+ t.integer "library_group_id", null: false
655
+ t.string "locale", null: false
656
+ t.datetime "created_at", null: false
657
+ t.datetime "updated_at", null: false
658
+ t.text "login_banner"
659
+ t.text "footer_banner"
660
+ end
661
+
662
+ add_index "library_group_translations", ["library_group_id"], name: "index_library_group_translations_on_library_group_id"
663
+ add_index "library_group_translations", ["locale"], name: "index_library_group_translations_on_locale"
664
+
652
665
  create_table "library_groups", force: :cascade do |t|
653
666
  t.string "name", null: false
654
667
  t.text "display_name"
@@ -1353,6 +1366,7 @@ ActiveRecord::Schema.define(version: 20160703185015) do
1353
1366
  t.integer "user_export_file_id"
1354
1367
  t.datetime "created_at"
1355
1368
  t.datetime "updated_at"
1369
+ t.boolean "most_recent"
1356
1370
  end
1357
1371
 
1358
1372
  add_index "user_export_file_transitions", ["sort_key", "user_export_file_id"], name: "index_user_export_file_transitions_on_sort_key_and_file_id", unique: true
@@ -1421,6 +1435,7 @@ ActiveRecord::Schema.define(version: 20160703185015) do
1421
1435
  t.integer "user_import_file_id"
1422
1436
  t.datetime "created_at"
1423
1437
  t.datetime "updated_at"
1438
+ t.boolean "most_recent"
1424
1439
  end
1425
1440
 
1426
1441
  add_index "user_import_file_transitions", ["sort_key", "user_import_file_id"], name: "index_user_import_file_transitions_on_sort_key_and_file_id", unique: true
@@ -5,13 +5,13 @@ FactoryGirl.define do
5
5
  f.sequence(:user_number){|n| "user_number_#{n}"}
6
6
  f.library_id 2
7
7
  f.locale "ja"
8
- factory :librarian_profile, :class => Profile do |f|
9
- f.required_role_id {Role.where(name: 'Librarian').first.id}
10
- f.association :user, factory: :librarian
8
+ factory :librarian_profile, :class => Profile do |profile|
9
+ profile.required_role_id {Role.where(name: 'Librarian').first.id}
10
+ profile.association :user, factory: :librarian
11
11
  end
12
- factory :admin_profile, :class => Profile do |f|
13
- f.required_role_id {Role.where(name: 'Administrator').first.id}
14
- f.association :user, factory: :admin
12
+ factory :admin_profile, :class => Profile do |profile|
13
+ profile.required_role_id {Role.where(name: 'Administrator').first.id}
14
+ profile.association :user, factory: :admin
15
15
  end
16
16
  end
17
17
  end
@@ -9,7 +9,7 @@ describe UserExportFile do
9
9
  file = UserExportFile.new
10
10
  file.user = users(:admin)
11
11
  file.save
12
- UserExportFileQueue.perform(file.id).should be_truthy
12
+ UserExportFileJob.perform_later(file).should be_truthy
13
13
  Message.count.should eq message_count + 1
14
14
  Message.order(:id).last.subject.should eq 'エクスポートが完了しました'
15
15
  end