enju_circulation 0.0.71 → 0.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/checked_items_controller.rb +2 -2
- data/app/controllers/checkins_controller.rb +4 -4
- data/app/controllers/checkouts_controller.rb +2 -2
- data/app/controllers/manifestation_checkout_stats_controller.rb +2 -2
- data/app/controllers/manifestation_reserve_stats_controller.rb +2 -2
- data/app/controllers/user_checkout_stats_controller.rb +2 -2
- data/app/controllers/user_reserve_stats_controller.rb +2 -2
- data/app/models/checkin.rb +1 -3
- data/app/models/checkout.rb +1 -3
- data/app/models/checkout_stat_has_manifestation.rb +1 -3
- data/app/models/checkout_stat_has_user.rb +1 -3
- data/app/models/checkout_type.rb +1 -3
- data/app/models/item_has_use_restriction.rb +1 -3
- data/app/models/lending_policy.rb +1 -3
- data/app/models/manifestation_checkout_stat.rb +1 -3
- data/app/models/manifestation_reserve_stat.rb +1 -3
- data/app/models/reserve.rb +3 -4
- data/app/models/reserve_stat_has_manifestation.rb +1 -3
- data/app/models/reserve_stat_has_user.rb +1 -3
- data/app/models/user_checkout_stat.rb +1 -3
- data/app/models/user_reserve_stat.rb +1 -3
- data/app/views/baskets/index.html.erb +1 -1
- data/app/views/checked_items/index.html.erb +1 -1
- data/app/views/checkins/index.html.erb +1 -1
- data/app/views/checkout_stat_has_manifestations/index.html.erb +1 -1
- data/app/views/checkout_stat_has_users/index.html.erb +1 -1
- data/app/views/checkout_types/index.html.erb +1 -1
- data/app/views/checkouts/_list.html.erb +1 -1
- data/app/views/item_has_use_restrictions/index.html.erb +1 -1
- data/app/views/lending_policies/index.html.erb +1 -1
- data/app/views/manifestation_checkout_stats/index.html.erb +1 -1
- data/app/views/manifestation_checkout_stats/show.html.erb +1 -1
- data/app/views/manifestation_reserve_stats/index.html.erb +1 -1
- data/app/views/manifestation_reserve_stats/show.html.erb +1 -1
- data/app/views/reserve_stat_has_manifestations/index.html.erb +1 -1
- data/app/views/reserve_stat_has_users/index.html.erb +1 -1
- data/app/views/reserves/index.html.erb +1 -1
- data/app/views/user_checkout_stats/index.html.erb +1 -1
- data/app/views/user_checkout_stats/show.html.erb +1 -1
- data/app/views/user_reserve_stats/index.html.erb +1 -1
- data/app/views/user_reserve_stats/show.html.erb +1 -1
- data/lib/enju_circulation/controller.rb +0 -4
- data/lib/enju_circulation/version.rb +1 -1
- data/lib/generators/enju_circulation/views_generator.rb +38 -0
- data/spec/dummy/app/mailers/notifier.rb +5 -4
- data/spec/dummy/app/models/ability.rb +0 -2
- data/spec/dummy/app/models/local_patron.rb +13 -0
- data/spec/dummy/app/models/user.rb +8 -0
- data/spec/dummy/config/application.rb +4 -1
- data/spec/dummy/db/schema.rb +0 -11
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_1 +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- metadata +46 -64
- data/app/controllers/accepts_controller.rb +0 -83
- data/app/models/accept.rb +0 -36
- data/db/migrate/20120319173203_create_accepts.rb +0 -14
- data/spec/controllers/accepts_controller_spec.rb +0 -304
- data/spec/dummy/lib/enju_leaf/calculate_stat.rb +0 -30
- data/spec/dummy/lib/enju_leaf/expire_editable_fragment.rb +0 -30
- data/spec/dummy/lib/enju_leaf/expire_fragment_cache.rb +0 -17
- data/spec/dummy/lib/enju_leaf/import_file.rb +0 -13
- data/spec/dummy/lib/enju_leaf/localized_name.rb +0 -13
- data/spec/dummy/lib/enju_leaf/master_model.rb +0 -19
- data/spec/dummy/lib/enju_leaf/url_validator.rb +0 -10
- data/spec/dummy/lib/enju_leaf.rb +0 -5
- data/spec/dummy/solr/data/test/index/_2r.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_2r.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_2r.fnm +0 -6
- data/spec/dummy/solr/data/test/index/_2r.frq +0 -1
- data/spec/dummy/solr/data/test/index/_2r.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_2r.prx +0 -0
- data/spec/dummy/solr/data/test/index/_2r.tii +0 -0
- data/spec/dummy/solr/data/test/index/_2r.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments_6n +0 -0
- data/spec/factories/accepts.rb +0 -9
- data/spec/models/accept_spec.rb +0 -22
- data/spec/requests/accepts_spec.rb +0 -11
- data/spec/routing/accepts_routing_spec.rb +0 -27
- data/spec/views/accepts/edit.html.erb_spec.rb +0 -18
- data/spec/views/accepts/index.html.erb_spec.rb +0 -25
- data/spec/views/accepts/new.html.erb_spec.rb +0 -29
- data/spec/views/accepts/show.html.erb_spec.rb +0 -17
@@ -6,9 +6,9 @@ class CheckedItemsController < ApplicationController
|
|
6
6
|
# GET /checked_items.json
|
7
7
|
def index
|
8
8
|
if @basket
|
9
|
-
@checked_items = @basket.checked_items.
|
9
|
+
@checked_items = @basket.checked_items.page(params[:page])
|
10
10
|
else
|
11
|
-
@checked_items = CheckedItem.
|
11
|
+
@checked_items = CheckedItem.page(params[:page])
|
12
12
|
end
|
13
13
|
|
14
14
|
respond_to do |format|
|
@@ -8,9 +8,9 @@ class CheckinsController < ApplicationController
|
|
8
8
|
# GET /checkins.json
|
9
9
|
def index
|
10
10
|
if @basket
|
11
|
-
@checkins = @basket.checkins.
|
11
|
+
@checkins = @basket.checkins.page(params[:page])
|
12
12
|
else
|
13
|
-
@checkins = Checkin.
|
13
|
+
@checkins = Checkin.page(params[:page])
|
14
14
|
end
|
15
15
|
|
16
16
|
respond_to do |format|
|
@@ -42,7 +42,7 @@ class CheckinsController < ApplicationController
|
|
42
42
|
@basket.save!
|
43
43
|
end
|
44
44
|
@checkin = Checkin.new
|
45
|
-
@checkins = [].
|
45
|
+
@checkins = Kaminari::paginate_array([]).page(1)
|
46
46
|
flash[:checkin_basket_id] = @basket.id
|
47
47
|
|
48
48
|
respond_to do |format|
|
@@ -81,7 +81,7 @@ class CheckinsController < ApplicationController
|
|
81
81
|
format.json { render :json => @checkin, :status => :created, :location => @checkin }
|
82
82
|
format.js { redirect_to basket_checkins_url(@basket, :format => :js) }
|
83
83
|
else
|
84
|
-
@checkins = @basket.checkins.
|
84
|
+
@checkins = @basket.checkins.page(1)
|
85
85
|
format.html { render :action => "new" }
|
86
86
|
format.json { render :json => @checkin.errors, :status => :unprocessable_entity }
|
87
87
|
format.js { render :action => "index" }
|
@@ -27,7 +27,7 @@ class CheckoutsController < ApplicationController
|
|
27
27
|
if params[:format] == 'csv'
|
28
28
|
per_page = 65534
|
29
29
|
else
|
30
|
-
per_page = Checkout.
|
30
|
+
per_page = Checkout.default_per_page
|
31
31
|
end
|
32
32
|
|
33
33
|
unless icalendar_user
|
@@ -101,7 +101,7 @@ class CheckoutsController < ApplicationController
|
|
101
101
|
facet :reserved
|
102
102
|
end
|
103
103
|
page = params[:page] || 1
|
104
|
-
search.query.paginate(page.to_i, Checkout.
|
104
|
+
search.query.paginate(page.to_i, Checkout.default_per_page)
|
105
105
|
@checkouts = search.execute!.results
|
106
106
|
@checkouts_facet = search.facet(:reserved).rows
|
107
107
|
end
|
@@ -19,9 +19,9 @@ class ManifestationCheckoutStatsController < ApplicationController
|
|
19
19
|
if params[:format] == 'csv'
|
20
20
|
per_page = 65534
|
21
21
|
else
|
22
|
-
per_page = CheckoutStatHasManifestation.
|
22
|
+
per_page = CheckoutStatHasManifestation.default_per_page
|
23
23
|
end
|
24
|
-
@stats = @manifestation_checkout_stat.checkout_stat_has_manifestations.order('checkouts_count DESC, manifestation_id').page(params[:page]).
|
24
|
+
@stats = @manifestation_checkout_stat.checkout_stat_has_manifestations.order('checkouts_count DESC, manifestation_id').page(params[:page]).per(per_page)
|
25
25
|
|
26
26
|
respond_to do |format|
|
27
27
|
format.html # show.html.erb
|
@@ -19,9 +19,9 @@ class ManifestationReserveStatsController < ApplicationController
|
|
19
19
|
if params[:format] == 'csv'
|
20
20
|
per_page = 65534
|
21
21
|
else
|
22
|
-
per_page = ReserveStatHasManifestation.
|
22
|
+
per_page = ReserveStatHasManifestation.default_per_page
|
23
23
|
end
|
24
|
-
@stats = @manifestation_reserve_stat.reserve_stat_has_manifestations.order('reserves_count DESC, manifestation_id').page(params[:page]).
|
24
|
+
@stats = @manifestation_reserve_stat.reserve_stat_has_manifestations.order('reserves_count DESC, manifestation_id').page(params[:page]).per(per_page)
|
25
25
|
|
26
26
|
respond_to do |format|
|
27
27
|
format.html # show.html.erb
|
@@ -19,9 +19,9 @@ class UserCheckoutStatsController < ApplicationController
|
|
19
19
|
if params[:format] == 'csv'
|
20
20
|
per_page = 65534
|
21
21
|
else
|
22
|
-
per_page = CheckoutStatHasUser.
|
22
|
+
per_page = CheckoutStatHasUser.default_per_page
|
23
23
|
end
|
24
|
-
@stats = @user_checkout_stat.checkout_stat_has_users.order('checkouts_count DESC, user_id').page(params[:page]).
|
24
|
+
@stats = @user_checkout_stat.checkout_stat_has_users.order('checkouts_count DESC, user_id').page(params[:page]).per(per_page)
|
25
25
|
|
26
26
|
respond_to do |format|
|
27
27
|
format.html # show.html.erb
|
@@ -19,9 +19,9 @@ class UserReserveStatsController < ApplicationController
|
|
19
19
|
if params[:format] == 'csv'
|
20
20
|
per_page = 65534
|
21
21
|
else
|
22
|
-
per_page = ReserveStatHasUser.
|
22
|
+
per_page = ReserveStatHasUser.default_per_page
|
23
23
|
end
|
24
|
-
@stats = @user_reserve_stat.reserve_stat_has_users.order('reserves_count DESC, user_id').page(params[:page]).
|
24
|
+
@stats = @user_reserve_stat.reserve_stat_has_users.order('reserves_count DESC, user_id').page(params[:page]).per(per_page)
|
25
25
|
|
26
26
|
respond_to do |format|
|
27
27
|
format.html # show.html.erb
|
data/app/models/checkin.rb
CHANGED
data/app/models/checkout.rb
CHANGED
@@ -8,9 +8,7 @@ class CheckoutStatHasManifestation < ActiveRecord::Base
|
|
8
8
|
validates_uniqueness_of :manifestation_id, :scope => :manifestation_checkout_stat_id
|
9
9
|
validates_presence_of :manifestation_checkout_stat_id, :manifestation_id
|
10
10
|
|
11
|
-
|
12
|
-
10
|
13
|
-
end
|
11
|
+
paginates_per 10
|
14
12
|
end
|
15
13
|
|
16
14
|
# == Schema Information
|
@@ -8,9 +8,7 @@ class CheckoutStatHasUser < ActiveRecord::Base
|
|
8
8
|
validates_uniqueness_of :user_id, :scope => :user_checkout_stat_id
|
9
9
|
validates_presence_of :user_checkout_stat_id, :user_id
|
10
10
|
|
11
|
-
|
12
|
-
10
|
13
|
-
end
|
11
|
+
paginates_per 10
|
14
12
|
end
|
15
13
|
|
16
14
|
# == Schema Information
|
data/app/models/checkout_type.rb
CHANGED
@@ -9,9 +9,7 @@ class LendingPolicy < ActiveRecord::Base
|
|
9
9
|
validates_uniqueness_of :user_group_id, :scope => :item_id
|
10
10
|
validates_date :fixed_due_date, :allow_blank => true
|
11
11
|
|
12
|
-
|
13
|
-
10
|
14
|
-
end
|
12
|
+
paginates_per 10
|
15
13
|
|
16
14
|
acts_as_list :scope => :item_id
|
17
15
|
end
|
data/app/models/reserve.rb
CHANGED
@@ -71,9 +71,7 @@ class Reserve < ActiveRecord::Base
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
|
75
|
-
10
|
76
|
-
end
|
74
|
+
paginates_per 10
|
77
75
|
|
78
76
|
def set_item_and_manifestation
|
79
77
|
item = Item.where(:item_identifier => item_identifier).first
|
@@ -174,7 +172,8 @@ class Reserve < ActiveRecord::Base
|
|
174
172
|
request.assign_attributes({:sender => sender, :receiver => sender, :message_template => message_template_to_library}, :as => :admin)
|
175
173
|
request.save_message_body(:manifestations => options[:manifestations])
|
176
174
|
self.not_sent_expiration_notice_to_library.each do |reserve|
|
177
|
-
reserve.
|
175
|
+
reserve.expiration_notice_to_library = true
|
176
|
+
reserve.save(:validate => false)
|
178
177
|
end
|
179
178
|
#when 'canceled'
|
180
179
|
# message_template_to_library = MessageTemplate.localized_template('reservation_canceled_for_library', sender.locale)
|
@@ -8,9 +8,7 @@ class ReserveStatHasManifestation < ActiveRecord::Base
|
|
8
8
|
validates_uniqueness_of :manifestation_id, :scope => :manifestation_reserve_stat_id
|
9
9
|
validates_presence_of :manifestation_reserve_stat_id, :manifestation_id
|
10
10
|
|
11
|
-
|
12
|
-
10
|
13
|
-
end
|
11
|
+
paginates_per 10
|
14
12
|
end
|
15
13
|
|
16
14
|
# == Schema Information
|
@@ -8,9 +8,7 @@ class ReserveStatHasUser < ActiveRecord::Base
|
|
8
8
|
validates_uniqueness_of :user_id, :scope => :user_reserve_stat_id
|
9
9
|
validates_presence_of :user_reserve_stat_id, :user_id
|
10
10
|
|
11
|
-
|
12
|
-
10
|
13
|
-
end
|
11
|
+
paginates_per 10
|
14
12
|
end
|
15
13
|
|
16
14
|
# == Schema Information
|
@@ -13,10 +13,6 @@ module EnjuCirculation
|
|
13
13
|
module InstanceMethods
|
14
14
|
private
|
15
15
|
|
16
|
-
def get_basket
|
17
|
-
@basket = Basket.find(params[:basket_id]) if params[:basket_id]
|
18
|
-
end
|
19
|
-
|
20
16
|
def get_checkout_type
|
21
17
|
@checkout_type = CheckoutType.find(params[:checkout_type_id]) if params[:checkout_type_id]
|
22
18
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module EnjuCirculation
|
2
|
+
module Generators
|
3
|
+
class ViewsGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../../../../app/views', __FILE__)
|
5
|
+
|
6
|
+
def copy_files
|
7
|
+
directories = %w(
|
8
|
+
baskets
|
9
|
+
carrier_type_has_checkout_types
|
10
|
+
checked_items
|
11
|
+
checkins
|
12
|
+
checkout_stat_has_manifestations
|
13
|
+
checkout_stat_has_users
|
14
|
+
checkout_types
|
15
|
+
checkouts
|
16
|
+
circulation_statuses
|
17
|
+
item_has_use_restrictions
|
18
|
+
lending_policies
|
19
|
+
manifestation_checkout_stats
|
20
|
+
manifestation_reserve_stats
|
21
|
+
my_accounts
|
22
|
+
reserve_stat_has_manifestations
|
23
|
+
reserve_stat_has_users
|
24
|
+
reserves
|
25
|
+
use_restrictions
|
26
|
+
user_checkout_stats
|
27
|
+
user_group_has_checkout_types
|
28
|
+
user_reserve_stats
|
29
|
+
users
|
30
|
+
)
|
31
|
+
|
32
|
+
directories.each do |dir|
|
33
|
+
directory dir, "app/views/#{dir}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -4,12 +4,13 @@ class Notifier < ActionMailer::Base
|
|
4
4
|
default_url_options[:host] = uri.host
|
5
5
|
default_url_options[:port] = uri.port if configatron.enju.web_port_number != 80
|
6
6
|
else
|
7
|
-
default_url_options[:host] =
|
8
|
-
default_url_options[:port] =
|
7
|
+
default_url_options[:host] = 'library.example.jp'
|
8
|
+
default_url_options[:port] = 80
|
9
9
|
end
|
10
10
|
|
11
|
-
def message_notification(
|
12
|
-
|
11
|
+
def message_notification(message_id)
|
12
|
+
message = Message.find(message_id)
|
13
|
+
I18n.locale = message.receiver.locale.try(:to_sym) || I18n.default_locale
|
13
14
|
from = "#{LibraryGroup.system_name(message.receiver.locale)} <#{LibraryGroup.site_config.email}>"
|
14
15
|
if message.subject
|
15
16
|
subject = message.subject
|
@@ -5,7 +5,6 @@ class Ability
|
|
5
5
|
case user.try(:role).try(:name)
|
6
6
|
when 'Administrator'
|
7
7
|
can :manage, [
|
8
|
-
Accept,
|
9
8
|
Basket,
|
10
9
|
CarrierTypeHasCheckoutType,
|
11
10
|
CheckedItem,
|
@@ -43,7 +42,6 @@ class Ability
|
|
43
42
|
end
|
44
43
|
when 'Librarian'
|
45
44
|
can :manage, [
|
46
|
-
Accept,
|
47
45
|
Basket,
|
48
46
|
CheckedItem,
|
49
47
|
Checkin,
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -13,17 +13,6 @@
|
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(:version => 20120424103932) do
|
15
15
|
|
16
|
-
create_table "accepts", :force => true do |t|
|
17
|
-
t.integer "basket_id"
|
18
|
-
t.integer "item_id"
|
19
|
-
t.integer "librarian_id"
|
20
|
-
t.datetime "created_at", :null => false
|
21
|
-
t.datetime "updated_at", :null => false
|
22
|
-
end
|
23
|
-
|
24
|
-
add_index "accepts", ["basket_id"], :name => "index_accepts_on_basket_id"
|
25
|
-
add_index "accepts", ["item_id"], :name => "index_accepts_on_item_id"
|
26
|
-
|
27
16
|
create_table "baskets", :force => true do |t|
|
28
17
|
t.integer "user_id"
|
29
18
|
t.text "note"
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
Binary file
|
Binary file
|