enju_leaf 1.2.0.beta.1 → 1.2.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/lib/enju_leaf/engine.rb +1 -15
  3. data/lib/enju_leaf/version.rb +1 -1
  4. data/lib/generators/enju_leaf/quick_install/quick_install_generator.rb +3 -3
  5. data/lib/generators/enju_leaf/setup/setup_generator.rb +0 -1
  6. data/spec/controllers/page_controller_spec.rb +1 -1
  7. data/spec/dummy/app/controllers/application_controller.rb +0 -1
  8. data/spec/dummy/app/helpers/application_helper.rb +2 -1
  9. data/spec/dummy/app/models/user.rb +0 -1
  10. data/spec/dummy/config/application.rb +1 -2
  11. data/{db → spec/dummy/db}/migrate/041_create_roles.rb +0 -0
  12. data/spec/dummy/db/migrate/059_create_libraries.rb +1 -5
  13. data/spec/dummy/db/migrate/069_create_shelves.rb +1 -5
  14. data/{db → spec/dummy/db}/migrate/077_create_user_groups.rb +0 -0
  15. data/spec/dummy/db/migrate/130_create_request_status_types.rb +1 -5
  16. data/spec/dummy/db/migrate/131_create_request_types.rb +1 -5
  17. data/spec/dummy/db/migrate/20100314190054_add_opening_hour_to_library.rb +9 -0
  18. data/{db → spec/dummy/db}/migrate/20100606065209_create_user_has_roles.rb +0 -0
  19. data/{db → spec/dummy/db}/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb +0 -0
  20. data/spec/dummy/db/migrate/20111129044509_add_pickup_location_to_reserve.rb +6 -0
  21. data/{db → spec/dummy/db}/migrate/20130221154434_add_additional_attributes_to_user.rb +0 -0
  22. data/spec/dummy/db/migrate/20130412083556_add_latitude_and_longitude_to_library.rb +6 -0
  23. data/{db → spec/dummy/db}/migrate/20140110122216_create_user_import_files.rb +0 -0
  24. data/{db → spec/dummy/db}/migrate/20140110131010_create_user_import_results.rb +0 -0
  25. data/{db → spec/dummy/db}/migrate/20140122054321_create_profiles.rb +0 -0
  26. data/{db → spec/dummy/db}/migrate/20140524074813_create_user_import_file_transitions.rb +0 -0
  27. data/{db → spec/dummy/db}/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +0 -0
  28. data/{db → spec/dummy/db}/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +0 -0
  29. data/{db → spec/dummy/db}/migrate/20140709113413_create_user_export_files.rb +0 -0
  30. data/{db → spec/dummy/db}/migrate/20140709113905_create_user_export_file_transitions.rb +0 -0
  31. data/{db → spec/dummy/db}/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +0 -0
  32. data/{db → spec/dummy/db}/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +0 -0
  33. data/{db → spec/dummy/db}/migrate/20140811031145_add_expired_at_to_profile.rb +0 -0
  34. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +14 -0
  35. data/{db → spec/dummy/db}/migrate/20141003181336_add_full_name_transcription_to_profile.rb +0 -0
  36. data/{db → spec/dummy/db}/migrate/20141003182825_add_date_of_birth_to_profile.rb +0 -0
  37. data/spec/dummy/db/migrate/20141020120523_add_library_id_to_checkout.rb +6 -0
  38. data/spec/dummy/db/migrate/20150106001709_create_demands.rb +14 -0
  39. data/{db → spec/dummy/db}/migrate/20150421023923_create_identities.rb +0 -0
  40. data/{db → spec/dummy/db}/migrate/20150506105356_add_error_message_to_user_import_result.rb +0 -0
  41. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +13 -0
  42. data/{db → spec/dummy/db}/migrate/20151126005552_add_provider_to_identity.rb +0 -0
  43. data/spec/dummy/db/migrate/20160610093229_add_html_snippet_to_library_group.rb +5 -0
  44. data/{db → spec/dummy/db}/migrate/20160627232219_add_most_recent_to_user_import_file_transitions.rb +0 -0
  45. data/{db → spec/dummy/db}/migrate/20160627232316_add_most_recent_to_user_export_file_transitions.rb +0 -0
  46. data/spec/dummy/db/migrate/20160703184619_add_most_recent_to_reserve_transitions.rb +9 -0
  47. data/spec/dummy/db/migrate/20160703184650_add_most_recent_to_manifestation_checkout_stat_transitions.rb +9 -0
  48. data/spec/dummy/db/migrate/20160703184723_add_most_recent_to_manifestation_reserve_stat_transitions.rb +9 -0
  49. data/spec/dummy/db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb +9 -0
  50. data/spec/dummy/db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb +9 -0
  51. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +9 -0
  52. data/spec/dummy/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +5 -0
  53. data/spec/dummy/db/schema.rb +47 -12
  54. data/spec/fixtures/library_groups.yml +1 -4
  55. data/spec/models/user_spec.rb +0 -22
  56. data/spec/rails_helper.rb +1 -1
  57. data/spec/views/page/index.html.erb_spec.rb +0 -2
  58. metadata +96 -337
  59. data/app/controllers/concerns/enju_leaf/controller.rb +0 -225
  60. data/app/controllers/my_accounts_controller.rb +0 -93
  61. data/app/controllers/names_controller.rb +0 -60
  62. data/app/controllers/profiles_controller.rb +0 -219
  63. data/app/controllers/roles_controller.rb +0 -61
  64. data/app/controllers/user_export_files_controller.rb +0 -116
  65. data/app/controllers/user_groups_controller.rb +0 -118
  66. data/app/controllers/user_import_files_controller.rb +0 -129
  67. data/app/controllers/user_import_results_controller.rb +0 -57
  68. data/app/mailers/notifier.rb +0 -30
  69. data/app/models/identity.rb +0 -9
  70. data/app/models/profile.rb +0 -101
  71. data/app/models/role.rb +0 -50
  72. data/app/models/user_export_file.rb +0 -67
  73. data/app/models/user_export_file_state_machine.rb +0 -15
  74. data/app/models/user_export_file_transition.rb +0 -20
  75. data/app/models/user_group.rb +0 -29
  76. data/app/models/user_has_role.rb +0 -19
  77. data/app/models/user_import_file.rb +0 -352
  78. data/app/models/user_import_file_state_machine.rb +0 -19
  79. data/app/models/user_import_file_transition.rb +0 -20
  80. data/app/models/user_import_result.rb +0 -20
  81. data/app/policies/application_policy.rb +0 -53
  82. data/app/policies/name_policy.rb +0 -21
  83. data/app/policies/profile_policy.rb +0 -55
  84. data/app/policies/role_policy.rb +0 -21
  85. data/app/policies/user_export_file_policy.rb +0 -21
  86. data/app/policies/user_group_policy.rb +0 -22
  87. data/app/policies/user_import_file_policy.rb +0 -21
  88. data/app/policies/user_import_result_policy.rb +0 -21
  89. data/app/views/my_accounts/_edit_credential.html.erb +0 -99
  90. data/app/views/my_accounts/_form.html.erb +0 -24
  91. data/app/views/my_accounts/_show.html.erb +0 -1
  92. data/app/views/my_accounts/edit.html.erb +0 -32
  93. data/app/views/my_accounts/show.html+phone.erb +0 -1
  94. data/app/views/my_accounts/show.html.erb +0 -49
  95. data/app/views/names/_form.html.erb +0 -41
  96. data/app/views/names/edit.html.erb +0 -6
  97. data/app/views/names/index.html.erb +0 -37
  98. data/app/views/names/new.html.erb +0 -5
  99. data/app/views/names/show.html.erb +0 -34
  100. data/app/views/profiles/_edit_credential.html.erb +0 -88
  101. data/app/views/profiles/_edit_profile.html.erb +0 -42
  102. data/app/views/profiles/_form.html.erb +0 -15
  103. data/app/views/profiles/_show.html.erb +0 -1
  104. data/app/views/profiles/edit.html.erb +0 -33
  105. data/app/views/profiles/index.html.erb +0 -70
  106. data/app/views/profiles/new.html.erb +0 -88
  107. data/app/views/profiles/show.html+phone.erb +0 -1
  108. data/app/views/profiles/show.html.erb +0 -71
  109. data/app/views/roles/_form.html.erb +0 -19
  110. data/app/views/roles/edit.html.erb +0 -13
  111. data/app/views/roles/index.html.erb +0 -32
  112. data/app/views/roles/new.html.erb +0 -12
  113. data/app/views/roles/show.html.erb +0 -46
  114. data/app/views/user_export_files/_form.html.erb +0 -12
  115. data/app/views/user_export_files/edit.html.erb +0 -6
  116. data/app/views/user_export_files/index.html.erb +0 -44
  117. data/app/views/user_export_files/new.html.erb +0 -16
  118. data/app/views/user_export_files/show.html.erb +0 -36
  119. data/app/views/user_groups/_form.html.erb +0 -40
  120. data/app/views/user_groups/edit.html.erb +0 -13
  121. data/app/views/user_groups/index.html.erb +0 -51
  122. data/app/views/user_groups/new.html.erb +0 -12
  123. data/app/views/user_groups/show.html.erb +0 -68
  124. data/app/views/user_import_files/_form.html.erb +0 -61
  125. data/app/views/user_import_files/_results.html.erb +0 -22
  126. data/app/views/user_import_files/edit.html.erb +0 -6
  127. data/app/views/user_import_files/index.html.erb +0 -45
  128. data/app/views/user_import_files/new.html.erb +0 -60
  129. data/app/views/user_import_files/show.html.erb +0 -85
  130. data/app/views/user_import_results/_form.html.erb +0 -29
  131. data/app/views/user_import_results/_list.html.erb +0 -22
  132. data/app/views/user_import_results/_list_lines.html.erb +0 -24
  133. data/app/views/user_import_results/index.html.erb +0 -25
  134. data/app/views/user_import_results/index.txt.erb +0 -3
  135. data/app/views/user_import_results/show.html.erb +0 -33
  136. data/db/migrate/20091202124834_create_versions.rb +0 -18
  137. data/spec/controllers/my_accounts_controller_spec.rb +0 -229
  138. data/spec/controllers/profiles_controller_spec.rb +0 -594
  139. data/spec/controllers/roles_controller_spec.rb +0 -136
  140. data/spec/controllers/user_export_files_controller_spec.rb +0 -296
  141. data/spec/controllers/user_groups_controller_spec.rb +0 -443
  142. data/spec/controllers/user_import_files_controller_spec.rb +0 -305
  143. data/spec/controllers/user_import_results_controller_spec.rb +0 -157
  144. data/spec/fixtures/user_export_files.yml +0 -25
  145. data/spec/fixtures/user_import_files.yml +0 -51
  146. data/spec/fixtures/user_import_results.yml +0 -26
  147. data/spec/fixtures/user_reserve_stats.yml +0 -27
  148. data/spec/models/basket_spec.rb +0 -23
  149. data/spec/models/profile_spec.rb +0 -98
  150. data/spec/models/role_spec.rb +0 -40
  151. data/spec/models/user_export_file_spec.rb +0 -30
  152. data/spec/models/user_group_spec.rb +0 -37
  153. data/spec/models/user_has_role_spec.rb +0 -18
  154. data/spec/models/user_import_file_spec.rb +0 -220
  155. data/spec/models/user_import_result_spec.rb +0 -20
  156. data/spec/requests/profiles_spec.rb +0 -9
  157. data/spec/routing/profiles_routing_spec.rb +0 -35
  158. data/spec/routing/resource_import_files_routing_spec.rb +0 -35
  159. data/spec/routing/roles_routing_spec.rb +0 -35
  160. data/spec/routing/users_spec.rb +0 -14
  161. data/spec/views/my_accounts/show.html.erb_spec.rb +0 -43
  162. data/spec/views/profiles/edit.html.erb_spec.rb +0 -42
  163. data/spec/views/profiles/index.html.erb_spec.rb +0 -19
  164. data/spec/views/profiles/new.html.erb_spec.rb +0 -25
  165. data/spec/views/profiles/show.html.erb_spec.rb +0 -31
  166. data/spec/views/user_export_files/new.html.erb_spec.rb +0 -19
  167. data/spec/views/user_import_results/index.html.erb_spec.rb +0 -29
@@ -1,61 +0,0 @@
1
- class RolesController < ApplicationController
2
- before_action :set_role, only: [:show, :edit, :update, :destroy]
3
- before_action :check_policy, only: [:index, :new, :create]
4
-
5
- # GET /roles
6
- # GET /roles.json
7
- def index
8
- @roles = Role.order(:position)
9
-
10
- respond_to do |format|
11
- format.html # index.html.erb
12
- format.json { render json: @roles }
13
- end
14
- end
15
-
16
- # GET /roles/1
17
- # GET /roles/1.json
18
- def show
19
- respond_to do |format|
20
- format.html # show.html.erb
21
- format.json { render json: @role }
22
- end
23
- end
24
-
25
- # GET /roles/1/edit
26
- def edit
27
- end
28
-
29
- # PUT /roles/1
30
- # PUT /roles/1.json
31
- def update
32
- if params[:move]
33
- move_position(@role, params[:move])
34
- return
35
- end
36
-
37
- respond_to do |format|
38
- if @role.update_attributes(role_params)
39
- format.html { redirect_to @role, notice: t('controller.successfully_updated', model: t('activerecord.models.role')) }
40
- format.json { head :no_content }
41
- else
42
- format.html { render action: "edit" }
43
- format.json { render json: @role.errors, status: :unprocessable_entity }
44
- end
45
- end
46
- end
47
-
48
- private
49
- def set_role
50
- @role = Role.find(params[:id])
51
- authorize @role
52
- end
53
-
54
- def check_policy
55
- authorize Role
56
- end
57
-
58
- def role_params
59
- params.require(:role).permit(:name, :display_name, :note)
60
- end
61
- end
@@ -1,116 +0,0 @@
1
- class UserExportFilesController < ApplicationController
2
- before_action :set_user_export_file, only: [:show, :edit, :update, :destroy]
3
- before_action :check_policy, only: [:index, :new, :create]
4
-
5
- # GET /user_export_files
6
- # GET /user_export_files.json
7
- def index
8
- @user_export_files = UserExportFile.order('id DESC').page(params[:page])
9
-
10
- respond_to do |format|
11
- format.html # index.html.erb
12
- format.json { render json: @user_export_files }
13
- end
14
- end
15
-
16
- # GET /user_export_files/1
17
- # GET /user_export_files/1.json
18
- def show
19
- if @user_export_file.user_export.path
20
- unless ENV['ENJU_STORAGE'] == 's3'
21
- file = @user_export_file.user_export.path
22
- end
23
- end
24
-
25
- respond_to do |format|
26
- format.html # show.html.erb
27
- format.json { render json: @user_export_file }
28
- format.download {
29
- if ENV['ENJU_STORAGE'] == 's3'
30
- send_data Faraday.get(@user_export_file.user_export.expiring_url).body.force_encoding('UTF-8'),
31
- filename: File.basename(@user_export_file.user_export_file_name), type: 'application/octet-stream'
32
- else
33
- send_file file, filename: @user_export_file.user_export_file_name, type: 'application/octet-stream'
34
- end
35
- }
36
- end
37
- end
38
-
39
- # GET /user_export_files/new
40
- # GET /user_export_files/new.json
41
- def new
42
- @user_export_file = UserExportFile.new
43
- @user_export_file.user = current_user
44
-
45
- respond_to do |format|
46
- format.html # new.html.erb
47
- format.json { render json: @user_export_file }
48
- end
49
- end
50
-
51
- # GET /user_export_files/1/edit
52
- def edit
53
- end
54
-
55
- # POST /user_export_files
56
- # POST /user_export_files.json
57
- def create
58
- @user_export_file = UserExportFile.new(user_export_file_params)
59
- @user_export_file.user = current_user
60
-
61
- respond_to do |format|
62
- if @user_export_file.save
63
- if @user_export_file.mode == 'export'
64
- UserExportFileJob.perform_later(@user_export_file)
65
- end
66
- format.html { redirect_to @user_export_file, notice: t('export.successfully_created', model: t('activerecord.models.user_export_file')) }
67
- format.json { render json: @user_export_file, status: :created, location: @user_export_file }
68
- else
69
- format.html { render action: "new" }
70
- format.json { render json: @user_export_file.errors, status: :unprocessable_entity }
71
- end
72
- end
73
- end
74
-
75
- # PUT /user_export_files/1
76
- # PUT /user_export_files/1.json
77
- def update
78
- respond_to do |format|
79
- if @user_export_file.update_attributes(user_export_file_params)
80
- if @user_export_file.mode == 'export'
81
- UserExportFileJob.perform_later(@user_export_file)
82
- end
83
- format.html { redirect_to @user_export_file, notice: t('controller.successfully_updated', model: t('activerecord.models.user_export_file')) }
84
- format.json { head :no_content }
85
- else
86
- format.html { render action: "edit" }
87
- format.json { render json: @user_export_file.errors, status: :unprocessable_entity }
88
- end
89
- end
90
- end
91
-
92
- # DELETE /user_export_files/1
93
- # DELETE /user_export_files/1.json
94
- def destroy
95
- @user_export_file.destroy
96
-
97
- respond_to do |format|
98
- format.html { redirect_to user_export_files_url }
99
- format.json { head :no_content }
100
- end
101
- end
102
-
103
- private
104
- def set_user_export_file
105
- @user_export_file = UserExportFile.find(params[:id])
106
- authorize @user_export_file
107
- end
108
-
109
- def check_policy
110
- authorize UserExportFile
111
- end
112
-
113
- def user_export_file_params
114
- params.require(:user_export_file).permit(:mode)
115
- end
116
- end
@@ -1,118 +0,0 @@
1
- class UserGroupsController < ApplicationController
2
- before_action :set_user_group, only: [:show, :edit, :update, :destroy]
3
- before_action :check_policy, only: [:index, :new, :create]
4
- before_action :prepare_options, only: [:new, :edit]
5
-
6
- # GET /user_groups
7
- # GET /user_groups.json
8
- def index
9
- @user_groups = UserGroup.order(:position)
10
-
11
- respond_to do |format|
12
- format.html # index.html.erb
13
- format.json { render json: @user_groups }
14
- end
15
- end
16
-
17
- # GET /user_groups/1
18
- # GET /user_groups/1.json
19
- def show
20
- respond_to do |format|
21
- format.html # show.html.erb
22
- format.json { render json: @user_group }
23
- end
24
- end
25
-
26
- # GET /user_groups/new
27
- def new
28
- @user_group = UserGroup.new
29
-
30
- respond_to do |format|
31
- format.html # new.html.erb
32
- format.json { render json: @user_group }
33
- end
34
- end
35
-
36
- # GET /user_groups/1/edit
37
- def edit
38
- end
39
-
40
- # POST /user_groups
41
- # POST /user_groups.json
42
- def create
43
- @user_group = UserGroup.new(user_group_params)
44
-
45
- respond_to do |format|
46
- if @user_group.save
47
- format.html { redirect_to @user_group, notice: t('controller.successfully_created', model: t('activerecord.models.user_group')) }
48
- format.json { render json: @user_group, status: :created, location: @user_group }
49
- else
50
- prepare_options
51
- format.html { render action: "new" }
52
- format.json { render json: @user_group.errors, status: :unprocessable_entity }
53
- end
54
- end
55
- end
56
-
57
- # PUT /user_groups/1
58
- # PUT /user_groups/1.json
59
- def update
60
- if params[:move]
61
- move_position(@user_group, params[:move])
62
- return
63
- end
64
-
65
- respond_to do |format|
66
- if @user_group.update_attributes(user_group_params)
67
- format.html { redirect_to @user_group, notice: t('controller.successfully_updated', model: t('activerecord.models.user_group')) }
68
- format.json { head :no_content }
69
- else
70
- prepare_options
71
- format.html { render action: "edit" }
72
- format.json { render json: @user_group.errors, status: :unprocessable_entity }
73
- end
74
- end
75
- end
76
-
77
- # DELETE /user_groups/1
78
- # DELETE /user_groups/1.json
79
- def destroy
80
- @user_group.destroy
81
-
82
- respond_to do |format|
83
- format.html { redirect_to user_groups_url }
84
- format.json { head :no_content }
85
- end
86
- end
87
-
88
- private
89
- def set_user_group
90
- @user_group = UserGroup.find(params[:id])
91
- authorize @user_group
92
- end
93
-
94
- def check_policy
95
- authorize UserGroup
96
- end
97
-
98
- def user_group_params
99
- params.require(:user_group).permit(
100
- :name, :display_name, :note, :valid_period_for_new_user,
101
- :expired_at, :number_of_day_to_notify_overdue,
102
- :number_of_day_to_notify_overdue,
103
- :number_of_day_to_notify_due_date,
104
- :number_of_time_to_notify_overdue,
105
- # EnjuCirculation
106
- {:user_group_has_checkout_types_attributes => [
107
- :id, :checkout_type_id, :checkout_limit, :checkout_period, :checkout_renewal_limit,
108
- :reservation_limit, :reservation_expired_period, :set_due_date_before_closing_day
109
- ]},
110
- )
111
- end
112
-
113
- def prepare_options
114
- if defined?(EnjuCirculation)
115
- @checkout_types = CheckoutType.select([:id, :display_name, :position])
116
- end
117
- end
118
- end
@@ -1,129 +0,0 @@
1
- class UserImportFilesController < ApplicationController
2
- before_action :set_user_import_file, only: [:show, :edit, :update, :destroy]
3
- before_action :check_policy, only: [:index, :new, :create]
4
- before_action :prepare_options, only: [:new, :edit]
5
-
6
- # GET /user_import_files
7
- # GET /user_import_files.json
8
- def index
9
- @user_import_files = UserImportFile.order('id DESC').page(params[:page])
10
-
11
- respond_to do |format|
12
- format.html # index.html.erb
13
- format.json { render json: @user_import_files }
14
- end
15
- end
16
-
17
- # GET /user_import_files/1
18
- # GET /user_import_files/1.json
19
- def show
20
- if @user_import_file.user_import.path
21
- unless ENV['ENJU_STORAGE'] == 's3'
22
- file = @user_import_file.user_import.path
23
- end
24
- end
25
- @user_import_results = @user_import_file.user_import_results.page(params[:page])
26
-
27
- respond_to do |format|
28
- format.html # show.html.erb
29
- format.json { render json: @user_import_file }
30
- format.download {
31
- if ENV['ENJU_STORAGE'] == 's3'
32
- send_data Faraday.get(@user_import_file.user_import.expiring_url).body.force_encoding('UTF-8'),
33
- filename: File.basename(@user_import_file.user_import_file_name), type: 'application/octet-stream'
34
- else
35
- send_file file, filename: @user_import_file.user_import_file_name, type: 'application/octet-stream'
36
- end
37
- }
38
- end
39
- end
40
-
41
- # GET /user_import_files/new
42
- # GET /user_import_files/new.json
43
- def new
44
- @user_import_file = UserImportFile.new
45
- @user_import_file.default_user_group = current_user.profile.user_group
46
- @user_import_file.default_library = current_user.profile.library
47
-
48
- respond_to do |format|
49
- format.html # new.html.erb
50
- format.json { render json: @user_import_file }
51
- end
52
- end
53
-
54
- # GET /user_import_files/1/edit
55
- def edit
56
- end
57
-
58
- # POST /user_import_files
59
- # POST /user_import_files.json
60
- def create
61
- @user_import_file = UserImportFile.new(user_import_file_params)
62
- @user_import_file.user = current_user
63
-
64
- respond_to do |format|
65
- if @user_import_file.save
66
- if @user_import_file.mode == 'import'
67
- UserImportFileJob.perform_later(@user_import_file)
68
- end
69
- format.html { redirect_to @user_import_file, notice: t('import.successfully_created', model: t('activerecord.models.user_import_file')) }
70
- format.json { render json: @user_import_file, status: :created, location: @user_import_file }
71
- else
72
- prepare_options
73
- format.html { render action: "new" }
74
- format.json { render json: @user_import_file.errors, status: :unprocessable_entity }
75
- end
76
- end
77
- end
78
-
79
- # PUT /user_import_files/1
80
- # PUT /user_import_files/1.json
81
- def update
82
- respond_to do |format|
83
- if @user_import_file.update_attributes(user_import_file_params)
84
- if @user_import_file.mode == 'import'
85
- UserImportFileJob.perform_later(@user_import_file)
86
- end
87
- format.html { redirect_to @user_import_file, notice: t('controller.successfully_updated', model: t('activerecord.models.user_import_file')) }
88
- format.json { head :no_content }
89
- else
90
- prepare_options
91
- format.html { render action: "edit" }
92
- format.json { render json: @user_import_file.errors, status: :unprocessable_entity }
93
- end
94
- end
95
- end
96
-
97
- # DELETE /user_import_files/1
98
- # DELETE /user_import_files/1.json
99
- def destroy
100
- @user_import_file.destroy
101
-
102
- respond_to do |format|
103
- format.html { redirect_to(user_import_files_url) }
104
- format.json { head :no_content }
105
- end
106
- end
107
-
108
- private
109
- def set_user_import_file
110
- @user_import_file = UserImportFile.find(params[:id])
111
- authorize @user_import_file
112
- end
113
-
114
- def check_policy
115
- authorize UserImportFile
116
- end
117
-
118
- def user_import_file_params
119
- params.require(:user_import_file).permit(
120
- :user_import, :edit_mode, :user_encoding, :mode,
121
- :default_user_group_id, :default_library_id
122
- )
123
- end
124
-
125
- def prepare_options
126
- @user_groups = UserGroup.all
127
- @libraries = Library.all
128
- end
129
- end
@@ -1,57 +0,0 @@
1
- class UserImportResultsController < ApplicationController
2
- before_action :set_user_import_result, only: [:show, :edit, :update, :destroy]
3
- before_action :check_policy, only: [:index, :new, :create]
4
-
5
- # GET /user_import_results
6
- # GET /user_import_results.json
7
- def index
8
- @user_import_file = UserImportFile.where(id: params[:user_import_file_id]).first
9
- if @user_import_file
10
- @user_import_results = @user_import_file.user_import_results.page(params[:page])
11
- else
12
- @user_import_results = UserImportResult.page(params[:page])
13
- end
14
-
15
- respond_to do |format|
16
- format.html # index.html.erb
17
- format.json { render json: @user_import_results }
18
- format.txt
19
- end
20
- end
21
-
22
- # GET /user_import_results/1
23
- # GET /user_import_results/1.json
24
- def show
25
- respond_to do |format|
26
- format.html # show.html.erb
27
- format.json { render json: @user_import_result }
28
- end
29
- end
30
-
31
- # DELETE /user_import_results/1
32
- # DELETE /user_import_results/1.json
33
- def destroy
34
- @user_import_result.destroy
35
-
36
- respond_to do |format|
37
- format.html { redirect_to user_import_results_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.user_import_result')) }
38
- format.json { head :no_content }
39
- end
40
- end
41
-
42
- private
43
- def set_user_import_result
44
- @user_import_result = UserImportResult.find(params[:id])
45
- authorize @user_import_result
46
- end
47
-
48
- def check_policy
49
- authorize UserImportResult
50
- end
51
-
52
- def user_import_result_params
53
- params.require(:user_import_result).permit(
54
- :user_import_file_id, :user_id, :body
55
- )
56
- end
57
- end