enju_circulation 0.1.0.pre15 → 0.1.0.pre16

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: 9298b4e2ef205c74dd31f6f2f18521a658668dbb
4
- data.tar.gz: 26f1b41b8e6426288583dcfa44ffa9ba237934f1
3
+ metadata.gz: 7f86efed31c18ea347f1658523aab6bd370f1841
4
+ data.tar.gz: 61f456e339046fd324677c83eb51d1c87184919a
5
5
  SHA512:
6
- metadata.gz: 47af4dbdf5fd8ede360fbd02cc9a5232091a6f2a2b5c26fdb0edbdd0ed4c2a914d403c522c40db780d636350a1cb51d9fb006e2bd3de94e3f651283dace94070
7
- data.tar.gz: 8cca8e4cd1c6c9f4da75d27e412b5d80403d7b2f2deaae113acfc46427536917eebffaf84bddafa5514a25316bf82b75cf10249249342942a3e260eaa0a1e6b2
6
+ metadata.gz: 49d8ab628ce347d257b9f20eac121778fbf0a71b27087aa3aa38093519881406206a8f8744d1e387c0ad122d1087dd4c2fd0eeb70d1943da1662df84b8435991
7
+ data.tar.gz: 65f319e166213426075e0c833144bae589d1301980143ca532407ded3e60fccaa6586196b8723d82e7f66bd29a32f8029aa58429d4f371b9a8c54f8e681f2f9f
@@ -8,9 +8,6 @@ module EnjuCirculation
8
8
  can [:destroy, :delete], Manifestation do |manifestation|
9
9
  manifestation.items.empty? and !manifestation.periodical_master? and !manifestation.is_reserved?
10
10
  end
11
- can [:destroy, :delete], User do |u|
12
- u.deletable? and u != user
13
- end
14
11
  can :manage, [
15
12
  Basket,
16
13
  CarrierTypeHasCheckoutType,
@@ -46,9 +43,6 @@ module EnjuCirculation
46
43
  can [:destroy, :delete], Manifestation do |manifestation|
47
44
  manifestation.items.empty? and !manifestation.periodical_master? and !manifestation.is_reserved?
48
45
  end
49
- can [:destroy, :delete], User do |u|
50
- u.deletable? and u.role.name == 'User' and u != user
51
- end
52
46
  can :manage, [
53
47
  Basket,
54
48
  CheckedItem,
@@ -1,5 +1,5 @@
1
1
  module EnjuCirculation
2
- module Item
2
+ module EnjuItem
3
3
  def self.included(base)
4
4
  base.extend ClassMethods
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module EnjuCirculation
2
- module Manifestation
2
+ module EnjuManifestation
3
3
  def self.included(base)
4
4
  base.extend ClassMethods
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module EnjuCirculation
2
- module User
2
+ module EnjuUser
3
3
  def self.included(base)
4
4
  base.extend ClassMethods
5
5
  end
@@ -0,0 +1,20 @@
1
+ module EnjuCirculation
2
+ module EnjuUserGroup
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ def enju_circulation_user_group_model
9
+ has_many :user_group_has_checkout_types, :dependent => :destroy
10
+ has_many :checkout_types, :through => :user_group_has_checkout_types, :order => :position
11
+ has_many :lending_policies
12
+
13
+ validates_numericality_of :number_of_day_to_notify_due_date,
14
+ :number_of_day_to_notify_overdue,
15
+ :number_of_time_to_notify_overdue,
16
+ :greater_than_or_equal_to => 0
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module EnjuCirculation
2
- VERSION = "0.1.0.pre15"
2
+ VERSION = "0.1.0.pre16"
3
3
  end
@@ -2,6 +2,7 @@ require "enju_circulation/engine"
2
2
  require "enju_circulation/manifestation"
3
3
  require "enju_circulation/item"
4
4
  require "enju_circulation/user"
5
+ require "enju_circulation/user_group"
5
6
  require "enju_circulation/controller"
6
7
  require "enju_circulation/helper"
7
8
 
@@ -9,7 +10,8 @@ module EnjuCirculation
9
10
  end
10
11
 
11
12
  ActionController::Base.send :include, EnjuCirculation::Controller
12
- ActiveRecord::Base.send :include, EnjuCirculation::Manifestation
13
- ActiveRecord::Base.send :include, EnjuCirculation::Item
14
- ActiveRecord::Base.send :include, EnjuCirculation::User
13
+ ActiveRecord::Base.send :include, EnjuCirculation::EnjuManifestation
14
+ ActiveRecord::Base.send :include, EnjuCirculation::EnjuItem
15
+ ActiveRecord::Base.send :include, EnjuCirculation::EnjuUser
16
+ ActiveRecord::Base.send :include, EnjuCirculation::EnjuUserGroup
15
17
  ActionView::Base.send :include, EnjuCirculation::ManifestationsHelper
@@ -5,12 +5,9 @@
5
5
  def initialize(user, ip_address = nil)
6
6
  case user.try(:role).try(:name)
7
7
  when 'Administrator'
8
- can [:delete, :destroy], Manifestation do |manifestation|
8
+ can [:destroy, :delete], Manifestation do |manifestation|
9
9
  manifestation.items.empty? and !manifestation.periodical_master? and !manifestation.is_reserved?
10
10
  end
11
- can [:delete, :destroy], User do |u|
12
- u.deletable? and u != user
13
- end
14
11
  can :manage, [
15
12
  Basket,
16
13
  CarrierTypeHasCheckoutType,
@@ -30,7 +27,7 @@
30
27
  UserReserveStat
31
28
  ]
32
29
  can [:read, :create, :update, :remove_all], Checkout
33
- can [:delete, :destroy], Checkout do |checkout|
30
+ can [:destroy, :delete], Checkout do |checkout|
34
31
  checkout.checkin
35
32
  end
36
33
  can [:read, :update], [
@@ -38,18 +35,15 @@
38
35
  LendingPolicy,
39
36
  UseRestriction
40
37
  ]
41
- can [:delete, :destroy], LendingPolicy
38
+ can [:destroy, :delete], LendingPolicy
42
39
  can :read, [Item, Manifestation]
43
40
  when 'Librarian'
44
- can [:delete, :destroy], Item do |item|
41
+ can [:destroy, :delete], Item do |item|
45
42
  item.checkouts.not_returned.empty?
46
43
  end
47
- can [:delete, :destroy], Manifestation do |manifestation|
44
+ can [:destroy, :delete], Manifestation do |manifestation|
48
45
  manifestation.items.empty? and !manifestation.periodical_master? and !manifestation.is_reserved?
49
46
  end
50
- can [:delete, :destroy], User do |u|
51
- u.deletable? and u.role.name == 'User' and u != user
52
- end
53
47
  can :manage, [
54
48
  Basket,
55
49
  CheckedItem,
@@ -59,7 +53,7 @@
59
53
  Reserve
60
54
  ]
61
55
  can [:read, :create, :update, :remove_all], Checkout
62
- can [:delete, :destroy], Checkout do |checkout|
56
+ can [:destroy, :delete], Checkout do |checkout|
63
57
  checkout.checkin
64
58
  end
65
59
  can [:read, :create, :update], UserCheckoutStat
@@ -83,14 +77,14 @@
83
77
  can [:show, :update], Checkout do |checkout|
84
78
  checkout.user == user
85
79
  end
86
- can [:delete, :destroy], Checkout do |checkout|
80
+ can [:destroy, :delete], Checkout do |checkout|
87
81
  checkout.user == user && checkout.checkin
88
82
  end
89
83
  can :index, Reserve
90
84
  can :create, Reserve do |reserve|
91
85
  user.user_number.present?
92
86
  end
93
- can [:show, :update, :delete, :destroy], Reserve do |reserve|
87
+ can [:show, :update, :destroy, :delete], Reserve do |reserve|
94
88
  reserve.user == user
95
89
  end
96
90
  can :read, [
@@ -110,6 +104,7 @@
110
104
  UserCheckoutStat,
111
105
  UserReserveStat
112
106
  ]
107
+ can :read, [Item, Manifestation]
113
108
  end
114
109
  end
115
110
  end
@@ -14,20 +14,9 @@ class UserGroup < ActiveRecord::Base
14
14
  :greater_than_or_equal_to => 0,
15
15
  :allow_blank => true
16
16
 
17
- def self.per_page
18
- 10
19
- end
17
+ paginates_per 10
20
18
 
21
- if defined?(EnjuCirculation)
22
- has_many :user_group_has_checkout_types, :dependent => :destroy
23
- has_many :checkout_types, :through => :user_group_has_checkout_types, :order => :position
24
- has_many :lending_policies
25
-
26
- validates_numericality_of :number_of_day_to_notify_due_date,
27
- :number_of_day_to_notify_overdue,
28
- :number_of_time_to_notify_overdue,
29
- :greater_than_or_equal_to => 0
30
- end
19
+ enju_circulation_user_group_model if defined?(EnjuCirculation)
31
20
  end
32
21
 
33
22
  # == Schema Information
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_circulation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre15
4
+ version: 0.1.0.pre16
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-13 00:00:00.000000000 Z
11
+ date: 2013-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -456,6 +456,7 @@ files:
456
456
  - lib/enju_circulation/item.rb
457
457
  - lib/enju_circulation/manifestation.rb
458
458
  - lib/enju_circulation/user.rb
459
+ - lib/enju_circulation/user_group.rb
459
460
  - lib/enju_circulation/version.rb
460
461
  - lib/enju_circulation.rb
461
462
  - lib/generators/enju_circulation/views_generator.rb
@@ -612,16 +613,16 @@ files:
612
613
  - spec/dummy/solr/conf/spellings.txt
613
614
  - spec/dummy/solr/conf/stopwords.txt
614
615
  - spec/dummy/solr/conf/synonyms.txt
615
- - spec/dummy/solr/data/test/index/_wh.fdt
616
- - spec/dummy/solr/data/test/index/_wh.fdx
617
- - spec/dummy/solr/data/test/index/_wh.fnm
618
- - spec/dummy/solr/data/test/index/_wh.frq
619
- - spec/dummy/solr/data/test/index/_wh.nrm
620
- - spec/dummy/solr/data/test/index/_wh.prx
621
- - spec/dummy/solr/data/test/index/_wh.tii
622
- - spec/dummy/solr/data/test/index/_wh.tis
616
+ - spec/dummy/solr/data/test/index/_12z.fdt
617
+ - spec/dummy/solr/data/test/index/_12z.fdx
618
+ - spec/dummy/solr/data/test/index/_12z.fnm
619
+ - spec/dummy/solr/data/test/index/_12z.frq
620
+ - spec/dummy/solr/data/test/index/_12z.nrm
621
+ - spec/dummy/solr/data/test/index/_12z.prx
622
+ - spec/dummy/solr/data/test/index/_12z.tii
623
+ - spec/dummy/solr/data/test/index/_12z.tis
623
624
  - spec/dummy/solr/data/test/index/segments.gen
624
- - spec/dummy/solr/data/test/index/segments_1t1
625
+ - spec/dummy/solr/data/test/index/segments_261
625
626
  - spec/dummy/solr/data/test/spellchecker/segments.gen
626
627
  - spec/dummy/solr/data/test/spellchecker/segments_1
627
628
  - spec/factories/basket.rb
@@ -885,16 +886,16 @@ test_files:
885
886
  - spec/dummy/solr/conf/spellings.txt
886
887
  - spec/dummy/solr/conf/stopwords.txt
887
888
  - spec/dummy/solr/conf/synonyms.txt
888
- - spec/dummy/solr/data/test/index/_wh.fdt
889
- - spec/dummy/solr/data/test/index/_wh.fdx
890
- - spec/dummy/solr/data/test/index/_wh.fnm
891
- - spec/dummy/solr/data/test/index/_wh.frq
892
- - spec/dummy/solr/data/test/index/_wh.nrm
893
- - spec/dummy/solr/data/test/index/_wh.prx
894
- - spec/dummy/solr/data/test/index/_wh.tii
895
- - spec/dummy/solr/data/test/index/_wh.tis
889
+ - spec/dummy/solr/data/test/index/_12z.fdt
890
+ - spec/dummy/solr/data/test/index/_12z.fdx
891
+ - spec/dummy/solr/data/test/index/_12z.fnm
892
+ - spec/dummy/solr/data/test/index/_12z.frq
893
+ - spec/dummy/solr/data/test/index/_12z.nrm
894
+ - spec/dummy/solr/data/test/index/_12z.prx
895
+ - spec/dummy/solr/data/test/index/_12z.tii
896
+ - spec/dummy/solr/data/test/index/_12z.tis
896
897
  - spec/dummy/solr/data/test/index/segments.gen
897
- - spec/dummy/solr/data/test/index/segments_1t1
898
+ - spec/dummy/solr/data/test/index/segments_261
898
899
  - spec/dummy/solr/data/test/spellchecker/segments.gen
899
900
  - spec/dummy/solr/data/test/spellchecker/segments_1
900
901
  - spec/factories/basket.rb