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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7e9faf90d23891338d7804ceaa2b86045886e6c
4
- data.tar.gz: 8a9bb0d6a8085690f585ccbc6e45cbf677bacd1a
3
+ metadata.gz: d5e83fab1fdd340daddda0555c8efc9e70f7b2c9
4
+ data.tar.gz: f5c958e7086cc3df0076b2f815740333063b18ad
5
5
  SHA512:
6
- metadata.gz: 55176d5e1130eee8b75c8efd03f42a98178ea342562972387edf4a46571581518fa93aa136809f29d6458709f16b4b14e62f398552dbf6c62d0eaa60e72b3875
7
- data.tar.gz: 2f560a2ada3c29ccabb09cce58a823d33ea36ff2cb5c3c383a64b510fe46ffe03c5c4e0b037613191029ef283787b01dd915308a8871ffab557d937e7b24f257
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, pub_date_to, facet)
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 && facet.value.last.to_i - 1 == pub_date_to.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, pub_date_to: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
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, pub_date_to: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
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
- ContentType,
62
+ AgentType,
63
63
  Country,
64
- Frequency,
65
64
  Language,
66
65
  License,
67
- MediumOfPerformance,
68
- AgentType
69
- ] if LibraryGroup.site_config.network_access_allowed?(ip_address)
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: "複本を追加"
@@ -1,3 +1,3 @@
1
1
  module EnjuBiblio
2
- VERSION = "0.1.0.pre67"
2
+ VERSION = "0.1.0.pre68"
3
3
  end
@@ -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 = FactoryGirl.create(:librarian)
127
+ @user = users(:librarian1)
128
128
  sign_in @user
129
129
  end
130
130
 
131
- it "should create agent_import_file" do
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 = FactoryGirl.create(:user)
148
+ @user = users(:user1)
142
149
  sign_in @user
143
150
  end
144
151
 
@@ -18,6 +18,7 @@ resource_import_file_00003:
18
18
  resource_import_file_size: 1
19
19
  user_id: 1
20
20
  resource_import_content_type: text/csv
21
+ default_shelf_id: 1
21
22
 
22
23
  # == Schema Information
23
24
  #
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.pre67
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-06-28 00:00:00.000000000 Z
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: '3.0'
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: '3.0'
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.pre31
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.pre31
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.pre46
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.pre46
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