enju_bookmark 0.0.15 → 0.0.16
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.
- data/app/models/bookmark.rb +7 -4
- data/lib/enju_bookmark/version.rb +1 -1
- data/spec/dummy/app/models/item.rb +4 -0
- data/spec/dummy/app/models/item_has_use_restriction.rb +27 -0
- data/spec/dummy/app/models/use_restriction.rb +22 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/fixtures/languages.yml +4 -4
- metadata +6 -2
data/app/models/bookmark.rb
CHANGED
@@ -162,16 +162,19 @@ class Bookmark < ActiveRecord::Base
|
|
162
162
|
Manifestation.transaction do
|
163
163
|
manifestation.save
|
164
164
|
self.manifestation = manifestation
|
165
|
-
item = Item.
|
166
|
-
:shelf => Shelf.web,
|
165
|
+
item = Item.new(
|
167
166
|
:manifestation_id => manifestation.id
|
168
167
|
)
|
168
|
+
item.shelf = Shelf.web
|
169
|
+
item.manifestation = manifestation
|
169
170
|
if defined?(EnjuCirculation)
|
170
171
|
item.circulation_status = CirculationStatus.where(:name => 'Not Available').first
|
171
|
-
item.use_restriction = UseRestriction.where(:name => 'Not For Loan').first
|
172
172
|
end
|
173
|
-
|
173
|
+
|
174
174
|
item.save!
|
175
|
+
if defined?(EnjuCirculation)
|
176
|
+
item.use_restriction = UseRestriction.where(:name => 'Not For Loan').first
|
177
|
+
end
|
175
178
|
end
|
176
179
|
end
|
177
180
|
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
class Item < ActiveRecord::Base
|
3
|
+
attr_accessible :call_number, :item_identifier, :circulation_status_id,
|
4
|
+
:checkout_type_id, :shelf_id, :include_supplements, :note, :url, :price,
|
5
|
+
:acquired_at, :bookstore_id, :missing_since, :budget_type_id,
|
6
|
+
:manifestation_id #,:exemplify_attributes
|
3
7
|
scope :on_shelf, where('shelf_id != 1')
|
4
8
|
scope :on_web, where(:shelf_id => 1)
|
5
9
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class ItemHasUseRestriction < ActiveRecord::Base
|
2
|
+
attr_accessible
|
3
|
+
attr_accessible :item_id, :use_restriction_id, :as => :admin
|
4
|
+
belongs_to :item, :validate => true
|
5
|
+
belongs_to :use_restriction, :validate => true
|
6
|
+
accepts_nested_attributes_for :use_restriction
|
7
|
+
|
8
|
+
validates_associated :item, :use_restriction
|
9
|
+
validates_presence_of :use_restriction
|
10
|
+
validates_presence_of :item, :on => :update
|
11
|
+
|
12
|
+
def self.per_page
|
13
|
+
10
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# == Schema Information
|
18
|
+
#
|
19
|
+
# Table name: item_has_use_restrictions
|
20
|
+
#
|
21
|
+
# id :integer not null, primary key
|
22
|
+
# item_id :integer not null
|
23
|
+
# use_restriction_id :integer not null
|
24
|
+
# created_at :datetime
|
25
|
+
# updated_at :datetime
|
26
|
+
#
|
27
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class UseRestriction < ActiveRecord::Base
|
2
|
+
attr_accessible :name, :display_name, :note
|
3
|
+
include MasterModel
|
4
|
+
default_scope :order => 'use_restrictions.position'
|
5
|
+
scope :available, where(:name => ['Not For Loan', 'Limited Circulation, Normal Loan Period'])
|
6
|
+
has_many :item_has_use_restrictions
|
7
|
+
has_many :items, :through => :item_has_use_restrictions
|
8
|
+
end
|
9
|
+
|
10
|
+
# == Schema Information
|
11
|
+
#
|
12
|
+
# Table name: use_restrictions
|
13
|
+
#
|
14
|
+
# id :integer not null, primary key
|
15
|
+
# name :string(255) not null
|
16
|
+
# display_name :text
|
17
|
+
# note :text
|
18
|
+
# position :integer
|
19
|
+
# created_at :datetime
|
20
|
+
# updated_at :datetime
|
21
|
+
#
|
22
|
+
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/spec/fixtures/languages.yml
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
language_00001:
|
3
3
|
position: 1
|
4
4
|
name: unknown
|
5
|
-
display_name: "en:unknown\r\n\
|
6
|
-
ja
|
5
|
+
display_name: "en :unknown\r\n\
|
6
|
+
ja: 不明"
|
7
7
|
iso_639_1: unknown
|
8
8
|
iso_639_2: unknown
|
9
9
|
iso_639_3: unknown
|
@@ -1355,8 +1355,8 @@ language_00160:
|
|
1355
1355
|
language_00077:
|
1356
1356
|
position: 77
|
1357
1357
|
name: Japanese
|
1358
|
-
display_name: "en:Japanese\r\n\
|
1359
|
-
ja
|
1358
|
+
display_name: "en: Japanese\r\n\
|
1359
|
+
ja: 日本語"
|
1360
1360
|
iso_639_1: ja
|
1361
1361
|
iso_639_2: jpn
|
1362
1362
|
iso_639_3: jpn
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_bookmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -343,6 +343,7 @@ files:
|
|
343
343
|
- spec/dummy/app/models/circulation_status.rb
|
344
344
|
- spec/dummy/app/models/exemplify.rb
|
345
345
|
- spec/dummy/app/models/item.rb
|
346
|
+
- spec/dummy/app/models/item_has_use_restriction.rb
|
346
347
|
- spec/dummy/app/models/language.rb
|
347
348
|
- spec/dummy/app/models/library.rb
|
348
349
|
- spec/dummy/app/models/library_group.rb
|
@@ -353,6 +354,7 @@ files:
|
|
353
354
|
- spec/dummy/app/models/series_has_manifestation.rb
|
354
355
|
- spec/dummy/app/models/series_statement.rb
|
355
356
|
- spec/dummy/app/models/shelf.rb
|
357
|
+
- spec/dummy/app/models/use_restriction.rb
|
356
358
|
- spec/dummy/app/models/user.rb
|
357
359
|
- spec/dummy/app/models/user_group.rb
|
358
360
|
- spec/dummy/app/models/user_has_role.rb
|
@@ -527,6 +529,7 @@ test_files:
|
|
527
529
|
- spec/dummy/app/models/circulation_status.rb
|
528
530
|
- spec/dummy/app/models/exemplify.rb
|
529
531
|
- spec/dummy/app/models/item.rb
|
532
|
+
- spec/dummy/app/models/item_has_use_restriction.rb
|
530
533
|
- spec/dummy/app/models/language.rb
|
531
534
|
- spec/dummy/app/models/library.rb
|
532
535
|
- spec/dummy/app/models/library_group.rb
|
@@ -537,6 +540,7 @@ test_files:
|
|
537
540
|
- spec/dummy/app/models/series_has_manifestation.rb
|
538
541
|
- spec/dummy/app/models/series_statement.rb
|
539
542
|
- spec/dummy/app/models/shelf.rb
|
543
|
+
- spec/dummy/app/models/use_restriction.rb
|
540
544
|
- spec/dummy/app/models/user.rb
|
541
545
|
- spec/dummy/app/models/user_group.rb
|
542
546
|
- spec/dummy/app/models/user_has_role.rb
|