enju_biblio 0.1.0.pre67 → 0.1.0.pre68
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/items_controller.rb +1 -1
- data/app/controllers/resource_import_files_controller.rb +1 -2
- data/app/helpers/manifestations_helper.rb +4 -4
- data/app/models/enju_biblio/ability.rb +9 -5
- data/app/models/resource_import_file.rb +2 -0
- data/config/locales/translation_ja.yml +3 -3
- data/lib/enju_biblio/version.rb +1 -1
- data/spec/controllers/items_controller_spec.rb +11 -0
- data/spec/controllers/resource_import_files_controller_spec.rb +11 -4
- data/spec/fixtures/resource_import_files.yml +1 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5e83fab1fdd340daddda0555c8efc9e70f7b2c9
|
4
|
+
data.tar.gz: f5c958e7086cc3df0076b2f815740333063b18ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93439c42241d75567e91f6405733e5f32211f83abaf172472e731d3485826f25c9afa7df55bf3f2f47c92aaf546e8994d86608a02103f46b965ebc4adb093fb3
|
7
|
+
data.tar.gz: 2df19cbe086954c6ea6abe8c0218f9d81e90cf5bfc11c8233d687822ef05d3316836db66cc3c62cc50d03a46d7c9a5980b0389736595f6a8b6724e654e5871df
|
@@ -272,7 +272,7 @@ class ItemsController < ApplicationController
|
|
272
272
|
else
|
273
273
|
@library = @item.shelf.library
|
274
274
|
end
|
275
|
-
@shelves = @library.shelves
|
275
|
+
@shelves = @library.try(:shelves)
|
276
276
|
@bookstores = Bookstore.all
|
277
277
|
@budget_types = BudgetType.all
|
278
278
|
@roles = Role.all
|
@@ -40,7 +40,6 @@ class ResourceImportFilesController < ApplicationController
|
|
40
40
|
def new
|
41
41
|
@resource_import_file = ResourceImportFile.new
|
42
42
|
@resource_import_file.library_id = current_user.profile.library_id
|
43
|
-
@shelves = Library.find(@resource_import_file.library_id).shelves
|
44
43
|
|
45
44
|
respond_to do |format|
|
46
45
|
format.html # new.html.erb
|
@@ -116,7 +115,7 @@ class ResourceImportFilesController < ApplicationController
|
|
116
115
|
if library
|
117
116
|
@shelves = library.shelves
|
118
117
|
else
|
119
|
-
@shelves = current_user.profile.library.shelves
|
118
|
+
@shelves = current_user.profile.library.try(:shelves)
|
120
119
|
end
|
121
120
|
end
|
122
121
|
end
|
@@ -110,15 +110,15 @@ module ManifestationsHelper
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
def pub_year_facet(pub_date_from,
|
113
|
+
def pub_year_facet(pub_date_from, pub_date_until, facet)
|
114
114
|
string = ''
|
115
|
-
current = true if facet.value.first.to_i == pub_date_from.to_i
|
115
|
+
current = true if facet.value.first.to_i == pub_date_from.to_i and facet.value.last.to_i - 1 == pub_date_until.to_i
|
116
116
|
if current
|
117
117
|
content_tag :strong do
|
118
|
-
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(params.merge(pub_date_from: facet.value.first.to_i,
|
118
|
+
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
|
119
119
|
end
|
120
120
|
else
|
121
|
-
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(params.merge(pub_date_from: facet.value.first.to_i,
|
121
|
+
link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -59,14 +59,18 @@ module EnjuBiblio
|
|
59
59
|
SeriesStatementMergeList
|
60
60
|
]
|
61
61
|
can :manage, [
|
62
|
-
|
62
|
+
AgentType,
|
63
63
|
Country,
|
64
|
-
Frequency,
|
65
64
|
Language,
|
66
65
|
License,
|
67
|
-
MediumOfPerformance
|
68
|
-
|
69
|
-
|
66
|
+
MediumOfPerformance
|
67
|
+
]
|
68
|
+
can :manage, [
|
69
|
+
ContentType,
|
70
|
+
Frequency
|
71
|
+
] do |record|
|
72
|
+
record.manifestations.empty?
|
73
|
+
end if LibraryGroup.site_config.network_access_allowed?(ip_address)
|
70
74
|
can :read, [
|
71
75
|
CarrierType,
|
72
76
|
ContentType,
|
@@ -27,6 +27,8 @@ class ResourceImportFile < ActiveRecord::Base
|
|
27
27
|
'application/vnd.ms-excel'
|
28
28
|
]
|
29
29
|
validates_attachment_presence :resource_import
|
30
|
+
validates :resource_import, presence: true, on: :create
|
31
|
+
validates :default_shelf_id, presence: true, if: Proc.new{|model| model.edit_mode == 'create'}
|
30
32
|
belongs_to :user, validate: true
|
31
33
|
belongs_to :default_shelf, class_name: 'Shelf'
|
32
34
|
has_many :resource_import_results
|
@@ -185,7 +185,7 @@ ja:
|
|
185
185
|
edit_mode: 編集モード
|
186
186
|
error_message: エラーメッセージ
|
187
187
|
user_encoding: 文字コード
|
188
|
-
default_shelf_id:
|
188
|
+
default_shelf_id: 既定の本棚
|
189
189
|
series_statement:
|
190
190
|
original_title: シリーズ名
|
191
191
|
numbering: シリーズ番号
|
@@ -334,7 +334,7 @@ ja:
|
|
334
334
|
|
335
335
|
resource_import_file:
|
336
336
|
update_relationship: 関連を更新
|
337
|
-
default_shelf: TSVファイルで"shelf"
|
337
|
+
default_shelf: TSVファイルで"shelf"列が指定されていない場合、この本棚が登録されます。
|
338
338
|
|
339
339
|
agent:
|
340
340
|
creator: 著者
|
@@ -400,7 +400,7 @@ ja:
|
|
400
400
|
add: "所蔵情報を追加する"
|
401
401
|
specify_manifestation: "資料を指定してください。"
|
402
402
|
this_item_is_reserved: "この資料は予約されています!"
|
403
|
-
create_shelf_first: "
|
403
|
+
create_shelf_first: "最初に本棚を作成してください。"
|
404
404
|
this_item_include_supplement: "この資料は付録を含んでいます。"
|
405
405
|
all_item: "全ての所蔵情報"
|
406
406
|
add_new_copy: "複本を追加"
|
data/lib/enju_biblio/version.rb
CHANGED
@@ -152,6 +152,17 @@ describe ItemsController do
|
|
152
152
|
get :new
|
153
153
|
expect(response).to redirect_to(manifestations_url)
|
154
154
|
end
|
155
|
+
|
156
|
+
it "should work without exception, even if library and shelf is unavailable" do
|
157
|
+
Library.real.each do |library|
|
158
|
+
library.try(:shelves).to_a.each do |shelf|
|
159
|
+
shelf.destroy
|
160
|
+
end
|
161
|
+
library.destroy
|
162
|
+
end
|
163
|
+
get :new, :manifestation_id => @manifestation.id
|
164
|
+
expect(response).to redirect_to(libraries_url)
|
165
|
+
end
|
155
166
|
end
|
156
167
|
|
157
168
|
describe "When logged in as Librarian" do
|
@@ -124,21 +124,28 @@ describe ResourceImportFilesController do
|
|
124
124
|
describe "POST create" do
|
125
125
|
describe "When logged in as Librarian" do
|
126
126
|
before(:each) do
|
127
|
-
@user =
|
127
|
+
@user = users(:librarian1)
|
128
128
|
sign_in @user
|
129
129
|
end
|
130
130
|
|
131
|
-
it "should create
|
132
|
-
post :create, :resource_import_file => {:resource_import => fixture_file_upload("/../../examples/resource_import_file_sample1.tsv", 'text/csv') }
|
131
|
+
it "should create resource_import_file" do
|
132
|
+
post :create, :resource_import_file => {:resource_import => fixture_file_upload("/../../examples/resource_import_file_sample1.tsv", 'text/csv'), edit_mode: 'create', default_shelf_id: 1 }
|
133
133
|
expect(assigns(:resource_import_file)).to be_valid
|
134
134
|
assigns(:resource_import_file).user.username.should eq @user.username
|
135
135
|
expect(response).to redirect_to resource_import_file_url(assigns(:resource_import_file))
|
136
136
|
end
|
137
|
+
|
138
|
+
it "should not create resource_import_file without default_shelf_id" do
|
139
|
+
post :create, :resource_import_file => {:resource_import => fixture_file_upload("/../../examples/resource_import_file_sample1.tsv", 'text/csv'), edit_mode: 'create'}
|
140
|
+
expect(assigns(:resource_import_file)).not_to be_valid
|
141
|
+
assigns(:resource_import_file).user.username.should eq @user.username
|
142
|
+
expect(response).to be_success
|
143
|
+
end
|
137
144
|
end
|
138
145
|
|
139
146
|
describe "When logged in as User" do
|
140
147
|
before(:each) do
|
141
|
-
@user =
|
148
|
+
@user = users(:user1)
|
142
149
|
sign_in @user
|
143
150
|
end
|
144
151
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_biblio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre68
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosuke Tanabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paperclip
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '4.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '4.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: jc-validates_timeliness
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -310,14 +310,14 @@ dependencies:
|
|
310
310
|
requirements:
|
311
311
|
- - "~>"
|
312
312
|
- !ruby/object:Gem::Version
|
313
|
-
version: 0.1.0.
|
313
|
+
version: 0.1.0.pre33
|
314
314
|
type: :development
|
315
315
|
prerelease: false
|
316
316
|
version_requirements: !ruby/object:Gem::Requirement
|
317
317
|
requirements:
|
318
318
|
- - "~>"
|
319
319
|
- !ruby/object:Gem::Version
|
320
|
-
version: 0.1.0.
|
320
|
+
version: 0.1.0.pre33
|
321
321
|
- !ruby/object:Gem::Dependency
|
322
322
|
name: enju_inventory
|
323
323
|
requirement: !ruby/object:Gem::Requirement
|
@@ -380,14 +380,14 @@ dependencies:
|
|
380
380
|
requirements:
|
381
381
|
- - "~>"
|
382
382
|
- !ruby/object:Gem::Version
|
383
|
-
version: 0.1.0.
|
383
|
+
version: 0.1.0.pre47
|
384
384
|
type: :development
|
385
385
|
prerelease: false
|
386
386
|
version_requirements: !ruby/object:Gem::Requirement
|
387
387
|
requirements:
|
388
388
|
- - "~>"
|
389
389
|
- !ruby/object:Gem::Version
|
390
|
-
version: 0.1.0.
|
390
|
+
version: 0.1.0.pre47
|
391
391
|
- !ruby/object:Gem::Dependency
|
392
392
|
name: enju_ndl
|
393
393
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1475,7 +1475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1475
1475
|
version: 1.3.1
|
1476
1476
|
requirements: []
|
1477
1477
|
rubyforge_project:
|
1478
|
-
rubygems_version: 2.4.5
|
1478
|
+
rubygems_version: 2.4.5.1
|
1479
1479
|
signing_key:
|
1480
1480
|
specification_version: 4
|
1481
1481
|
summary: enju_biblio plugin
|