enju_library 0.1.0.pre11 → 0.1.0.pre12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/enju_library/ability.rb +68 -0
- data/app/views/library_groups/_form.html.erb +1 -1
- data/app/views/library_groups/show.html.erb +5 -0
- data/config/locales/{en.yml → translation_en.yml} +1 -0
- data/config/locales/{ja.yml → translation_ja.yml} +1 -0
- data/lib/enju_library/item.rb +39 -0
- data/lib/enju_library/version.rb +1 -1
- data/lib/enju_library.rb +2 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/{_1n.fdt → _3b.fdt} +0 -0
- data/spec/dummy/solr/data/test/index/{_1n.fdx → _3b.fdx} +0 -0
- data/spec/dummy/solr/data/test/index/{_1n.fnm → _3b.fnm} +0 -0
- data/spec/dummy/solr/data/test/index/{_1n.frq → _3b.frq} +0 -0
- data/spec/dummy/solr/data/test/index/{_1n.nrm → _3b.nrm} +0 -0
- data/spec/dummy/solr/data/test/index/{_1n.prx → _3b.prx} +0 -0
- data/spec/dummy/solr/data/test/index/{_1n.tii → _3b.tii} +0 -0
- data/spec/dummy/solr/data/test/index/_3b.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/{segments_3x → segments_7t} +0 -0
- metadata +28 -26
- data/spec/dummy/solr/data/test/index/_1n.tis +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a3ef9da22975202b557d2becaaf3147de2d76d9
|
4
|
+
data.tar.gz: ee7bb96dc1bf7c80cafdc9d4ef7b8041c3b551f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e9357bf1c2be74b050661ec02725aff65f8573d85eedc69bb24c1b66a536930ab22d36ce5f9aecf67010a355d12a80c232611f3cfa9bd525c02742e7d18f0e5
|
7
|
+
data.tar.gz: 69f69e69b573b95f119011a35f57ddf720ee758826d695616f72e8e45ead8bd4948fcb50dd68f260f04e8fb1bc988f43e8a49999cc9a6a2ed6402542259d7773
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module EnjuLibrary
|
2
|
+
class Ability
|
3
|
+
include CanCan::Ability
|
4
|
+
|
5
|
+
def initialize(user, ip_address = nil)
|
6
|
+
case user.try(:role).try(:name)
|
7
|
+
when 'Administrator'
|
8
|
+
can [:read, :create, :update], Bookstore
|
9
|
+
can :destroy, Bookstore do |bookstore|
|
10
|
+
bookstore.items.empty?
|
11
|
+
end
|
12
|
+
can [:read, :create, :update], Library
|
13
|
+
can :destroy, Library do |library|
|
14
|
+
library.shelves.empty? and !library.web?
|
15
|
+
end
|
16
|
+
can [:read, :create, :update], Shelf
|
17
|
+
can :destroy, Shelf do |shelf|
|
18
|
+
shelf.items.empty?
|
19
|
+
end
|
20
|
+
can :manage, [
|
21
|
+
Accept,
|
22
|
+
BudgetType,
|
23
|
+
SearchEngine,
|
24
|
+
Subscribe,
|
25
|
+
Subscription
|
26
|
+
]
|
27
|
+
can :update, [
|
28
|
+
LibraryGroup,
|
29
|
+
RequestStatusType,
|
30
|
+
RequestType
|
31
|
+
] if LibraryGroup.site_config.network_access_allowed?(ip_address)
|
32
|
+
can :read, [
|
33
|
+
LibraryGroup,
|
34
|
+
RequestStatusType,
|
35
|
+
RequestType
|
36
|
+
]
|
37
|
+
when 'Librarian'
|
38
|
+
can :manage, [
|
39
|
+
Accept,
|
40
|
+
Subscribe,
|
41
|
+
Subscription
|
42
|
+
]
|
43
|
+
can :read, [
|
44
|
+
Bookstore,
|
45
|
+
BudgetType,
|
46
|
+
Library,
|
47
|
+
LibraryGroup,
|
48
|
+
RequestStatusType,
|
49
|
+
RequestType,
|
50
|
+
SearchEngine,
|
51
|
+
Shelf
|
52
|
+
]
|
53
|
+
when 'User'
|
54
|
+
can :read, [
|
55
|
+
Library,
|
56
|
+
LibraryGroup,
|
57
|
+
Shelf
|
58
|
+
]
|
59
|
+
else
|
60
|
+
can :read, [
|
61
|
+
Library,
|
62
|
+
LibraryGroup,
|
63
|
+
Shelf
|
64
|
+
]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -18,6 +18,11 @@
|
|
18
18
|
<%= @library_group.email -%>
|
19
19
|
</p>
|
20
20
|
|
21
|
+
<p>
|
22
|
+
<strong><%= t('activerecord.attributes.library_group.url') -%>:</strong>
|
23
|
+
<%= @library_group.url -%>
|
24
|
+
</p>
|
25
|
+
|
21
26
|
<div>
|
22
27
|
<strong><%= t('activerecord.attributes.library_group.login_banner') -%>:</strong>
|
23
28
|
<%= markdown_helper(@library_group.login_banner) -%>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module EnjuLibrary
|
2
|
+
module LibraryItem
|
3
|
+
def self.included(base)
|
4
|
+
base.extend ClassMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def enju_library_item_model
|
9
|
+
include InstanceMethods
|
10
|
+
has_one :accept
|
11
|
+
scope :accepted_between, lambda{|from, to| includes(:accept).where('items.created_at BETWEEN ? AND ?', Time.zone.parse(from).beginning_of_day, Time.zone.parse(to).end_of_day)}
|
12
|
+
|
13
|
+
belongs_to :shelf, :counter_cache => true, :validate => true
|
14
|
+
validates_associated :shelf
|
15
|
+
|
16
|
+
searchable do
|
17
|
+
string :library do
|
18
|
+
shelf.library.name if shelf
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module InstanceMethods
|
25
|
+
def shelf_name
|
26
|
+
shelf.name
|
27
|
+
end
|
28
|
+
|
29
|
+
def hold?(library)
|
30
|
+
return true if self.shelf.library == library
|
31
|
+
false
|
32
|
+
end
|
33
|
+
|
34
|
+
def library_url
|
35
|
+
"#{LibraryGroup.site_config.url}libraries/#{self.shelf.library.name}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/enju_library/version.rb
CHANGED
data/lib/enju_library.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "enju_library/engine"
|
2
|
+
require "enju_library/item"
|
2
3
|
|
3
4
|
module EnjuLibrary
|
4
5
|
def self.included(base)
|
@@ -44,4 +45,5 @@ module EnjuLibrary
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
48
|
+
ActiveRecord::Base.send :include, EnjuLibrary::LibraryItem
|
47
49
|
ActionController::Base.send(:include, EnjuLibrary)
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_library
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.pre12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosuke Tanabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -184,14 +184,14 @@ dependencies:
|
|
184
184
|
requirements:
|
185
185
|
- - ~>
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 0.1.0.
|
187
|
+
version: 0.1.0.pre22
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version: 0.1.0.
|
194
|
+
version: 0.1.0.pre22
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: enju_event
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,14 +212,14 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - ~>
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 0.1.0.
|
215
|
+
version: 0.1.0.pre13
|
216
216
|
type: :development
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - ~>
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0.1.0.
|
222
|
+
version: 0.1.0.pre13
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: enju_inter_library_loan
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
@@ -313,6 +313,7 @@ files:
|
|
313
313
|
- app/models/basket.rb
|
314
314
|
- app/models/bookstore.rb
|
315
315
|
- app/models/budget_type.rb
|
316
|
+
- app/models/enju_library/ability.rb
|
316
317
|
- app/models/library.rb
|
317
318
|
- app/models/library_group.rb
|
318
319
|
- app/models/library_group_sweeper.rb
|
@@ -385,8 +386,8 @@ files:
|
|
385
386
|
- app/views/subscriptions/index.html.erb
|
386
387
|
- app/views/subscriptions/new.html.erb
|
387
388
|
- app/views/subscriptions/show.html.erb
|
388
|
-
- config/locales/
|
389
|
-
- config/locales/
|
389
|
+
- config/locales/translation_en.yml
|
390
|
+
- config/locales/translation_ja.yml
|
390
391
|
- config/routes.rb
|
391
392
|
- db/migrate/059_create_libraries.rb
|
392
393
|
- db/migrate/069_create_shelves.rb
|
@@ -406,6 +407,7 @@ files:
|
|
406
407
|
- db/migrate/20120319173203_create_accepts.rb
|
407
408
|
- db/migrate/20120510140958_add_closed_to_shelf.rb
|
408
409
|
- lib/enju_library/engine.rb
|
410
|
+
- lib/enju_library/item.rb
|
409
411
|
- lib/enju_library/version.rb
|
410
412
|
- lib/enju_library.rb
|
411
413
|
- lib/generators/enju_library/views_generator.rb
|
@@ -538,16 +540,16 @@ files:
|
|
538
540
|
- spec/dummy/solr/conf/spellings.txt
|
539
541
|
- spec/dummy/solr/conf/stopwords.txt
|
540
542
|
- spec/dummy/solr/conf/synonyms.txt
|
541
|
-
- spec/dummy/solr/data/test/index/
|
542
|
-
- spec/dummy/solr/data/test/index/
|
543
|
-
- spec/dummy/solr/data/test/index/
|
544
|
-
- spec/dummy/solr/data/test/index/
|
545
|
-
- spec/dummy/solr/data/test/index/
|
546
|
-
- spec/dummy/solr/data/test/index/
|
547
|
-
- spec/dummy/solr/data/test/index/
|
548
|
-
- spec/dummy/solr/data/test/index/
|
543
|
+
- spec/dummy/solr/data/test/index/_3b.fdt
|
544
|
+
- spec/dummy/solr/data/test/index/_3b.fdx
|
545
|
+
- spec/dummy/solr/data/test/index/_3b.fnm
|
546
|
+
- spec/dummy/solr/data/test/index/_3b.frq
|
547
|
+
- spec/dummy/solr/data/test/index/_3b.nrm
|
548
|
+
- spec/dummy/solr/data/test/index/_3b.prx
|
549
|
+
- spec/dummy/solr/data/test/index/_3b.tii
|
550
|
+
- spec/dummy/solr/data/test/index/_3b.tis
|
549
551
|
- spec/dummy/solr/data/test/index/segments.gen
|
550
|
-
- spec/dummy/solr/data/test/index/
|
552
|
+
- spec/dummy/solr/data/test/index/segments_7t
|
551
553
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
552
554
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
553
555
|
- spec/dummy/tmp/cache/4AD/470/country_all
|
@@ -767,16 +769,16 @@ test_files:
|
|
767
769
|
- spec/dummy/solr/conf/spellings.txt
|
768
770
|
- spec/dummy/solr/conf/stopwords.txt
|
769
771
|
- spec/dummy/solr/conf/synonyms.txt
|
770
|
-
- spec/dummy/solr/data/test/index/
|
771
|
-
- spec/dummy/solr/data/test/index/
|
772
|
-
- spec/dummy/solr/data/test/index/
|
773
|
-
- spec/dummy/solr/data/test/index/
|
774
|
-
- spec/dummy/solr/data/test/index/
|
775
|
-
- spec/dummy/solr/data/test/index/
|
776
|
-
- spec/dummy/solr/data/test/index/
|
777
|
-
- spec/dummy/solr/data/test/index/
|
772
|
+
- spec/dummy/solr/data/test/index/_3b.fdt
|
773
|
+
- spec/dummy/solr/data/test/index/_3b.fdx
|
774
|
+
- spec/dummy/solr/data/test/index/_3b.fnm
|
775
|
+
- spec/dummy/solr/data/test/index/_3b.frq
|
776
|
+
- spec/dummy/solr/data/test/index/_3b.nrm
|
777
|
+
- spec/dummy/solr/data/test/index/_3b.prx
|
778
|
+
- spec/dummy/solr/data/test/index/_3b.tii
|
779
|
+
- spec/dummy/solr/data/test/index/_3b.tis
|
778
780
|
- spec/dummy/solr/data/test/index/segments.gen
|
779
|
-
- spec/dummy/solr/data/test/index/
|
781
|
+
- spec/dummy/solr/data/test/index/segments_7t
|
780
782
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
781
783
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
782
784
|
- spec/dummy/tmp/cache/4AD/470/country_all
|
Binary file
|