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
Binary file
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_circulation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0.pre
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kosuke Tanabe
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -96,17 +96,17 @@ dependencies:
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.
|
101
|
+
version: 0.1.12
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.
|
109
|
+
version: 0.1.12
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: enju_event
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,6 +203,38 @@ dependencies:
|
|
203
203
|
- - ! '>='
|
204
204
|
- !ruby/object:Gem::Version
|
205
205
|
version: '0'
|
206
|
+
- !ruby/object:Gem::Dependency
|
207
|
+
name: enju_biblio
|
208
|
+
requirement: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ~>
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: 0.1.0.pre
|
214
|
+
type: :development
|
215
|
+
prerelease: false
|
216
|
+
version_requirements: !ruby/object:Gem::Requirement
|
217
|
+
none: false
|
218
|
+
requirements:
|
219
|
+
- - ~>
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: 0.1.0.pre
|
222
|
+
- !ruby/object:Gem::Dependency
|
223
|
+
name: enju_library
|
224
|
+
requirement: !ruby/object:Gem::Requirement
|
225
|
+
none: false
|
226
|
+
requirements:
|
227
|
+
- - ~>
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 0.1.0.pre
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ~>
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: 0.1.0.pre
|
206
238
|
- !ruby/object:Gem::Dependency
|
207
239
|
name: enju_export
|
208
240
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,7 +274,6 @@ executables: []
|
|
242
274
|
extensions: []
|
243
275
|
extra_rdoc_files: []
|
244
276
|
files:
|
245
|
-
- app/controllers/accepts_controller.rb
|
246
277
|
- app/controllers/baskets_controller.rb
|
247
278
|
- app/controllers/carrier_type_has_checkout_types_controller.rb
|
248
279
|
- app/controllers/checked_items_controller.rb
|
@@ -264,7 +295,6 @@ files:
|
|
264
295
|
- app/controllers/user_group_has_checkout_types_controller.rb
|
265
296
|
- app/controllers/user_reserve_stats_controller.rb
|
266
297
|
- app/helpers/reserves_helper.rb
|
267
|
-
- app/models/accept.rb
|
268
298
|
- app/models/basket.rb
|
269
299
|
- app/models/carrier_type_has_checkout_type.rb
|
270
300
|
- app/models/checked_item.rb
|
@@ -446,7 +476,6 @@ files:
|
|
446
476
|
- db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb
|
447
477
|
- db/migrate/20111217234412_add_save_checkout_history_to_user.rb
|
448
478
|
- db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb
|
449
|
-
- db/migrate/20120319173203_create_accepts.rb
|
450
479
|
- db/migrate/20120424103932_add_librarian_id_to_checked_item.rb
|
451
480
|
- lib/enju_circulation/controller.rb
|
452
481
|
- lib/enju_circulation/engine.rb
|
@@ -455,11 +484,11 @@ files:
|
|
455
484
|
- lib/enju_circulation/user.rb
|
456
485
|
- lib/enju_circulation/version.rb
|
457
486
|
- lib/enju_circulation.rb
|
487
|
+
- lib/generators/enju_circulation/views_generator.rb
|
458
488
|
- lib/tasks/enju_circulation_tasks.rake
|
459
489
|
- MIT-LICENSE
|
460
490
|
- Rakefile
|
461
491
|
- README.rdoc
|
462
|
-
- spec/controllers/accepts_controller_spec.rb
|
463
492
|
- spec/controllers/baskets_controller_spec.rb
|
464
493
|
- spec/controllers/carrier_type_has_checkout_types_controller_spec.rb
|
465
494
|
- spec/controllers/checked_items_controller_spec.rb
|
@@ -487,6 +516,7 @@ files:
|
|
487
516
|
- spec/dummy/app/helpers/application_helper.rb
|
488
517
|
- spec/dummy/app/mailers/notifier.rb
|
489
518
|
- spec/dummy/app/models/ability.rb
|
519
|
+
- spec/dummy/app/models/local_patron.rb
|
490
520
|
- spec/dummy/app/models/role.rb
|
491
521
|
- spec/dummy/app/models/user.rb
|
492
522
|
- spec/dummy/app/models/user_group.rb
|
@@ -586,14 +616,6 @@ files:
|
|
586
616
|
- spec/dummy/db/migrate/20120224094141_create_delayed_jobs.rb
|
587
617
|
- spec/dummy/db/schema.rb
|
588
618
|
- spec/dummy/db/test.sqlite3
|
589
|
-
- spec/dummy/lib/enju_leaf/calculate_stat.rb
|
590
|
-
- spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
|
591
|
-
- spec/dummy/lib/enju_leaf/expire_fragment_cache.rb
|
592
|
-
- spec/dummy/lib/enju_leaf/import_file.rb
|
593
|
-
- spec/dummy/lib/enju_leaf/localized_name.rb
|
594
|
-
- spec/dummy/lib/enju_leaf/master_model.rb
|
595
|
-
- spec/dummy/lib/enju_leaf/url_validator.rb
|
596
|
-
- spec/dummy/lib/enju_leaf.rb
|
597
619
|
- spec/dummy/public/404.html
|
598
620
|
- spec/dummy/public/422.html
|
599
621
|
- spec/dummy/public/500.html
|
@@ -612,19 +634,10 @@ files:
|
|
612
634
|
- spec/dummy/solr/conf/spellings.txt
|
613
635
|
- spec/dummy/solr/conf/stopwords.txt
|
614
636
|
- spec/dummy/solr/conf/synonyms.txt
|
615
|
-
- spec/dummy/solr/data/test/index/_2r.fdt
|
616
|
-
- spec/dummy/solr/data/test/index/_2r.fdx
|
617
|
-
- spec/dummy/solr/data/test/index/_2r.fnm
|
618
|
-
- spec/dummy/solr/data/test/index/_2r.frq
|
619
|
-
- spec/dummy/solr/data/test/index/_2r.nrm
|
620
|
-
- spec/dummy/solr/data/test/index/_2r.prx
|
621
|
-
- spec/dummy/solr/data/test/index/_2r.tii
|
622
|
-
- spec/dummy/solr/data/test/index/_2r.tis
|
623
637
|
- spec/dummy/solr/data/test/index/segments.gen
|
624
|
-
- spec/dummy/solr/data/test/index/
|
638
|
+
- spec/dummy/solr/data/test/index/segments_1
|
625
639
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
626
640
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
627
|
-
- spec/factories/accepts.rb
|
628
641
|
- spec/factories/basket.rb
|
629
642
|
- spec/factories/carrier_type.rb
|
630
643
|
- spec/factories/carrier_type_has_checkout_type.rb
|
@@ -688,7 +701,6 @@ files:
|
|
688
701
|
- spec/fixtures/user_has_roles.yml
|
689
702
|
- spec/fixtures/user_reserve_stats.yml
|
690
703
|
- spec/fixtures/users.yml
|
691
|
-
- spec/models/accept_spec.rb
|
692
704
|
- spec/models/basket_spec.rb
|
693
705
|
- spec/models/carrier_type_has_checkout_type_spec.rb
|
694
706
|
- spec/models/checked_item_spec.rb
|
@@ -709,17 +721,11 @@ files:
|
|
709
721
|
- spec/models/user_checkout_stat_spec.rb
|
710
722
|
- spec/models/user_group_has_checkout_type_spec.rb
|
711
723
|
- spec/models/user_reserve_stat_spec.rb
|
712
|
-
- spec/requests/accepts_spec.rb
|
713
|
-
- spec/routing/accepts_routing_spec.rb
|
714
724
|
- spec/routing/baskets_routing_spec.rb
|
715
725
|
- spec/routing/checked_items_routing_spec.rb
|
716
726
|
- spec/spec_helper.rb
|
717
727
|
- spec/support/controller_macros.rb
|
718
728
|
- spec/support/devise.rb
|
719
|
-
- spec/views/accepts/edit.html.erb_spec.rb
|
720
|
-
- spec/views/accepts/index.html.erb_spec.rb
|
721
|
-
- spec/views/accepts/new.html.erb_spec.rb
|
722
|
-
- spec/views/accepts/show.html.erb_spec.rb
|
723
729
|
homepage: https://github.com/nabeta/enju_circulation
|
724
730
|
licenses: []
|
725
731
|
post_install_message:
|
@@ -735,9 +741,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
735
741
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
736
742
|
none: false
|
737
743
|
requirements:
|
738
|
-
- - ! '
|
744
|
+
- - ! '>'
|
739
745
|
- !ruby/object:Gem::Version
|
740
|
-
version:
|
746
|
+
version: 1.3.1
|
741
747
|
requirements: []
|
742
748
|
rubyforge_project:
|
743
749
|
rubygems_version: 1.8.23
|
@@ -745,7 +751,6 @@ signing_key:
|
|
745
751
|
specification_version: 3
|
746
752
|
summary: enju_circulation plugin
|
747
753
|
test_files:
|
748
|
-
- spec/controllers/accepts_controller_spec.rb
|
749
754
|
- spec/controllers/baskets_controller_spec.rb
|
750
755
|
- spec/controllers/carrier_type_has_checkout_types_controller_spec.rb
|
751
756
|
- spec/controllers/checked_items_controller_spec.rb
|
@@ -773,6 +778,7 @@ test_files:
|
|
773
778
|
- spec/dummy/app/helpers/application_helper.rb
|
774
779
|
- spec/dummy/app/mailers/notifier.rb
|
775
780
|
- spec/dummy/app/models/ability.rb
|
781
|
+
- spec/dummy/app/models/local_patron.rb
|
776
782
|
- spec/dummy/app/models/role.rb
|
777
783
|
- spec/dummy/app/models/user.rb
|
778
784
|
- spec/dummy/app/models/user_group.rb
|
@@ -872,14 +878,6 @@ test_files:
|
|
872
878
|
- spec/dummy/db/migrate/20120224094141_create_delayed_jobs.rb
|
873
879
|
- spec/dummy/db/schema.rb
|
874
880
|
- spec/dummy/db/test.sqlite3
|
875
|
-
- spec/dummy/lib/enju_leaf/calculate_stat.rb
|
876
|
-
- spec/dummy/lib/enju_leaf/expire_editable_fragment.rb
|
877
|
-
- spec/dummy/lib/enju_leaf/expire_fragment_cache.rb
|
878
|
-
- spec/dummy/lib/enju_leaf/import_file.rb
|
879
|
-
- spec/dummy/lib/enju_leaf/localized_name.rb
|
880
|
-
- spec/dummy/lib/enju_leaf/master_model.rb
|
881
|
-
- spec/dummy/lib/enju_leaf/url_validator.rb
|
882
|
-
- spec/dummy/lib/enju_leaf.rb
|
883
881
|
- spec/dummy/public/404.html
|
884
882
|
- spec/dummy/public/422.html
|
885
883
|
- spec/dummy/public/500.html
|
@@ -898,19 +896,10 @@ test_files:
|
|
898
896
|
- spec/dummy/solr/conf/spellings.txt
|
899
897
|
- spec/dummy/solr/conf/stopwords.txt
|
900
898
|
- spec/dummy/solr/conf/synonyms.txt
|
901
|
-
- spec/dummy/solr/data/test/index/_2r.fdt
|
902
|
-
- spec/dummy/solr/data/test/index/_2r.fdx
|
903
|
-
- spec/dummy/solr/data/test/index/_2r.fnm
|
904
|
-
- spec/dummy/solr/data/test/index/_2r.frq
|
905
|
-
- spec/dummy/solr/data/test/index/_2r.nrm
|
906
|
-
- spec/dummy/solr/data/test/index/_2r.prx
|
907
|
-
- spec/dummy/solr/data/test/index/_2r.tii
|
908
|
-
- spec/dummy/solr/data/test/index/_2r.tis
|
909
899
|
- spec/dummy/solr/data/test/index/segments.gen
|
910
|
-
- spec/dummy/solr/data/test/index/
|
900
|
+
- spec/dummy/solr/data/test/index/segments_1
|
911
901
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
912
902
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
913
|
-
- spec/factories/accepts.rb
|
914
903
|
- spec/factories/basket.rb
|
915
904
|
- spec/factories/carrier_type.rb
|
916
905
|
- spec/factories/carrier_type_has_checkout_type.rb
|
@@ -974,7 +963,6 @@ test_files:
|
|
974
963
|
- spec/fixtures/user_has_roles.yml
|
975
964
|
- spec/fixtures/user_reserve_stats.yml
|
976
965
|
- spec/fixtures/users.yml
|
977
|
-
- spec/models/accept_spec.rb
|
978
966
|
- spec/models/basket_spec.rb
|
979
967
|
- spec/models/carrier_type_has_checkout_type_spec.rb
|
980
968
|
- spec/models/checked_item_spec.rb
|
@@ -995,14 +983,8 @@ test_files:
|
|
995
983
|
- spec/models/user_checkout_stat_spec.rb
|
996
984
|
- spec/models/user_group_has_checkout_type_spec.rb
|
997
985
|
- spec/models/user_reserve_stat_spec.rb
|
998
|
-
- spec/requests/accepts_spec.rb
|
999
|
-
- spec/routing/accepts_routing_spec.rb
|
1000
986
|
- spec/routing/baskets_routing_spec.rb
|
1001
987
|
- spec/routing/checked_items_routing_spec.rb
|
1002
988
|
- spec/spec_helper.rb
|
1003
989
|
- spec/support/controller_macros.rb
|
1004
990
|
- spec/support/devise.rb
|
1005
|
-
- spec/views/accepts/edit.html.erb_spec.rb
|
1006
|
-
- spec/views/accepts/index.html.erb_spec.rb
|
1007
|
-
- spec/views/accepts/new.html.erb_spec.rb
|
1008
|
-
- spec/views/accepts/show.html.erb_spec.rb
|
@@ -1,83 +0,0 @@
|
|
1
|
-
class AcceptsController < InheritedResources::Base
|
2
|
-
load_and_authorize_resource :except => :index
|
3
|
-
authorize_resource :only => :index
|
4
|
-
respond_to :html, :json
|
5
|
-
before_filter :get_basket, :only => [:index, :create]
|
6
|
-
|
7
|
-
# GET /accepts
|
8
|
-
# GET /accepts.json
|
9
|
-
def index
|
10
|
-
if params[:format] == 'csv'
|
11
|
-
@accepts = Accept.order('accepts.created_at DESC').paginate(:page => params[:page], :per_page => 65534)
|
12
|
-
else
|
13
|
-
if params[:accept]
|
14
|
-
@query = params[:accept][:item_identifier].to_s.strip
|
15
|
-
item = Item.where(:item_identifier => @query).first if @query.present?
|
16
|
-
end
|
17
|
-
|
18
|
-
if item
|
19
|
-
@accepts = Accept.order('accepts.created_at DESC').where(:item_id => item.id).paginate(:page => params[:page])
|
20
|
-
else
|
21
|
-
if @basket
|
22
|
-
@accepts = @basket.accepts.paginate(:page => params[:page])
|
23
|
-
else
|
24
|
-
@accepts = Accept.paginate(:page => params[:page])
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
respond_to do |format|
|
30
|
-
format.html # index.html.erb
|
31
|
-
format.json { render :json => @accepts }
|
32
|
-
format.js { @accept = Accept.new }
|
33
|
-
format.csv
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# GET /new
|
38
|
-
# GET /new.json
|
39
|
-
def new
|
40
|
-
@basket = Basket.new
|
41
|
-
@basket.user = current_user
|
42
|
-
@basket.save!
|
43
|
-
@accept = Accept.new
|
44
|
-
@accepts = []
|
45
|
-
|
46
|
-
respond_to do |format|
|
47
|
-
format.html # new.html.erb
|
48
|
-
format.json { render :json => @patron }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# POST /accepts
|
53
|
-
# POST /accepts.json
|
54
|
-
def create
|
55
|
-
unless @basket
|
56
|
-
access_denied; return
|
57
|
-
end
|
58
|
-
@accept.basket = @basket
|
59
|
-
@accept.librarian = current_user
|
60
|
-
|
61
|
-
flash[:message] = ''
|
62
|
-
if @accept.item_identifier.blank?
|
63
|
-
flash[:message] << t('accept.enter_item_identifier') if @accept.item_identifier.blank?
|
64
|
-
else
|
65
|
-
item = Item.where(:item_identifier => @accept.item_identifier.to_s.strip).first
|
66
|
-
end
|
67
|
-
@accept.item = item
|
68
|
-
|
69
|
-
respond_to do |format|
|
70
|
-
if @accept.save
|
71
|
-
flash[:message] << t('accept.successfully_accepted', :model => t('activerecord.models.accept'))
|
72
|
-
format.html { redirect_to basket_accepts_url(@basket) }
|
73
|
-
format.json { render :json => @accept, :status => :created, :location => @accept }
|
74
|
-
format.js { redirect_to basket_accepts_url(@basket, :format => :js) }
|
75
|
-
else
|
76
|
-
@accepts = @basket.accepts.paginate(:page => params[:page])
|
77
|
-
format.html { render :action => "index" }
|
78
|
-
format.json { render :json => @accept.errors, :status => :unprocessable_entity }
|
79
|
-
format.js { render :action => "index" }
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
data/app/models/accept.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
class Accept < ActiveRecord::Base
|
2
|
-
attr_accessible :item_identifier, :librarian_id, :item_id
|
3
|
-
default_scope :order => 'accepts.id DESC'
|
4
|
-
belongs_to :basket
|
5
|
-
belongs_to :item
|
6
|
-
belongs_to :librarian, :class_name => 'User'
|
7
|
-
|
8
|
-
validates_uniqueness_of :item_id, :message => I18n.t('accept.already_accepted')
|
9
|
-
validates_presence_of :item_id, :message => I18n.t('accept.item_not_found')
|
10
|
-
validates_presence_of :basket_id
|
11
|
-
|
12
|
-
before_save :accept!, :on => :create
|
13
|
-
|
14
|
-
attr_accessor :item_identifier
|
15
|
-
|
16
|
-
def self.per_page
|
17
|
-
10
|
18
|
-
end
|
19
|
-
|
20
|
-
def accept!
|
21
|
-
item.circulation_status = CirculationStatus.where(:name => 'Available On Shelf').first
|
22
|
-
item.save(:validate => false)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
# == Schema Information
|
26
|
-
#
|
27
|
-
# Table name: accepts
|
28
|
-
#
|
29
|
-
# id :integer not null, primary key
|
30
|
-
# basket_id :integer
|
31
|
-
# item_id :integer
|
32
|
-
# librarian_id :integer
|
33
|
-
# created_at :datetime not null
|
34
|
-
# updated_at :datetime not null
|
35
|
-
#
|
36
|
-
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class CreateAccepts < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :accepts do |t|
|
4
|
-
t.integer :basket_id
|
5
|
-
t.integer :item_id
|
6
|
-
t.integer :librarian_id
|
7
|
-
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
|
11
|
-
add_index :accepts, :basket_id
|
12
|
-
add_index :accepts, :item_id
|
13
|
-
end
|
14
|
-
end
|