enju_event 0.1.17.pre23 → 0.1.17.pre24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +8 -1
  3. data/app/controllers/event_categories_controller.rb +7 -2
  4. data/app/controllers/event_export_files_controller.rb +7 -2
  5. data/app/controllers/event_import_files_controller.rb +12 -4
  6. data/app/controllers/event_import_results_controller.rb +7 -0
  7. data/app/controllers/events_controller.rb +9 -3
  8. data/app/controllers/participates_controller.rb +7 -2
  9. data/app/models/event.rb +0 -3
  10. data/app/models/event_category.rb +0 -1
  11. data/app/models/event_export_file.rb +13 -3
  12. data/app/models/event_export_file_transition.rb +1 -1
  13. data/app/models/event_import_file.rb +8 -6
  14. data/app/models/event_import_file_transition.rb +1 -1
  15. data/app/models/event_import_result.rb +0 -1
  16. data/app/models/participate.rb +0 -1
  17. data/app/views/event_export_files/index.html.erb +2 -2
  18. data/app/views/event_export_files/show.html.erb +1 -1
  19. data/app/views/event_import_files/index.html.erb +1 -1
  20. data/app/views/event_import_files/show.html.erb +1 -1
  21. data/db/migrate/20140523171309_create_event_import_file_transitions.rb +5 -1
  22. data/db/migrate/20140812153137_create_event_export_file_transitions.rb +5 -1
  23. data/lib/enju_event/engine.rb +0 -2
  24. data/lib/enju_event/version.rb +1 -1
  25. data/spec/controllers/event_export_files_controller_spec.rb +5 -5
  26. data/spec/controllers/event_import_files_controller_spec.rb +1 -1
  27. data/spec/dummy/app/models/user.rb +0 -1
  28. data/spec/dummy/bin/bundle +3 -0
  29. data/spec/dummy/bin/rails +4 -0
  30. data/spec/dummy/bin/rake +4 -0
  31. data/spec/dummy/bin/setup +29 -0
  32. data/spec/dummy/config/database.yml +23 -18
  33. data/spec/dummy/config/environments/test.rb +1 -1
  34. data/spec/dummy/db/migrate/035_create_reserves.rb +0 -1
  35. data/spec/dummy/db/migrate/133_create_agent_merges.rb +15 -0
  36. data/spec/dummy/db/migrate/134_create_agent_merge_lists.rb +13 -0
  37. data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +18 -0
  38. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +5 -1
  39. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +5 -1
  40. data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +5 -1
  41. data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +5 -1
  42. data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +5 -1
  43. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +5 -1
  44. data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +5 -1
  45. data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +5 -1
  46. data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +5 -1
  47. data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +5 -1
  48. data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +5 -1
  49. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +5 -1
  50. data/spec/dummy/db/migrate/{20140810061942_add_user_id_to_stat.rb → 20140810061942_add_user_id_to_user_checkout_stat.rb} +1 -1
  51. data/spec/dummy/db/migrate/20141003181336_add_full_name_transcription_to_profile.rb +5 -0
  52. data/spec/dummy/db/migrate/20141003182825_add_date_of_birth_to_profile.rb +5 -0
  53. data/spec/dummy/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +6 -0
  54. data/spec/dummy/db/schema.rb +645 -615
  55. data/spec/fixtures/events.yml +20 -45
  56. data/spec/fixtures/users.yml +1 -1
  57. data/spec/spec_helper.rb +2 -0
  58. metadata +57 -212
  59. data/app/controllers/calendar_controller.rb +0 -35
  60. data/spec/dummy/db/development.sqlite3 +0 -0
  61. data/spec/dummy/db/migrate/20130303104849_add_state_index_to_reserve.rb +0 -5
  62. data/spec/dummy/db/test.sqlite3 +0 -0
  63. data/spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_destroy_file.tsv +0 -4
  64. data/spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_import51.txt +0 -3
  65. data/spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_import_file_sample1.tsv +0 -7
  66. data/spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_import_file_sample2.tsv +0 -7
  67. data/spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_update_file.tsv +0 -4
  68. data/spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/invalid_file.tsv +0 -3
  69. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140818-66894-1um2gwb.txt +0 -9
  70. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140818-67059-j0f46.txt +0 -9
  71. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140915-67461-178vmkf.txt +0 -9
  72. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140916-27270-1dm2llo.txt +0 -9
  73. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-56213-1l5hypx.txt +0 -9
  74. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-58265-o3c737.txt +0 -9
  75. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-58363-1tipiu.txt +0 -9
  76. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-58460-38jub0.txt +0 -9
  77. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-58528-ca3k3q.txt +0 -9
  78. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-58630-1m4isxz.txt +0 -9
  79. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-58934-19ikk0v.txt +0 -9
  80. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-59012-10in1j8.txt +0 -9
  81. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140921-59315-15pzw3y.txt +0 -9
  82. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140922-86319-oo60ty.txt +0 -9
  83. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20140927-1698-10wfq6m.txt +0 -9
  84. data/spec/dummy/public/system/event_export_files/event_exports/000/000/004/original/event_export_file_20141003-88157-4ti9t5.txt +0 -9
  85. data/spec/dummy/script/rails +0 -6
  86. data/spec/dummy/solr/conf/admin-extra.html +0 -31
  87. data/spec/dummy/solr/conf/elevate.xml +0 -36
  88. data/spec/dummy/solr/conf/mapping-ISOLatin1Accent.txt +0 -246
  89. data/spec/dummy/solr/conf/protwords.txt +0 -21
  90. data/spec/dummy/solr/conf/schema.xml +0 -255
  91. data/spec/dummy/solr/conf/scripts.conf +0 -24
  92. data/spec/dummy/solr/conf/solrconfig.xml +0 -667
  93. data/spec/dummy/solr/conf/spellings.txt +0 -2
  94. data/spec/dummy/solr/conf/stopwords.txt +0 -58
  95. data/spec/dummy/solr/conf/synonyms.txt +0 -31
  96. data/spec/dummy/solr/default/data/index/_1pd.fdt +0 -0
  97. data/spec/dummy/solr/default/data/index/_1pd.fdx +0 -0
  98. data/spec/dummy/solr/default/data/index/_1pd.fnm +0 -0
  99. data/spec/dummy/solr/default/data/index/_1pd.nvd +0 -0
  100. data/spec/dummy/solr/default/data/index/_1pd.nvm +0 -0
  101. data/spec/dummy/solr/default/data/index/_1pd.si +0 -0
  102. data/spec/dummy/solr/default/data/index/_1pd_Lucene41_0.doc +0 -0
  103. data/spec/dummy/solr/default/data/index/_1pd_Lucene41_0.pos +0 -0
  104. data/spec/dummy/solr/default/data/index/_1pd_Lucene41_0.tim +0 -0
  105. data/spec/dummy/solr/default/data/index/_1pd_Lucene41_0.tip +0 -0
  106. data/spec/dummy/solr/default/data/index/_1pe.fdt +0 -0
  107. data/spec/dummy/solr/default/data/index/_1pe.fdx +0 -0
  108. data/spec/dummy/solr/default/data/index/_1pe.fnm +0 -0
  109. data/spec/dummy/solr/default/data/index/_1pe.nvd +0 -0
  110. data/spec/dummy/solr/default/data/index/_1pe.nvm +0 -0
  111. data/spec/dummy/solr/default/data/index/_1pe.si +0 -0
  112. data/spec/dummy/solr/default/data/index/_1pe_Lucene41_0.doc +0 -0
  113. data/spec/dummy/solr/default/data/index/_1pe_Lucene41_0.pos +0 -0
  114. data/spec/dummy/solr/default/data/index/_1pe_Lucene41_0.tim +0 -0
  115. data/spec/dummy/solr/default/data/index/_1pe_Lucene41_0.tip +0 -0
  116. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  117. data/spec/dummy/solr/default/data/index/segments_2g6 +0 -0
  118. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003163 +0 -0
  119. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003164 +0 -0
  120. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003165 +0 -0
  121. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003166 +0 -0
  122. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003167 +0 -0
  123. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003168 +0 -0
  124. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003169 +0 -0
  125. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003170 +0 -0
  126. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003171 +0 -0
  127. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000003172 +0 -0
  128. data/spec/dummy/solr/development/data/index/segments.gen +0 -0
  129. data/spec/dummy/solr/development/data/index/segments_1 +0 -0
  130. data/spec/dummy/solr/solr.xml +0 -8
  131. data/spec/dummy/solr/test/data/index/_a.fdt +0 -0
  132. data/spec/dummy/solr/test/data/index/_a.fdx +0 -0
  133. data/spec/dummy/solr/test/data/index/_a.fnm +0 -0
  134. data/spec/dummy/solr/test/data/index/_a.nvd +0 -0
  135. data/spec/dummy/solr/test/data/index/_a.nvm +0 -0
  136. data/spec/dummy/solr/test/data/index/_a.si +0 -0
  137. data/spec/dummy/solr/test/data/index/_a_Lucene41_0.doc +0 -0
  138. data/spec/dummy/solr/test/data/index/_a_Lucene41_0.pos +0 -0
  139. data/spec/dummy/solr/test/data/index/_a_Lucene41_0.tim +0 -0
  140. data/spec/dummy/solr/test/data/index/_a_Lucene41_0.tip +0 -0
  141. data/spec/dummy/solr/test/data/index/segments.gen +0 -0
  142. data/spec/dummy/solr/test/data/index/segments_n +0 -0
  143. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000013 +0 -0
  144. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000014 +0 -0
  145. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000015 +0 -0
  146. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000016 +0 -0
  147. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000017 +0 -0
  148. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000018 +0 -0
  149. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000019 +0 -0
  150. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000020 +0 -0
  151. data/spec/dummy/solr/test/data/tlog/tlog.0000000000000000021 +0 -0
  152. data/spec/dummy/tmp/cache/stdout +0 -479
  153. data/spec/dummy/tmp/pids/redis-test.pid +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d54c9387e424146f6b179873c0877487299d957
4
- data.tar.gz: 4b647521b23555c7f7410674b07c60c25ea20664
3
+ metadata.gz: 17d45db27bc16033db8607e141c7520a62abc6fa
4
+ data.tar.gz: 94a4f03dfba6ebcbcc40df5961fcc235b2ee277f
5
5
  SHA512:
6
- metadata.gz: f70029c5c1ec60bc87a43c2e566650e42cdd9bcaf2a9c966f7932d0255208ec963c181e9c56eeec07e16608365efeba8be4e288e57ad99b9446fa8596a3f8ed7
7
- data.tar.gz: 6b6d1e1f0772ba472b2834a7499d2b6515394419f6baa93da69152aa2134efb4874ec7ce6e27539cee12f13753db6cf183270bba16ef8bb7710cc1bc883ca993
6
+ metadata.gz: 563fefa032cca6eecf657f5da95c92688852445a491402e4fcc6bd85b8bba42a375fac11cf2ef84e057f3108d8bad084c6c9d5c4654e21fa23040782527d2354
7
+ data.tar.gz: 6cd3e4e41661d192675c644e56505885529f6b59ba9b2931251bf36ab2b1ceb6b0b6039512c42d3a3fae36eb55cf7f639240c6ad9870120ce14268fdfe1509e7
data/README.rdoc CHANGED
@@ -1,3 +1,10 @@
1
- = EnjuEvent {<img src="https://secure.travis-ci.org/nabeta/enju_event.png?branch=master" alt="Build Status" />}[http://travis-ci.org/nabeta/enju_event]
1
+ = EnjuEvent
2
+ {<img src="https://secure.travis-ci.org/next-l/enju_event.png?branch=1.1" alt="Build Status" />}[http://travis-ci.org/next-l/enju_event]
3
+ {<img src="https://coveralls.io/repos/next-l/enju_event/badge.png?branch=1.1" alt="Coverage Status" />}[https://coveralls.io/r/next-l/enju_event?branch=1.1]
4
+ {<img src="https://hakiri.io/github/next-l/enju_event/1.1.svg" alt="security" />}[https://hakiri.io/github/next-l/enju_event/1.1]
2
5
 
3
6
  This project rocks and uses MIT-LICENSE.
7
+
8
+ == 製作者・貢献者 (Authors and contributors)
9
+ * {TANABE, Kosuke}[https://github.com/nabeta] ({@nabeta}[https://twitter.com/nabeta])
10
+ * {Project Next-L}[http://www.next-l.jp] ({@ProjectNextL}[https://twitter.com/ProjectNextL])
@@ -38,7 +38,7 @@ class EventCategoriesController < ApplicationController
38
38
  # POST /event_categories
39
39
  # POST /event_categories.json
40
40
  def create
41
- @event_category = EventCategory.new(params[:event_category])
41
+ @event_category = EventCategory.new(event_category_params)
42
42
 
43
43
  respond_to do |format|
44
44
  if @event_category.save
@@ -60,7 +60,7 @@ class EventCategoriesController < ApplicationController
60
60
  end
61
61
 
62
62
  respond_to do |format|
63
- if @event_category.update_attributes(params[:event_category])
63
+ if @event_category.update_attributes(event_category_params)
64
64
  format.html { redirect_to @event_category, notice: t('controller.successfully_updated', model: t('activerecord.models.event_category')) }
65
65
  format.json { head :no_content }
66
66
  else
@@ -80,4 +80,9 @@ class EventCategoriesController < ApplicationController
80
80
  format.json { head :no_content }
81
81
  end
82
82
  end
83
+
84
+ private
85
+ def event_category_params
86
+ params.require(:event_category).permit(:name, :display_name, :note)
87
+ end
83
88
  end
@@ -53,7 +53,7 @@ class EventExportFilesController < ApplicationController
53
53
  # POST /event_export_files
54
54
  # POST /event_export_files.json
55
55
  def create
56
- @event_export_file = EventExportFile.new(params[:event_export_file])
56
+ @event_export_file = EventExportFile.new(event_export_file_params)
57
57
  @event_export_file.user = current_user
58
58
 
59
59
  respond_to do |format|
@@ -74,7 +74,7 @@ class EventExportFilesController < ApplicationController
74
74
  # PUT /event_export_files/1.json
75
75
  def update
76
76
  respond_to do |format|
77
- if @event_export_file.update_attributes(params[:event_export_file])
77
+ if @event_export_file.update_attributes(event_export_file_params)
78
78
  if @event_export_file.mode == 'export'
79
79
  EventExportFileQueue.perform(@event_export_file.id)
80
80
  end
@@ -97,4 +97,9 @@ class EventExportFilesController < ApplicationController
97
97
  format.json { head :no_content }
98
98
  end
99
99
  end
100
+
101
+ private
102
+ def event_export_file_params
103
+ params.require(:event_export_file).permit(:mode)
104
+ end
100
105
  end
@@ -40,7 +40,7 @@ class EventImportFilesController < ApplicationController
40
40
  def new
41
41
  @event_import_file = EventImportFile.new
42
42
  @event_import_file.default_library = current_user.profile.library
43
- @event_import_file.default_event_category = EventCategory.order(:position).first
43
+ @event_import_file.default_event_category = @event_categories.first
44
44
 
45
45
  respond_to do |format|
46
46
  format.html # new.html.erb
@@ -55,7 +55,7 @@ class EventImportFilesController < ApplicationController
55
55
  # POST /event_import_files
56
56
  # POST /event_import_files.json
57
57
  def create
58
- @event_import_file = EventImportFile.new(params[:event_import_file])
58
+ @event_import_file = EventImportFile.new(event_import_file_params)
59
59
  @event_import_file.user = current_user
60
60
 
61
61
  respond_to do |format|
@@ -77,7 +77,7 @@ class EventImportFilesController < ApplicationController
77
77
  # PUT /event_import_files/1.json
78
78
  def update
79
79
  respond_to do |format|
80
- if @event_import_file.update_attributes(params[:event_import_file])
80
+ if @event_import_file.update_attributes(event_import_file_params)
81
81
  if @event_import_file.mode == 'import'
82
82
  Resque.enqueue(EventImportFileQueue, @event_import_file.id)
83
83
  end
@@ -102,8 +102,16 @@ class EventImportFilesController < ApplicationController
102
102
  end
103
103
  end
104
104
 
105
+ private
106
+ def event_import_file_params
107
+ params.require(:event_import_file).permit(
108
+ :event_import, :edit_mode, :user_encoding, :mode,
109
+ :default_library_id, :default_event_category_id
110
+ )
111
+ end
112
+
105
113
  def prepare_options
106
114
  @libraries = Library.all
107
- @event_categories = EventCategory.all
115
+ @event_categories = EventCategory.order(:position)
108
116
  end
109
117
  end
@@ -36,4 +36,11 @@ class EventImportResultsController < ApplicationController
36
36
  format.json { head :no_content }
37
37
  end
38
38
  end
39
+
40
+ private
41
+ def event_import_result_params
42
+ params.require(:event_import_result).permit(
43
+ :event_id, :event_import_file_id, :body #, as: :admin
44
+ )
45
+ end
39
46
  end
@@ -96,7 +96,7 @@ class EventsController < ApplicationController
96
96
  # POST /events
97
97
  # POST /events.json
98
98
  def create
99
- @event = Event.new(params[:event])
99
+ @event = Event.new(event_params)
100
100
  @event.set_date
101
101
 
102
102
  respond_to do |format|
@@ -119,7 +119,7 @@ class EventsController < ApplicationController
119
119
  @event.set_date
120
120
 
121
121
  respond_to do |format|
122
- if @event.update_attributes(params[:event])
122
+ if @event.update_attributes(event_params)
123
123
 
124
124
  flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.event'))
125
125
  format.html { redirect_to(@event) }
@@ -144,8 +144,14 @@ class EventsController < ApplicationController
144
144
  end
145
145
 
146
146
  private
147
+ def event_params
148
+ params.require(:event).permit(
149
+ :library_id, :event_category_id, :name, :note, :start_at,
150
+ :end_at, :all_day, :display_name
151
+ )
152
+ end
153
+
147
154
  def prepare_options
148
155
  @event_categories = EventCategory.all
149
156
  end
150
-
151
157
  end
@@ -39,7 +39,7 @@ class ParticipatesController < ApplicationController
39
39
  # POST /participates
40
40
  # POST /participates.json
41
41
  def create
42
- @participate = Participate.new(params[:participate])
42
+ @participate = Participate.new(participate_params)
43
43
 
44
44
  respond_to do |format|
45
45
  if @participate.save
@@ -57,7 +57,7 @@ class ParticipatesController < ApplicationController
57
57
  # PUT /participates/1.json
58
58
  def update
59
59
  respond_to do |format|
60
- if @participate.update_attributes(params[:participate])
60
+ if @participate.update_attributes(participate_params)
61
61
  flash[:notice] = 'Participate was successfully updated.'
62
62
  format.html { redirect_to(@participate) }
63
63
  format.json { head :no_content }
@@ -78,4 +78,9 @@ class ParticipatesController < ApplicationController
78
78
  format.json { head :no_content }
79
79
  end
80
80
  end
81
+
82
+ private
83
+ def participate_params
84
+ params.require(:participate).permit(:agent_id, :event_id)
85
+ end
81
86
  end
data/app/models/event.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  class Event < ActiveRecord::Base
3
- attr_accessible :library_id, :event_category_id, :name, :note, :start_at,
4
- :end_at, :all_day, :display_name
5
-
6
3
  scope :closing_days, -> { includes(:event_category).where('event_categories.name' => 'closed') }
7
4
  scope :on, lambda {|datetime| where('start_at >= ? AND start_at < ?', datetime.beginning_of_day, datetime.tomorrow.beginning_of_day + 1)}
8
5
  scope :past, lambda {|datetime| where('end_at <= ?', Time.zone.parse(datetime).beginning_of_day)}
@@ -1,5 +1,4 @@
1
1
  class EventCategory < ActiveRecord::Base
2
- attr_accessible :name, :display_name, :note
3
2
  include MasterModel
4
3
  default_scope { order('position') }
5
4
  has_many :events
@@ -1,9 +1,15 @@
1
1
  class EventExportFile < ActiveRecord::Base
2
- attr_accessible
3
- include Statesman::Adapters::ActiveRecordModel
2
+ include Statesman::Adapters::ActiveRecordQueries
4
3
  include ExportFile
5
4
  enju_export_file_model
6
- has_attached_file :event_export
5
+ if Setting.uploaded_file.storage == :s3
6
+ has_attached_file :event_export, storage: :s3,
7
+ s3_credentials: Setting.amazon,
8
+ s3_permissions: :private
9
+ else
10
+ has_attached_file :event_export,
11
+ path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
12
+ end
7
13
  validates_attachment_content_type :event_export, :content_type => /\Atext\/plain\Z/
8
14
  has_many :event_export_file_transitions
9
15
 
@@ -34,6 +40,10 @@ class EventExportFile < ActiveRecord::Base
34
40
  def self.transition_class
35
41
  EventExportFileTransition
36
42
  end
43
+
44
+ def self.initial_state
45
+ :pending
46
+ end
37
47
  end
38
48
 
39
49
  # == Schema Information
@@ -3,7 +3,7 @@ class EventExportFileTransition < ActiveRecord::Base
3
3
 
4
4
 
5
5
  belongs_to :event_export_file, inverse_of: :event_export_file_transitions
6
- attr_accessible :to_state, :sort_key, :metadata
6
+ #attr_accessible :to_state, :sort_key, :metadata
7
7
  end
8
8
 
9
9
  # == Schema Information
@@ -1,15 +1,13 @@
1
1
  class EventImportFile < ActiveRecord::Base
2
- include Statesman::Adapters::ActiveRecordModel
2
+ include Statesman::Adapters::ActiveRecordQueries
3
3
  include ImportFile
4
- attr_accessible :event_import, :edit_mode, :user_encoding, :mode,
5
- :default_library_id, :default_event_category_id
6
4
  default_scope {order('event_import_files.id DESC')}
7
5
  scope :not_imported, -> {in_state(:pending)}
8
6
  scope :stucked, -> {in_state(:pending).where('event_import_files.created_at < ?', 1.hour.ago)}
9
7
 
10
8
  if Setting.uploaded_file.storage == :s3
11
9
  has_attached_file :event_import, storage: :s3,
12
- s3_credentials: "#{Setting.amazon}",
10
+ s3_credentials: Setting.amazon,
13
11
  s3_permissions: :private
14
12
  else
15
13
  has_attached_file :event_import,
@@ -51,7 +49,7 @@ class EventImportFile < ActiveRecord::Base
51
49
  row_num += 1
52
50
  next if row['dummy'].to_s.strip.present?
53
51
  event_import_result = EventImportResult.new
54
- event_import_result.assign_attributes({ event_import_file_id: id, body: row.fields.join("\t") }, as: :admin)
52
+ event_import_result.assign_attributes({ event_import_file_id: id, body: row.fields.join("\t") })
55
53
  event_import_result.save!
56
54
 
57
55
  event = Event.new
@@ -165,6 +163,10 @@ class EventImportFile < ActiveRecord::Base
165
163
  EventImportFileTransition
166
164
  end
167
165
 
166
+ def self.initial_state
167
+ :pending
168
+ end
169
+
168
170
  def open_import_file(tempfile)
169
171
  file = CSV.open(tempfile, col_sep: "\t")
170
172
  header_columns = %w(
@@ -178,7 +180,7 @@ class EventImportFile < ActiveRecord::Base
178
180
  end
179
181
  rows = CSV.open(tempfile, headers: header, col_sep: "\t")
180
182
  event_import_result = EventImportResult.new
181
- event_import_result.assign_attributes({ event_import_file_id: id, body: header.join("\t") }, as: :admin)
183
+ event_import_result.assign_attributes({ event_import_file_id: id, body: header.join("\t") })
182
184
  event_import_result.save!
183
185
  tempfile.close(true)
184
186
  file.close
@@ -3,7 +3,7 @@ class EventImportFileTransition < ActiveRecord::Base
3
3
 
4
4
 
5
5
  belongs_to :event_import_file, inverse_of: :event_import_file_transitions
6
- attr_accessible :to_state, :sort_key, :metadata
6
+ #attr_accessible :to_state, :sort_key, :metadata
7
7
  end
8
8
 
9
9
  # == Schema Information
@@ -1,5 +1,4 @@
1
1
  class EventImportResult < ActiveRecord::Base
2
- attr_accessible :event_id, :event_import_file_id, :body, as: :admin
3
2
  default_scope { order('event_import_results.id') }
4
3
  scope :file_id, proc{|file_id| where(event_import_file_id: file_id)}
5
4
  scope :failed, -> { where(event_id: nil) }
@@ -1,5 +1,4 @@
1
1
  class Participate < ActiveRecord::Base
2
- attr_accessible :agent_id, :event_id
3
2
  belongs_to :agent
4
3
  belongs_to :event
5
4
 
@@ -19,13 +19,13 @@
19
19
  <td><%= link_to event_export_file.id, event_export_file %></td>
20
20
  <td><%= event_export_file.user.try(:username) %></td>
21
21
  <td>
22
- <%= link_to event_export_file.event_export_file_name, event_export_file.event_export.url if event_export_file.event_export.path %>
22
+ <%= link_to event_export_file.event_export_file_name, event_export_file_path(event_export_file, format: :download) if event_export_file.event_export_file_name %>
23
23
  <br />
24
24
  <%= event_export_file.created_at %>
25
25
  </td>
26
26
  <td><%= localized_state(event_export_file.current_state) -%></td>
27
27
  <td>
28
- <%= link_to t('page.destroy'), event_export_file, method: :delete, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
28
+ <%= link_to t('page.destroy'), event_export_file, data: {confirm: t('page.are_you_sure')}, method: :delete -%>
29
29
  </td>
30
30
  </tr>
31
31
  <% end %>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p>
12
12
  <strong><%= t('activerecord.attributes.event_export_file.event_export_file_name') -%></strong>
13
- <%= link_to @event_export_file.event_export_file_name, @event_export_file.event_export.url if @event_export_file.event_export_file_name %>
13
+ <%= link_to @event_export_file.event_export_file_name, event_export_file_path(@event_export_file, format: :download) if @event_export_file.event_export_file_name %>
14
14
  </p>
15
15
 
16
16
  <p>
@@ -20,7 +20,7 @@
20
20
  <tr class="line<%= cycle("0", "1") -%>">
21
21
  <td><%= link_to (event_import_file.id), event_import_file -%></td>
22
22
  <td>
23
- <%= link_to event_import_file.event_import_file_name, event_import_file -%>
23
+ <%= link_to event_import_file.event_import_file_name, event_import_file_path(event_import_file, format: :download) if event_import_file.event_import_file_name %>
24
24
  <br />
25
25
  <%= t('activerecord.models.user') -%>: <%= link_to event_import_file.user.username, event_import_file.user.profile if event_import_file.user.try(:profile) -%></td>
26
26
  <td><%= event_import_file.edit_mode -%></td>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p>
12
12
  <strong><%= t('activerecord.attributes.event_import_file.event_import_file_name') -%>:</strong>
13
- <%= link_to @event_import_file.event_import_file_name, event_import_file_path(@event_import_file, format: :download) -%>
13
+ <%= link_to @event_import_file.event_import_file_name, event_import_file_path(@event_import_file, format: :download) if @event_import_file.event_import_file_name %>
14
14
  </p>
15
15
 
16
16
  <p>
@@ -2,7 +2,11 @@ class CreateEventImportFileTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :event_import_file_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :event_import_file_id
8
12
  t.timestamps
@@ -2,7 +2,11 @@ class CreateEventExportFileTransitions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :event_export_file_transitions do |t|
4
4
  t.string :to_state
5
- t.text :metadata, default: "{}"
5
+ if ActiveRecord::Base.configurations[Rails.env]["adapter"].try(:match, /mysql/)
6
+ t.text :metadata
7
+ else
8
+ t.text :metadata, default: "{}"
9
+ end
6
10
  t.integer :sort_key
7
11
  t.integer :event_export_file_id
8
12
  t.timestamps
@@ -1,4 +1,3 @@
1
- require "enju_seed"
2
1
  require "enju_message"
3
2
  require "paperclip"
4
3
  require "statesman"
@@ -9,7 +8,6 @@ begin
9
8
  require 'charlock_holmes/string'
10
9
  rescue LoadError
11
10
  end
12
- require "protected_attributes" if Rails::VERSION::MAJOR == 4
13
11
 
14
12
  module EnjuEvent
15
13
  class Engine < ::Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module EnjuEvent
2
- VERSION = "0.1.17.pre23"
2
+ VERSION = "0.1.17.pre24"
3
3
  end
@@ -126,7 +126,7 @@ describe EventExportFilesController do
126
126
  login_fixture_librarian
127
127
 
128
128
  it "should create agent_export_file" do
129
- post :create, :event_export_file => { }
129
+ post :create, :event_export_file => { event_export_file_name: 'test.txt' }
130
130
  assigns(:event_export_file).should be_valid
131
131
  assigns(:event_export_file).user.username.should eq @user.username
132
132
  response.should redirect_to event_export_file_url(assigns(:event_export_file))
@@ -137,7 +137,7 @@ describe EventExportFilesController do
137
137
  login_fixture_user
138
138
 
139
139
  it "should be forbidden" do
140
- post :create, :event_export_file => { }
140
+ post :create, :event_export_file => { event_export_file_name: 'test.txt' }
141
141
  assigns(:event_export_file).user.should be_nil
142
142
  response.should be_forbidden
143
143
  end
@@ -145,7 +145,7 @@ describe EventExportFilesController do
145
145
 
146
146
  describe "When not logged in" do
147
147
  it "should be redirected to new session url" do
148
- post :create, :event_export_file => { }
148
+ post :create, :event_export_file => { event_export_file_name: 'test.txt' }
149
149
  assigns(:event_export_file).user.should be_nil
150
150
  response.should redirect_to new_user_session_url
151
151
  end
@@ -197,7 +197,7 @@ describe EventExportFilesController do
197
197
  login_fixture_admin
198
198
 
199
199
  it "should update event_export_file" do
200
- put :update, :id => event_export_files(:event_export_file_00003).id, :event_export_file => { }
200
+ put :update, :id => event_export_files(:event_export_file_00003).id, :event_export_file => { event_export_file_name: 'test.txt' }
201
201
  response.should redirect_to event_export_file_url(assigns(:event_export_file))
202
202
  end
203
203
  end
@@ -206,7 +206,7 @@ describe EventExportFilesController do
206
206
  login_fixture_librarian
207
207
 
208
208
  it "should update event_export_file" do
209
- put :update, :id => event_export_files(:event_export_file_00003).id, :event_export_file => { }
209
+ put :update, :id => event_export_files(:event_export_file_00003).id, :event_export_file => { event_export_file_name: 'test.txt' }
210
210
  response.should redirect_to event_export_file_url(assigns(:event_export_file))
211
211
  end
212
212
  end
@@ -201,7 +201,7 @@ describe EventImportFilesController do
201
201
  login_fixture_librarian
202
202
 
203
203
  it "should update event_import_file" do
204
- put :update, :id => event_import_files(:event_import_file_00003).id, :event_import_file => { }
204
+ put :update, :id => event_import_files(:event_import_file_00003).id, :event_import_file => { edit_mode: 'update' }
205
205
  response.should redirect_to event_import_file_url(assigns(:event_import_file))
206
206
  end
207
207
  end
@@ -5,7 +5,6 @@ class User < ActiveRecord::Base
5
5
  :recoverable, :rememberable, :trackable, :validatable
6
6
 
7
7
  # Setup accessible (or protected) attributes for your model
8
- attr_accessible :email, :password, :password_confirmation, :remember_me
9
8
 
10
9
  enju_leaf_user_model
11
10
  enju_message_user_model
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -1,25 +1,30 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
1
+ sqlite: &sqlite
7
2
  adapter: sqlite3
8
- database: db/development.sqlite3
3
+ database: db/<%= Rails.env %>.sqlite3
4
+
5
+ mysql: &mysql
6
+ adapter: mysql2
7
+ username: root
8
+ password:
9
+ database: enju_<%= Rails.env %>
10
+
11
+ postgresql: &postgresql
12
+ adapter: postgresql
13
+ username: postgres
14
+ password:
15
+ database: enju_<%= Rails.env %>
16
+
17
+ defaults: &defaults
9
18
  pool: 5
10
19
  timeout: 5000
20
+ host: localhost
21
+ <<: *<%= ENV['DB'] || "sqlite" %>
22
+
23
+ development:
24
+ <<: *defaults
11
25
 
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
26
  test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
27
+ <<: *defaults
20
28
 
21
29
  production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
30
+ <<: *defaults
@@ -30,7 +30,7 @@ Dummy::Application.configure do
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
32
  # Raise exception on mass assignment protection for Active Record models
33
- config.active_record.mass_assignment_sanitizer = :strict
33
+ #config.active_record.mass_assignment_sanitizer = :strict
34
34
 
35
35
  # Print deprecation notices to the stderr
36
36
  config.active_support.deprecation = :stderr
@@ -10,7 +10,6 @@ class CreateReserves < ActiveRecord::Migration
10
10
  t.datetime :canceled_at
11
11
  t.datetime :expired_at
12
12
  t.datetime :deleted_at
13
- t.string :state
14
13
  t.boolean :expiration_notice_to_patron, :default => false
15
14
  t.boolean :expiration_notice_to_library, :default => false
16
15
  end
@@ -0,0 +1,15 @@
1
+ class CreateAgentMerges < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :agent_merges do |t|
4
+ t.integer :agent_id, :agent_merge_list_id, :null => false
5
+
6
+ t.timestamps
7
+ end
8
+ add_index :agent_merges, :agent_id
9
+ add_index :agent_merges, :agent_merge_list_id
10
+ end
11
+
12
+ def self.down
13
+ drop_table :agent_merges
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ class CreateAgentMergeLists < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :agent_merge_lists do |t|
4
+ t.string :title
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :agent_merge_lists
12
+ end
13
+ end