enju_leaf 1.1.0.rc17 → 1.1.0.rc18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/app/controllers/user_export_files_controller.rb +4 -3
- data/app/controllers/user_groups_controller.rb +5 -1
- data/app/controllers/user_import_files_controller.rb +2 -2
- data/app/models/profile.rb +10 -5
- data/app/models/role.rb +2 -2
- data/app/models/user_export_file.rb +16 -11
- data/app/models/user_export_file_transition.rb +4 -4
- data/app/models/user_group.rb +3 -3
- data/app/models/user_has_role.rb +2 -2
- data/app/models/user_import_file.rb +19 -10
- data/app/models/user_import_file_transition.rb +4 -4
- data/app/models/user_import_result.rb +3 -2
- data/app/views/layouts/application.html.erb +1 -1
- data/app/views/my_accounts/_edit_credential.html.erb +1 -1
- data/app/views/page/_menu.html.erb +2 -2
- data/app/views/page/advanced_search.html.erb +12 -0
- data/app/views/user_export_files/show.html.erb +5 -0
- data/app/workers/user_export_file_queue.rb +1 -1
- data/app/workers/user_import_file_queue.rb +1 -1
- data/config/initializers/redis.rb +3 -0
- data/config/locales/simple_form.ja.yml +1 -1
- data/db/migrate/20150506105356_add_error_message_to_user_import_result.rb +5 -0
- data/lib/enju_leaf.rb +5 -6
- data/lib/enju_leaf/calculate_stat.rb +2 -2
- data/lib/enju_leaf/engine.rb +1 -2
- data/lib/enju_leaf/export_file.rb +2 -2
- data/lib/enju_leaf/helper.rb +8 -9
- data/lib/enju_leaf/import_file.rb +8 -8
- data/lib/enju_leaf/user.rb +15 -15
- data/lib/enju_leaf/version.rb +1 -1
- data/lib/generators/enju_leaf/quick_install/quick_install_generator.rb +7 -14
- data/lib/generators/enju_leaf/setup/setup_generator.rb +23 -16
- data/spec/controllers/my_accounts_controller_spec.rb +7 -6
- data/spec/controllers/profiles_controller_spec.rb +12 -12
- data/spec/controllers/roles_controller_spec.rb +12 -12
- data/spec/controllers/user_export_files_controller_spec.rb +20 -20
- data/spec/controllers/user_groups_controller_spec.rb +47 -47
- data/spec/controllers/user_import_files_controller_spec.rb +20 -20
- data/spec/controllers/user_import_results_controller_spec.rb +12 -12
- data/spec/dummy/app/controllers/application_controller.rb +1 -1
- data/spec/dummy/config/initializers/devise.rb +1 -1
- data/spec/dummy/db/migrate/20150221063719_add_settings_to_library_group.rb +5 -0
- data/spec/dummy/db/schema.rb +3 -1
- data/spec/factories/user.rb +4 -4
- data/spec/fixtures/library_groups.yml +27 -22
- data/spec/fixtures/profiles.yml +10 -5
- data/spec/fixtures/roles.yml +2 -2
- data/spec/fixtures/user_export_files.yml +8 -9
- data/spec/fixtures/user_groups.yml +3 -3
- data/spec/fixtures/user_has_roles.yml +2 -2
- data/spec/fixtures/user_import_files.yml +10 -8
- data/spec/fixtures/user_import_results.yml +3 -2
- data/spec/models/profile_spec.rb +25 -0
- data/spec/models/role_spec.rb +2 -2
- data/spec/models/user_export_file_spec.rb +8 -9
- data/spec/models/user_group_spec.rb +3 -3
- data/spec/models/user_has_role_spec.rb +2 -2
- data/spec/models/user_import_file_spec.rb +19 -16
- data/spec/models/user_import_result_spec.rb +3 -2
- data/spec/routing/accounts_spec.rb +2 -2
- data/spec/routing/profiles_routing_spec.rb +7 -7
- data/spec/routing/resource_import_files_routing_spec.rb +4 -4
- data/spec/views/profiles/new.html.erb_spec.rb +2 -2
- metadata +33 -33
- data/app/models/setting.rb +0 -4
- data/lib/generators/enju_leaf/setup/templates/config/application.yml +0 -48
- data/spec/dummy/app/models/setting.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b485d724e7c536952e92b1ba09b5a00f14eb6bcd
|
4
|
+
data.tar.gz: 24d48f269fe8f063b37f92160029564002f7b9f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3c3596996704276665024e8f0a268a29a8d708fdc773bfe79128059b2b2d3b774d912c30ace4cbe23d3be8c5ccba73620e2e2d47acef8b78ed49a0d2f846b11
|
7
|
+
data.tar.gz: ec8ff2d3b703245113f7a8d0da04446bd52404a618948571001101775b54d42e8b2d11f4885fcf15e7ffd745cf8616bc4daecfcb15b00fa922f5dd742d43c249
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ class UserExportFilesController < ApplicationController
|
|
16
16
|
# GET /user_export_files/1.json
|
17
17
|
def show
|
18
18
|
if @user_export_file.user_export.path
|
19
|
-
unless
|
19
|
+
unless ENV['ENJU_STORAGE'] == 's3'
|
20
20
|
file = @user_export_file.user_export.path
|
21
21
|
end
|
22
22
|
end
|
@@ -25,8 +25,9 @@ class UserExportFilesController < ApplicationController
|
|
25
25
|
format.html # show.html.erb
|
26
26
|
format.json { render json: @user_export_file }
|
27
27
|
format.download {
|
28
|
-
if
|
29
|
-
|
28
|
+
if ENV['ENJU_STORAGE'] == 's3'
|
29
|
+
send_data Faraday.get(@user_export_file.user_export.expiring_url).body.force_encoding('UTF-8'),
|
30
|
+
filename: File.basename(@user_export_file.user_export_file_name), type: 'application/octet-stream'
|
30
31
|
else
|
31
32
|
send_file file, filename: @user_export_file.user_export_file_name, type: 'application/octet-stream'
|
32
33
|
end
|
@@ -93,7 +93,11 @@ class UserGroupsController < ApplicationController
|
|
93
93
|
:number_of_day_to_notify_overdue,
|
94
94
|
:number_of_day_to_notify_due_date,
|
95
95
|
:number_of_time_to_notify_overdue,
|
96
|
-
|
96
|
+
# EnjuCirculation
|
97
|
+
{:user_group_has_checkout_types_attributes => [
|
98
|
+
:id, :checkout_type_id, :checkout_limit, :checkout_period, :checkout_renewal_limit,
|
99
|
+
:reservation_limit, :reservation_expired_period, :set_due_date_before_closing_day,
|
100
|
+
]},
|
97
101
|
)
|
98
102
|
end
|
99
103
|
|
@@ -17,7 +17,7 @@ class UserImportFilesController < ApplicationController
|
|
17
17
|
# GET /user_import_files/1.json
|
18
18
|
def show
|
19
19
|
if @user_import_file.user_import.path
|
20
|
-
unless
|
20
|
+
unless ENV['ENJU_STORAGE'] == 's3'
|
21
21
|
file = @user_import_file.user_import.path
|
22
22
|
end
|
23
23
|
end
|
@@ -26,7 +26,7 @@ class UserImportFilesController < ApplicationController
|
|
26
26
|
format.html # show.html.erb
|
27
27
|
format.json { render json: @user_import_file }
|
28
28
|
format.download {
|
29
|
-
if
|
29
|
+
if ENV['ENJU_STORAGE'] == 's3'
|
30
30
|
redirect_to @user_import_file.user_import.expiring_url(10)
|
31
31
|
else
|
32
32
|
send_file file, filename: @user_import_file.user_import_file_name, type: 'application/octet-stream'
|
data/app/models/profile.rb
CHANGED
@@ -71,14 +71,19 @@ end
|
|
71
71
|
# user_id :integer
|
72
72
|
# user_group_id :integer
|
73
73
|
# library_id :integer
|
74
|
-
# locale :string
|
75
|
-
# user_number :string
|
74
|
+
# locale :string
|
75
|
+
# user_number :string
|
76
76
|
# full_name :text
|
77
77
|
# note :text
|
78
78
|
# keyword_list :text
|
79
79
|
# required_role_id :integer
|
80
|
-
# created_at :datetime
|
81
|
-
# updated_at :datetime
|
82
|
-
# checkout_icalendar_token :string
|
80
|
+
# created_at :datetime
|
81
|
+
# updated_at :datetime
|
82
|
+
# checkout_icalendar_token :string
|
83
83
|
# save_checkout_history :boolean default(FALSE), not null
|
84
|
+
# expired_at :datetime
|
85
|
+
# save_search_history :boolean
|
86
|
+
# share_bookmarks :boolean
|
87
|
+
# full_name_transcription :text
|
88
|
+
# date_of_birth :datetime
|
84
89
|
#
|
data/app/models/role.rb
CHANGED
@@ -2,9 +2,15 @@ class UserExportFile < ActiveRecord::Base
|
|
2
2
|
include Statesman::Adapters::ActiveRecordQueries
|
3
3
|
include ExportFile
|
4
4
|
enju_export_file_model
|
5
|
-
|
5
|
+
|
6
|
+
if ENV['ENJU_STORAGE'] == 's3'
|
6
7
|
has_attached_file :user_export, storage: :s3,
|
7
|
-
s3_credentials:
|
8
|
+
s3_credentials: {
|
9
|
+
access_key: ENV['AWS_ACCESS_KEY_ID'],
|
10
|
+
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
11
|
+
bucket: ENV['S3_BUCKET_NAME'],
|
12
|
+
s3_host_name: ENV['S3_HOST_NAME']
|
13
|
+
},
|
8
14
|
s3_permissions: :private
|
9
15
|
else
|
10
16
|
has_attached_file :user_export,
|
@@ -51,13 +57,12 @@ end
|
|
51
57
|
#
|
52
58
|
# Table name: user_export_files
|
53
59
|
#
|
54
|
-
# id
|
55
|
-
# user_id
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
# updated_at :datetime not null
|
60
|
+
# id :integer not null, primary key
|
61
|
+
# user_id :integer
|
62
|
+
# executed_at :datetime
|
63
|
+
# created_at :datetime
|
64
|
+
# updated_at :datetime
|
65
|
+
# user_export_id :string
|
66
|
+
# user_export_size :integer
|
67
|
+
# user_import_filename :string
|
63
68
|
#
|
@@ -11,10 +11,10 @@ end
|
|
11
11
|
# Table name: user_export_file_transitions
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
|
-
# to_state :string
|
15
|
-
# metadata :text default(
|
14
|
+
# to_state :string
|
15
|
+
# metadata :text default({})
|
16
16
|
# sort_key :integer
|
17
17
|
# user_export_file_id :integer
|
18
|
-
# created_at :datetime
|
19
|
-
# updated_at :datetime
|
18
|
+
# created_at :datetime
|
19
|
+
# updated_at :datetime
|
20
20
|
#
|
data/app/models/user_group.rb
CHANGED
@@ -18,12 +18,12 @@ end
|
|
18
18
|
# Table name: user_groups
|
19
19
|
#
|
20
20
|
# id :integer not null, primary key
|
21
|
-
# name :string
|
21
|
+
# name :string
|
22
22
|
# display_name :text
|
23
23
|
# note :text
|
24
24
|
# position :integer
|
25
|
-
# created_at :datetime
|
26
|
-
# updated_at :datetime
|
25
|
+
# created_at :datetime
|
26
|
+
# updated_at :datetime
|
27
27
|
# deleted_at :datetime
|
28
28
|
# valid_period_for_new_user :integer default(0), not null
|
29
29
|
# expired_at :datetime
|
data/app/models/user_has_role.rb
CHANGED
@@ -5,9 +5,14 @@ class UserImportFile < ActiveRecord::Base
|
|
5
5
|
scope :not_imported, -> { in_state(:pending) }
|
6
6
|
scope :stucked, -> { in_state(:pending).where('user_import_files.created_at < ?', 1.hour.ago) }
|
7
7
|
|
8
|
-
if
|
8
|
+
if ENV['ENJU_STORAGE'] == 's3'
|
9
9
|
has_attached_file :user_import, storage: :s3,
|
10
|
-
s3_credentials:
|
10
|
+
s3_credentials: {
|
11
|
+
access_key: ENV['AWS_ACCESS_KEY_ID'],
|
12
|
+
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
13
|
+
bucket: ENV['S3_BUCKET_NAME'],
|
14
|
+
s3_host_name: ENV['S3_HOST_NAME']
|
15
|
+
},
|
11
16
|
s3_permissions: :private
|
12
17
|
else
|
13
18
|
has_attached_file :user_import,
|
@@ -92,6 +97,8 @@ class UserImportFile < ActiveRecord::Base
|
|
92
97
|
num[:failed] += 1
|
93
98
|
end
|
94
99
|
else
|
100
|
+
import_result.error_message = new_user.errors.full_messages.join("\n")
|
101
|
+
import_result.save
|
95
102
|
num[:failed] += 1
|
96
103
|
end
|
97
104
|
end
|
@@ -307,16 +314,18 @@ end
|
|
307
314
|
# user_id :integer
|
308
315
|
# note :text
|
309
316
|
# executed_at :datetime
|
310
|
-
# user_import_file_name :string
|
311
|
-
# user_import_content_type :string
|
312
|
-
# user_import_file_size :
|
317
|
+
# user_import_file_name :string
|
318
|
+
# user_import_content_type :string
|
319
|
+
# user_import_file_size :integer
|
313
320
|
# user_import_updated_at :datetime
|
314
|
-
# user_import_fingerprint :string
|
315
|
-
# edit_mode :string
|
321
|
+
# user_import_fingerprint :string
|
322
|
+
# edit_mode :string
|
316
323
|
# error_message :text
|
317
|
-
# created_at :datetime
|
318
|
-
# updated_at :datetime
|
319
|
-
# user_encoding :string
|
324
|
+
# created_at :datetime
|
325
|
+
# updated_at :datetime
|
326
|
+
# user_encoding :string
|
320
327
|
# default_library_id :integer
|
321
328
|
# default_user_group_id :integer
|
329
|
+
# user_import_id :string
|
330
|
+
# user_import_size :integer
|
322
331
|
#
|
@@ -11,10 +11,10 @@ end
|
|
11
11
|
# Table name: user_import_file_transitions
|
12
12
|
#
|
13
13
|
# id :integer not null, primary key
|
14
|
-
# to_state :string
|
15
|
-
# metadata :text default(
|
14
|
+
# to_state :string
|
15
|
+
# metadata :text default({})
|
16
16
|
# sort_key :integer
|
17
17
|
# user_import_file_id :integer
|
18
|
-
# created_at :datetime
|
19
|
-
# updated_at :datetime
|
18
|
+
# created_at :datetime
|
19
|
+
# updated_at :datetime
|
20
20
|
#
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<%= auto_discovery_link_tag(:atom, news_posts_url(format: :atom, locale: @locale), title: (t('news_post.library_group_news_post', library_group_name: @library_group.display_name.localize) + " (Atom)")) %>
|
13
13
|
<% end %>
|
14
14
|
<% end %>
|
15
|
-
<%= book_jacket_header(
|
15
|
+
<%= book_jacket_header(@library_group.settings[:book_jacket_source]) %>
|
16
16
|
<% if controller.controller_name == 'page' %>
|
17
17
|
<%= render 'page/portlets' %>
|
18
18
|
<% end %>
|
@@ -125,8 +125,8 @@
|
|
125
125
|
<% if defined?(EnjuSearchLog) %>
|
126
126
|
<li><%= link_to t('activerecord.models.search_history'), search_histories_path %></li>
|
127
127
|
<% end %>
|
128
|
-
<% if
|
129
|
-
<li><%= link_to t('page.electronic_resource_management'),
|
128
|
+
<% if @library_group.settings[:erms_url] %>
|
129
|
+
<li><%= link_to t('page.electronic_resource_management'), @library_group.settings[:erms_url] -%></li>
|
130
130
|
<% end %>
|
131
131
|
<li><%= link_to t('page.configuration'), page_configuration_path -%></li>
|
132
132
|
<% else %>
|
@@ -4,6 +4,14 @@
|
|
4
4
|
|
5
5
|
<%= form_tag({controller: 'manifestations'}, {method: 'get'}) do -%>
|
6
6
|
<table style="width: 100%">
|
7
|
+
<tr>
|
8
|
+
<td><%= label_tag :library_adv, t('activerecord.models.library') %>:</td>
|
9
|
+
<td>
|
10
|
+
<% @libraries.sort_by{|l| l.position }.each do |library| %>
|
11
|
+
<label><%= check_box_tag "library_adv[]", library.name %><%= library.display_name.localize %></label>
|
12
|
+
<% end %>
|
13
|
+
</td>
|
14
|
+
</tr>
|
7
15
|
<tr>
|
8
16
|
<td><%= label_tag :query, t('page.search_term') -%>:</td>
|
9
17
|
<td><%= search_field_tag 'query', nil, class: 'search_form_short', placeholder: t('page.search_term') -%></td>
|
@@ -34,6 +42,10 @@
|
|
34
42
|
<td><label><%= t('activerecord.attributes.manifestation.issn') -%>:</label></td>
|
35
43
|
<td><%= text_field_tag 'issn' -%></td>
|
36
44
|
</tr>
|
45
|
+
<tr>
|
46
|
+
<td><label><%= t('activerecord.attributes.item.call_number') %>:</label></td>
|
47
|
+
<td><%= text_field_tag 'call_number' %></td>
|
48
|
+
</tr>
|
37
49
|
<tr>
|
38
50
|
<td><label><%= t('activerecord.attributes.item.item_identifier') -%>:</label></td>
|
39
51
|
<td><%= text_field_tag 'item_identifier' -%></td>
|
data/lib/enju_leaf.rb
CHANGED
@@ -4,7 +4,6 @@ require "enju_leaf/controller"
|
|
4
4
|
require "enju_leaf/user"
|
5
5
|
require "enju_leaf/helper"
|
6
6
|
require "enju_leaf/calculate_stat"
|
7
|
-
require "enju_leaf/calculate_stat"
|
8
7
|
require "enju_leaf/import_file"
|
9
8
|
require "enju_leaf/export_file"
|
10
9
|
require "enju_leaf/localized_name"
|
@@ -72,8 +71,8 @@ module EnjuLeaf
|
|
72
71
|
return if performed?
|
73
72
|
#flash[:notice] = t('page.connection_failed')
|
74
73
|
respond_to do |format|
|
75
|
-
format.html {render file: "#{Rails.root
|
76
|
-
format.mobile {render file: "#{Rails.root
|
74
|
+
format.html {render file: "#{Rails.root}/public/500", layout: false, status: 500}
|
75
|
+
format.mobile {render file: "#{Rails.root}/public/500", layout: false, status: 500}
|
77
76
|
format.xml {render template: 'page/500', status: 500}
|
78
77
|
format.json { render text: '{"error": "server_error"}' }
|
79
78
|
format.xml {render template: 'page/500.xml', status: 500}
|
@@ -138,7 +137,7 @@ module EnjuLeaf
|
|
138
137
|
def convert_charset
|
139
138
|
case params[:format]
|
140
139
|
when 'csv'
|
141
|
-
return unless
|
140
|
+
return unless LibraryGroup.site_config.settings[:csv_charset_conversion]
|
142
141
|
# TODO: 他の言語
|
143
142
|
if @locale.to_sym == :ja
|
144
143
|
headers["Content-Type"] = "text/csv; charset=Shift_JIS"
|
@@ -214,8 +213,8 @@ module EnjuLeaf
|
|
214
213
|
|
215
214
|
def get_top_page_content
|
216
215
|
if defined?(EnjuNews)
|
217
|
-
@news_feeds = Rails.cache.fetch('news_feed_all'){NewsFeed.
|
218
|
-
@news_posts = NewsPost.limit(
|
216
|
+
@news_feeds = Rails.cache.fetch('news_feed_all'){NewsFeed.order(:position)}
|
217
|
+
@news_posts = NewsPost.limit(LibraryGroup.site_config.settings[:news_post_number_top_page] || 10)
|
219
218
|
end
|
220
219
|
@libraries = Library.real
|
221
220
|
end
|
@@ -28,10 +28,10 @@ module CalculateStat
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def send_message
|
31
|
-
sender = User.find(1) #
|
31
|
+
sender = User.find(1) #system
|
32
32
|
message_template = MessageTemplate.localized_template('counting_completed', user.profile.locale)
|
33
33
|
request = MessageRequest.new
|
34
|
-
request.assign_attributes({:
|
34
|
+
request.assign_attributes({sender: sender, receiver: user, message_template: message_template})
|
35
35
|
request.save_message_body
|
36
36
|
request.transition_to!(:sent)
|
37
37
|
end
|
data/lib/enju_leaf/engine.rb
CHANGED
@@ -7,12 +7,11 @@ require 'friendly_id'
|
|
7
7
|
require 'addressable/uri'
|
8
8
|
require 'sunspot_rails'
|
9
9
|
require 'resque/server'
|
10
|
-
require 'settingslogic'
|
11
10
|
require 'nested_form'
|
12
11
|
require 'enju_biblio'
|
13
12
|
require 'enju_library'
|
14
13
|
require 'enju_manifestation_viewer'
|
15
|
-
require '
|
14
|
+
require 'kramdown'
|
16
15
|
require 'mobylette'
|
17
16
|
require 'rails_autolink'
|
18
17
|
require 'devise-encryptable'
|