enju_event 0.3.2 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/app/controllers/concerns/enju_event/enju_libraries_controller.rb +17 -0
  4. data/app/controllers/event_categories_controller.rb +1 -1
  5. data/app/controllers/event_export_files_controller.rb +1 -1
  6. data/app/controllers/event_import_files_controller.rb +3 -2
  7. data/app/controllers/event_import_results_controller.rb +4 -4
  8. data/app/controllers/events_controller.rb +8 -2
  9. data/app/controllers/participates_controller.rb +1 -1
  10. data/app/controllers/places_controller.rb +1 -1
  11. data/app/jobs/event_export_file_job.rb +1 -1
  12. data/app/jobs/event_import_file_job.rb +1 -1
  13. data/app/mailers/event_export_mailer.rb +17 -0
  14. data/app/mailers/event_import_mailer.rb +17 -0
  15. data/app/models/concerns/enju_event/enju_library.rb +15 -0
  16. data/app/models/event.rb +37 -24
  17. data/app/models/event_category.rb +1 -1
  18. data/app/models/event_export_file.rb +15 -10
  19. data/app/models/event_export_file_transition.rb +1 -1
  20. data/app/models/event_import_file.rb +18 -12
  21. data/app/models/event_import_file_transition.rb +1 -1
  22. data/app/models/event_import_result.rb +7 -2
  23. data/app/models/participate.rb +1 -1
  24. data/app/models/place.rb +1 -1
  25. data/app/views/event_categories/_form.html.erb +1 -1
  26. data/app/views/event_export_mailer/completed.en.text.erb +9 -0
  27. data/app/views/event_export_mailer/completed.ja.text.erb +9 -0
  28. data/app/views/event_export_mailer/failed.en.text.erb +9 -0
  29. data/app/views/event_export_mailer/failed.ja.text.erb +9 -0
  30. data/app/views/event_import_files/_results.html.erb +26 -0
  31. data/app/views/event_import_files/show.html.erb +70 -74
  32. data/app/views/event_import_mailer/completed.en.text.erb +9 -0
  33. data/app/views/event_import_mailer/completed.ja.text.erb +9 -0
  34. data/app/views/event_import_mailer/failed.en.text.erb +9 -0
  35. data/app/views/event_import_mailer/failed.ja.text.erb +9 -0
  36. data/app/views/event_import_results/index.html.erb +0 -11
  37. data/app/views/event_import_results/index.text.ruby +5 -0
  38. data/app/views/events/index.html.erb +22 -22
  39. data/app/views/events/index.text.ruby +7 -0
  40. data/app/views/layouts/mailer.html.erb +13 -0
  41. data/app/views/layouts/mailer.text.erb +1 -0
  42. data/config/brakeman.ignore +66 -0
  43. data/config/locales/translation_en.yml +12 -0
  44. data/config/locales/translation_ja.yml +12 -0
  45. data/lib/enju_event/engine.rb +0 -1
  46. data/lib/enju_event/version.rb +1 -1
  47. data/lib/generators/enju_event/setup/setup_generator.rb +1 -1
  48. data/spec/controllers/event_import_files_controller_spec.rb +2 -2
  49. data/spec/controllers/event_import_results_controller_spec.rb +2 -2
  50. data/spec/controllers/events_controller_spec.rb +2 -2
  51. data/spec/controllers/libraries_controller_spec.rb +41 -0
  52. data/spec/dummy/app/assets/config/manifest.js +5 -0
  53. data/spec/dummy/app/jobs/application_job.rb +7 -0
  54. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  55. data/spec/dummy/app/models/application_record.rb +3 -0
  56. data/spec/dummy/app/models/user.rb +1 -1
  57. data/spec/dummy/config/application.rb +1 -1
  58. data/spec/dummy/config/initializers/assets.rb +1 -0
  59. data/spec/dummy/config/initializers/mime_types.rb +1 -0
  60. data/spec/dummy/config/storage.yml +34 -0
  61. data/spec/dummy/db/migrate/20081025083323_create_countries.rb +4 -4
  62. data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
  63. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
  64. data/spec/dummy/db/migrate/20150421023923_create_identities.rb +14 -0
  65. data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
  66. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -8
  67. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  68. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
  69. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
  70. data/spec/dummy/db/migrate/20181026064038_add_login_banner_to_library_group.rb +6 -0
  71. data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
  72. data/spec/dummy/db/migrate/20181030074920_add_not_null_to_position_on_library.rb +14 -0
  73. data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
  74. data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +10 -0
  75. data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +7 -0
  76. data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +5 -0
  77. data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +5 -0
  78. data/spec/dummy/db/migrate/20191219122214_create_custom_properties.rb +12 -0
  79. data/spec/dummy/db/migrate/20200425072340_create_manifestation_custom_properties.rb +12 -0
  80. data/spec/dummy/db/migrate/20200425072349_create_item_custom_properties.rb +12 -0
  81. data/spec/dummy/db/migrate/20200425074758_create_manifestation_custom_values.rb +12 -0
  82. data/spec/dummy/db/migrate/20200425074822_create_item_custom_values.rb +12 -0
  83. data/spec/dummy/db/schema.rb +131 -304
  84. data/spec/factories/event_export_file.rb +5 -0
  85. data/spec/factories/event_import_file.rb +7 -0
  86. data/spec/factories/event_import_result.rb +6 -0
  87. data/spec/mailers/event_export_spec.rb +5 -0
  88. data/spec/mailers/event_import_spec.rb +5 -0
  89. data/spec/mailers/previews/event_export_preview.rb +4 -0
  90. data/spec/mailers/previews/event_import_preview.rb +4 -0
  91. data/spec/models/event_export_file_spec.rb +1 -1
  92. data/spec/models/event_import_file_spec.rb +1 -1
  93. data/spec/rails_helper.rb +6 -0
  94. data/spec/system/event_import_results_spec.rb +17 -0
  95. data/spec/system/events_spec.rb +22 -0
  96. data/spec/views/event_import_results/index.text.ruby_spec.rb +22 -0
  97. data/spec/views/events/index.json.jbuilder_spec.rb +22 -0
  98. metadata +405 -315
  99. data/README.rdoc +0 -10
  100. data/app/views/event_import_results/index.txt.erb +0 -3
  101. data/app/views/events/index.txt.erb +0 -4
  102. data/spec/dummy/db/migrate/032_create_checkins.rb +0 -17
  103. data/spec/dummy/db/migrate/033_create_checkouts.rb +0 -25
  104. data/spec/dummy/db/migrate/035_create_reserves.rb +0 -26
  105. data/spec/dummy/db/migrate/121_create_checked_items.rb +0 -17
  106. data/spec/dummy/db/migrate/127_create_use_restrictions.rb +0 -16
  107. data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +0 -16
  108. data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +0 -16
  109. data/spec/dummy/db/migrate/20081030023412_create_checkout_types.rb +0 -17
  110. data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +0 -25
  111. data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +0 -18
  112. data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +0 -17
  113. data/spec/dummy/db/migrate/20081212080038_create_manifestation_checkout_stats.rb +0 -15
  114. data/spec/dummy/db/migrate/20081215094302_create_user_checkout_stats.rb +0 -15
  115. data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +0 -17
  116. data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +0 -17
  117. data/spec/dummy/db/migrate/20081216190724_create_manifestation_reserve_stats.rb +0 -15
  118. data/spec/dummy/db/migrate/20081220023628_create_user_reserve_stats.rb +0 -15
  119. data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +0 -17
  120. data/spec/dummy/db/migrate/20090321130448_add_completed_at_to_user_checkout_stat.rb +0 -23
  121. data/spec/dummy/db/migrate/20110301134521_add_expire_date_to_reserve.rb +0 -9
  122. data/spec/dummy/db/migrate/20110328130826_add_current_checkout_count_to_user_group_has_checkout_type.rb +0 -9
  123. data/spec/dummy/db/migrate/20110621093332_remove_expire_date_from_reserve.rb +0 -9
  124. data/spec/dummy/db/migrate/20111217234412_add_save_checkout_history_to_user.rb +0 -5
  125. data/spec/dummy/db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb +0 -6
  126. data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +0 -5
  127. data/spec/dummy/db/migrate/20130303124821_add_retained_at_to_reserve.rb +0 -5
  128. data/spec/dummy/db/migrate/20130304015019_add_postponed_at_to_reserve.rb +0 -5
  129. data/spec/dummy/db/migrate/20130416054135_add_circulation_status_id_to_item.rb +0 -8
  130. data/spec/dummy/db/migrate/20130519065638_add_lock_version_to_reserve.rb +0 -5
  131. data/spec/dummy/db/migrate/20130519065837_add_lock_version_to_checkin.rb +0 -5
  132. data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +0 -18
  133. data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +0 -18
  134. data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +0 -18
  135. data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +0 -18
  136. data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +0 -18
  137. data/spec/dummy/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb +0 -12
  138. data/spec/dummy/db/migrate/20140810091231_add_checkout_icalendar_token_to_profile.rb +0 -6
  139. data/spec/dummy/db/migrate/20140810091417_add_save_checkout_history_to_profile.rb +0 -5
  140. data/spec/dummy/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +0 -6
  141. data/spec/support/resque.rb +0 -32
@@ -1,85 +1,81 @@
1
1
  <div id="content_detail" class="ui-corner-all ui-widget-content">
2
- <h1 class="title"><%= t('page.showing', model: t('activerecord.models.event_import_file')) -%></h1>
3
- <div id="content_list">
4
- <p id="notice"><%= notice %></p>
5
-
6
- <p>
7
- <strong>Id:</strong>
8
- <%= @event_import_file.id -%>
9
- </p>
10
-
11
- <p>
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) if @event_import_file.event_import_file_name %>
14
- </p>
15
-
16
- <p>
17
- <strong><%= t('activerecord.attributes.event_import_file.event_import_content_type') -%>:</strong>
18
- <%= @event_import_file.event_import_content_type -%>
19
- </p>
20
-
21
- <p>
22
- <strong><%= t('activerecord.attributes.event_import_file.event_import_file_size') -%>:</strong>
23
- <%= @event_import_file.event_import_file_size -%>
24
- </p>
25
-
26
- <p>
27
- <strong><%= t('activerecord.attributes.event_import_file.event_import_fingerprint') -%>:</strong>
28
- <%= @event_import_file.event_import_fingerprint -%>
29
- </p>
30
-
31
- <p>
32
- <strong><%= t('page.created_at') -%>:</strong>
33
- <%= l(@event_import_file.created_at) if @event_import_file.created_at -%>
34
- </p>
35
-
36
- <p>
37
- <strong><%= t('activerecord.attributes.event_import_file.executed_at') -%>:</strong>
38
- <%= l(@event_import_file.executed_at) if @event_import_file.executed_at -%>
39
- </p>
40
-
41
- <p>
42
- <strong><%= t('activerecord.attributes.event_import_file.edit_mode') -%>:</strong>
43
- <%= @event_import_file.edit_mode -%>
44
- </p>
45
-
46
- <p>
47
- <strong><%= t('activerecord.attributes.event_import_file.user_encoding') -%>:</strong>
48
- <%= @event_import_file.user_encoding -%>
49
- </p>
50
-
51
- <p>
52
- <strong><%= t('activerecord.attributes.event_import_file.default_event_category_id') -%>:</strong>
53
- <%= link_to @event_import_file.default_event_category.display_name.localize, @event_import_file.default_event_category if @event_import_file.default_event_category.try(:display_name) -%>
54
- </p>
55
-
56
- <p>
57
- <strong><%= t('activerecord.attributes.event_import_file.default_library_id') -%>:</strong>
58
- <%= link_to @event_import_file.default_library.display_name.localize, @event_import_file.default_library if @event_import_file.default_library.try(:display_name) -%>
59
- </p>
60
-
61
- <p>
62
- <strong><%= t('activerecord.attributes.event_import_file.state') -%>:</strong>
63
- <%= localized_state(@event_import_file.current_state) -%>
64
- </p>
65
-
66
- <p>
67
- <strong><%= t('activerecord.attributes.event_import_file.error_message') -%>:</strong>
68
- <%= @event_import_file.error_message -%>
69
- </p>
2
+ <h1 class="title"><%= t('page.showing', model: t('activerecord.models.event_import_file')) -%></h1>
3
+ <div id="content_list">
4
+ <p id="notice"><%= notice %></p>
5
+
6
+ <p>
7
+ <strong>Id:</strong>
8
+ <%= @event_import_file.id -%>
9
+ </p>
10
+
11
+ <% if @event_import_file.event_import_file_name %>
12
+ <p>
13
+ <strong><%= t('activerecord.attributes.event_import_file.event_import_file_name') -%>:</strong>
14
+ <%= link_to @event_import_file.event_import_file_name, event_import_file_path(@event_import_file, format: :download) %>
15
+ (<%= @event_import_file.event_import_content_type -%>)
16
+ </p>
17
+
18
+ <p>
19
+ <strong><%= t('activerecord.attributes.event_import_file.event_import_file_size') -%>:</strong>
20
+ <%= @event_import_file.event_import_file_size -%>
21
+ </p>
22
+ <% end %>
70
23
 
71
- <p>
72
- <strong><%= t('activerecord.models.user') -%>:</strong>
73
- <%= link_to @event_import_file.user.username, @event_import_file.user.profile if @event_import_file.user.try(:profile) -%>
74
- </p>
24
+ <p>
25
+ <strong><%= t('page.created_at') -%>:</strong>
26
+ <%= l(@event_import_file.created_at) if @event_import_file.created_at -%>
27
+ </p>
28
+
29
+ <p>
30
+ <strong><%= t('activerecord.attributes.event_import_file.executed_at') -%>:</strong>
31
+ <%= l(@event_import_file.executed_at) if @event_import_file.executed_at -%>
32
+ </p>
33
+
34
+ <p>
35
+ <strong><%= t('activerecord.attributes.event_import_file.edit_mode') -%>:</strong>
36
+ <%= @event_import_file.edit_mode -%>
37
+ </p>
38
+
39
+ <p>
40
+ <strong><%= t('activerecord.attributes.event_import_file.user_encoding') -%>:</strong>
41
+ <%= @event_import_file.user_encoding -%>
42
+ </p>
43
+
44
+ <p>
45
+ <strong><%= t('activerecord.attributes.event_import_file.default_event_category_id') -%>:</strong>
46
+ <%= link_to @event_import_file.default_event_category.display_name.localize, @event_import_file.default_event_category if @event_import_file.default_event_category.try(:display_name) -%>
47
+ </p>
48
+
49
+ <p>
50
+ <strong><%= t('activerecord.attributes.event_import_file.default_library_id') -%>:</strong>
51
+ <%= link_to @event_import_file.default_library.display_name.localize, @event_import_file.default_library if @event_import_file.default_library.try(:display_name) -%>
52
+ </p>
53
+
54
+ <p>
55
+ <strong><%= t('activerecord.attributes.event_import_file.state') -%>:</strong>
56
+ <%= localized_state(@event_import_file.current_state) -%>
57
+ </p>
58
+
59
+ <p>
60
+ <strong><%= t('activerecord.attributes.event_import_file.error_message') -%>:</strong>
61
+ <%= simple_format(@event_import_file.error_message) -%>
62
+ </p>
63
+
64
+ <p>
65
+ <strong><%= t('activerecord.models.user') -%>:</strong>
66
+ <%= link_to @event_import_file.user.username, @event_import_file.user.profile if @event_import_file.user.try(:profile) -%>
67
+ </p>
68
+
69
+ <% if @event_import_results %>
70
+ <%= render 'results' %>
71
+ <% end %>
75
72
 
76
- </div>
73
+ </div>
77
74
  </div>
78
75
 
79
76
  <div id="submenu" class="ui-corner-all ui-widget-content">
80
77
  <%= form_for(@event_import_file) do |f| %>
81
78
  <ul>
82
- <li><%= link_to t('activerecord.models.event_import_result'), event_import_results_path(event_import_file_id: @event_import_file.id) -%></li>
83
79
  <li><%= back_to_index(flash[:page_info]) -%></li>
84
80
  <% if current_user.has_role?('Administrator') %>
85
81
  <li><%= link_to 'Resque', resque_path %></li>
@@ -0,0 +1,9 @@
1
+ The following import task is completed.
2
+
3
+ ID: <%= @event_import_file.id %>
4
+ Created at: <%= @event_import_file.created_at %>
5
+ Detail: <%= event_import_file_url(@event_import_file) %>
6
+
7
+ --
8
+ <%= @library_group.display_name %>
9
+ <%= root_url %>
@@ -0,0 +1,9 @@
1
+ 以下の催し物のインポートが完了しました。
2
+
3
+ ID: <%= @event_import_file.id %>
4
+ 作成時刻: <%= @event_import_file.created_at %>
5
+ 詳細: <%= event_import_file_url(@event_import_file) %>
6
+
7
+ --
8
+ <%= @library_group.display_name %>
9
+ <%= root_url %>
@@ -0,0 +1,9 @@
1
+ The following import task failed.
2
+
3
+ ID: <%= @event_import_file.id %>
4
+ Created at: <%= @event_import_file.created_at %>
5
+ Detail: <%= event_import_file_url(@event_import_file) %>
6
+
7
+ --
8
+ <%= @library_group.display_name %>
9
+ <%= root_url %>
@@ -0,0 +1,9 @@
1
+ 以下の催し物のインポートに失敗しました。
2
+
3
+ ID: <%= @event_import_file.id %>
4
+ 作成時刻: <%= @event_import_file.created_at %>
5
+ 詳細: <%= event_import_file_url(@event_import_file) %>
6
+
7
+ --
8
+ <%= @library_group.display_name %>
9
+ <%= root_url %>
@@ -36,15 +36,4 @@
36
36
  </div>
37
37
 
38
38
  <div id="submenu" class="ui-corner-all ui-widget-content">
39
- <ul>
40
- <li>
41
- <% if @event_import_file %>
42
- <%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), event_import_results_path(event_import_file_id: @event_import_file.id, format: :txt, locale: @locale.to_s) -%>
43
- (<%= link_to 'TSV', event_import_results_path(event_import_file_id: @event_import_file.id, format: :txt, locale: @locale.to_s) -%>)
44
- <% else %>
45
- <%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), event_import_results_path(format: :txt, locale: @locale.to_s) -%>
46
- (<%= link_to 'TSV', event_import_results_path(format: :txt, locale: @locale.to_s) -%>)
47
- <% end %>
48
- </li>
49
- </ul>
50
39
  </div>
@@ -0,0 +1,5 @@
1
+ CSV.generate(col_sep: "\t", row_sep: "\r\n") do |csv|
2
+ @event_import_results.each do |result|
3
+ csv << result.body.split("\t")
4
+ end
5
+ end
@@ -22,17 +22,17 @@
22
22
  <p>
23
23
  <%- case params[:mode]
24
24
  when 'upcoming' -%>
25
- <%= link_to t('event.all'), url_for(params.permit.merge(mode: nil, only_path: true)) -%>
25
+ <%= link_to t('event.all'), url_for(filtered_params.merge(mode: nil, only_path: true)) -%>
26
26
  <strong><%= t('event.upcoming') -%></strong>
27
- <%= link_to t('event.past'), url_for(params.permit.merge(mode: 'past', only_path: true)) -%>
27
+ <%= link_to t('event.past'), url_for(filtered_params.merge(mode: 'past', only_path: true)) -%>
28
28
  <%- when 'past' -%>
29
- <%= link_to t('event.all'), url_for(params.permit.merge(mode: nil, only_path: true)) -%>
30
- <%= link_to t('event.upcoming'), url_for(params.permit.merge(mode: 'upcoming', only_path: true)) -%>
29
+ <%= link_to t('event.all'), url_for(filtered_params.merge(mode: nil, only_path: true)) -%>
30
+ <%= link_to t('event.upcoming'), url_for(filtered_params.merge(mode: 'upcoming', only_path: true)) -%>
31
31
  <strong><%= t('event.past') -%></strong>
32
32
  <%- else -%>
33
33
  <strong><%= t('event.all') -%></strong>
34
- <%= link_to t('event.upcoming'), url_for(params.permit.merge(mode: 'upcoming', only_path: true)) -%>
35
- <%= link_to t('event.past'), url_for(params.permit.merge(mode: 'past', only_path: true)) -%>
34
+ <%= link_to t('event.upcoming'), url_for(filtered_params.merge(mode: 'upcoming', only_path: true)) -%>
35
+ <%= link_to t('event.past'), url_for(filtered_params.merge(mode: 'past', only_path: true)) -%>
36
36
  <%- end -%>
37
37
  </p>
38
38
 
@@ -77,9 +77,9 @@
77
77
  <div id="submenu" class="ui-corner-all ui-widget-content">
78
78
  <ul>
79
79
  <% if params[:mode] == 'calendar' %>
80
- <li><%= link_to t('event.table'), url_for(params.permit.merge(mode: nil)) -%></li>
80
+ <li><%= link_to t('event.table'), url_for(filtered_params.merge(mode: nil)) -%></li>
81
81
  <% else %>
82
- <li><%= link_to t('event.calendar'), url_for(params.permit.merge(mode: 'calendar')) -%></li>
82
+ <li><%= link_to t('event.calendar'), url_for(filtered_params.merge(mode: 'calendar')) -%></li>
83
83
  <% end %>
84
84
  </ul>
85
85
  <ul>
@@ -95,28 +95,28 @@
95
95
  <%- end -%>
96
96
  </ul>
97
97
  <ul>
98
- <li><%= link_to t('event.all_libraries'), events_path(mode: params[:mode]) -%></li>
98
+ <li><%= link_to t('event.all_libraries'), url_for(filtered_params.merge(library_id: nil, page: nil)) -%></li>
99
99
  <%- @libraries.each do |library| -%>
100
- <li><%= link_to library.display_name.localize, events_path(library_id: library.name, mode: params[:mode]) -%></li>
100
+ <li><%= link_to library.display_name.localize, url_for(filtered_params.merge(library_id: library.name, mode: params[:mode])) -%></li>
101
101
  <%- end -%>
102
102
  </ul>
103
103
  <p>
104
104
  <%- if @library -%>
105
- <%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), events_path(library_id: @library.name, format: :rss) -%>
106
- (<%= link_to 'RSS', events_path(library_id: @library.name, format: :rss) -%>)
107
- <%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), events_path(library_id: @library.name, format: :txt, locale: @locale.to_s) -%>
108
- (<%= link_to 'TSV', events_path(library_id: @library.name, format: :txt, locale: @locale.to_s) -%>)
105
+ <%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(library_id: @library.name, format: :rss, page: nil)) -%>
106
+ (<%= link_to 'RSS', url_for(filtered_params.merge(library_id: @library.name, format: :rss, page: nil)) -%>)
107
+ <%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(library_id: @library.name, format: :txt, locale: @locale.to_s)) -%>
108
+ (<%= link_to 'TSV', url_for(filtered_params.merge(library_id: @library.name, format: :txt, locale: @locale.to_s)) -%>)
109
109
  <br />
110
- <%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), events_path(library_id: @library.name, format: :ics, locale: @locale.to_s) -%>
111
- (<%= link_to 'iCalendar', events_path(library_id: @library.name, format: :ics, locale: @locale.to_s) -%>)
110
+ <%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), url_for(filtered_params.merge(library_id: @library.name, format: :ics, locale: @locale.to_s)) -%>
111
+ (<%= link_to 'iCalendar', url_for(filtered_params.merge(library_id: @library.name, format: :ics, locale: @locale.to_s)) -%>)
112
112
  <%- else -%>
113
- <%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), events_path(format: :rss) -%>
114
- (<%= link_to 'RSS', events_path(format: :rss) -%>)
115
- <%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), events_path(format: :txt, locale: @locale.to_s) -%>
116
- (<%= link_to 'TSV', events_path(format: :txt, locale: @locale.to_s) -%>)
113
+ <%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(format: :rss)) -%>
114
+ (<%= link_to 'RSS', url_for(filtered_params.merge(format: :rss)) -%>)
115
+ <%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>
116
+ (<%= link_to 'TSV', url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>)
117
117
  <br />
118
- <%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), events_path(format: :ics, locale: @locale.to_s) -%>
119
- (<%= link_to 'iCalendar', events_path(format: :ics, locale: @locale.to_s) -%>)
118
+ <%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), url_for(filtered_params.merge(format: :ics, locale: @locale.to_s)) -%>
119
+ (<%= link_to 'iCalendar', url_for(filtered_params.merge(format: :ics, locale: @locale.to_s)) -%>)
120
120
  <%- end -%>
121
121
  </p>
122
122
  </div>
@@ -0,0 +1,7 @@
1
+ Event.csv_header(
2
+ role: current_user_role_name
3
+ ).to_csv(col_sep: "\t") + @events.map{|event|
4
+ event.to_hash(
5
+ role: current_user_role_name
6
+ ).values.to_csv(col_sep: "\t")
7
+ }.join
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,66 @@
1
+ {
2
+ "ignored_warnings": [
3
+ {
4
+ "warning_type": "File Access",
5
+ "warning_code": 16,
6
+ "fingerprint": "0cc99b4df61bb345104e86e3061a1d3e8f23a8385c02a3f65a31701d5dd6e6a6",
7
+ "check_name": "SendFile",
8
+ "message": "Model attribute used in file name",
9
+ "file": "app/controllers/event_import_files_controller.rb",
10
+ "line": 34,
11
+ "link": "https://brakemanscanner.org/docs/warning_types/file_access/",
12
+ "code": "send_file(EventImportFile.find(params[:id]).event_import.path, :filename => EventImportFile.find(params[:id]).event_import_file_name, :type => \"application/octet-stream\")",
13
+ "render_path": null,
14
+ "location": {
15
+ "type": "method",
16
+ "class": "EventImportFilesController",
17
+ "method": "show"
18
+ },
19
+ "user_input": "EventImportFile.find(params[:id]).event_import.path",
20
+ "confidence": "Medium",
21
+ "note": ""
22
+ },
23
+ {
24
+ "warning_type": "File Access",
25
+ "warning_code": 16,
26
+ "fingerprint": "43e943cb9bc901967fc76b8120d84c754d5872e0a955b507ef00d8f613342c86",
27
+ "check_name": "SendFile",
28
+ "message": "Model attribute used in file name",
29
+ "file": "app/controllers/event_export_files_controller.rb",
30
+ "line": 33,
31
+ "link": "https://brakemanscanner.org/docs/warning_types/file_access/",
32
+ "code": "send_file(EventExportFile.find(params[:id]).event_export.path, :filename => EventExportFile.find(params[:id]).event_export_file_name, :type => \"application/octet-stream\")",
33
+ "render_path": null,
34
+ "location": {
35
+ "type": "method",
36
+ "class": "EventExportFilesController",
37
+ "method": "show"
38
+ },
39
+ "user_input": "EventExportFile.find(params[:id]).event_export.path",
40
+ "confidence": "Medium",
41
+ "note": ""
42
+ },
43
+ {
44
+ "warning_type": "Redirect",
45
+ "warning_code": 18,
46
+ "fingerprint": "e304fcb4b88a6522a29c32c654cee5d0a59c5fcce2e0a9a8862768c237a8e72a",
47
+ "check_name": "Redirect",
48
+ "message": "Possible unprotected redirect",
49
+ "file": "app/controllers/event_import_files_controller.rb",
50
+ "line": 32,
51
+ "link": "https://brakemanscanner.org/docs/warning_types/redirect/",
52
+ "code": "redirect_to(EventImportFile.find(params[:id]).event_import.expiring_url(10))",
53
+ "render_path": null,
54
+ "location": {
55
+ "type": "method",
56
+ "class": "EventImportFilesController",
57
+ "method": "show"
58
+ },
59
+ "user_input": "EventImportFile.find(params[:id]).event_import.expiring_url(10)",
60
+ "confidence": "High",
61
+ "note": ""
62
+ }
63
+ ],
64
+ "updated": "2020-04-29 03:31:48 +0900",
65
+ "brakeman_version": "4.8.1"
66
+ }
@@ -38,6 +38,7 @@ en:
38
38
  default_event_category_id: Default event category
39
39
  event_import_result:
40
40
  body: Body
41
+ lineno: Line
41
42
  event_export_file:
42
43
  event_export_file_name: Filename
43
44
  event_export_file_size: Size
@@ -56,3 +57,14 @@ en:
56
57
  event_import_file:
57
58
  default_library: If "library" column is not set in the TSV file, this library is set to the new event.
58
59
  default_event_category: If "event_category" column is not set in the TSV file, this event category is set to the new event.
60
+
61
+ event_import_mailer:
62
+ completed:
63
+ subject: 'Import completed'
64
+ failed:
65
+ subject: 'Import failed'
66
+ event_export_mailer:
67
+ completed:
68
+ subject: 'Export completed'
69
+ failed:
70
+ subject: 'Export failed'
@@ -38,6 +38,7 @@ ja:
38
38
  default_event_category_id: 既定の催し物の種別
39
39
  event_import_result:
40
40
  body: 本文
41
+ lineno: 行数
41
42
  event_export_file:
42
43
  event_export_file_name: ファイル名
43
44
  event_export_file_size: ファイルサイズ
@@ -58,3 +59,14 @@ ja:
58
59
  event_import_file:
59
60
  default_library: TSVファイルで"library"列が指定されていない場合、この図書館が登録されます。
60
61
  default_event_category: TSVファイルで"event_category"列が指定されていない場合、この種別が登録されます。
62
+
63
+ event_import_mailer:
64
+ completed:
65
+ subject: 'インポートが完了しました'
66
+ failed:
67
+ subject: 'インポートに失敗しました'
68
+ event_export_mailer:
69
+ completed:
70
+ subject: 'エクスポートが完了しました'
71
+ failed:
72
+ subject: 'エクスポートに失敗しました'
@@ -2,7 +2,6 @@ require "enju_message"
2
2
  require "ri_cal"
3
3
  require "csv"
4
4
  require "nkf"
5
- require "jbuilder"
6
5
  begin
7
6
  require 'charlock_holmes/string'
8
7
  rescue LoadError
@@ -1,3 +1,3 @@
1
1
  module EnjuEvent
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.5".freeze
3
3
  end
@@ -5,7 +5,7 @@ class EnjuEvent::SetupGenerator < Rails::Generators::Base
5
5
  directory("db/fixtures", "db/fixtures/enju_event")
6
6
  rake("enju_event_engine:install:migrations")
7
7
  inject_into_file 'app/controllers/application_controller.rb',
8
- " enju_event\n", after: "enju_library\n"
8
+ " include EnjuEvent::Controller\n", after: "include EnjuLibrary::Controller\n"
9
9
  inject_into_file 'app/assets/stylesheets/application.css',
10
10
  " *= require enju_event/application\n", after: " *= require enju_leaf\n"
11
11
  inject_into_file 'app/assets/javascripts/application.js',
@@ -9,7 +9,7 @@ describe EventImportFilesController do
9
9
 
10
10
  it "assigns all event_import_files as @event_import_files" do
11
11
  get :index
12
- assigns(:event_import_files).should eq(EventImportFile.page(1))
12
+ assigns(:event_import_files).should eq(EventImportFile.order(created_at: :desc).page(1))
13
13
  end
14
14
  end
15
15
 
@@ -18,7 +18,7 @@ describe EventImportFilesController do
18
18
 
19
19
  it "assigns all event_import_files as @event_import_files" do
20
20
  get :index
21
- assigns(:event_import_files).should eq(EventImportFile.page(1))
21
+ assigns(:event_import_files).should eq(EventImportFile.order(created_at: :desc).page(1))
22
22
  end
23
23
  end
24
24
 
@@ -9,7 +9,7 @@ describe EventImportResultsController do
9
9
 
10
10
  it "assigns all event_import_results as @event_import_results" do
11
11
  get :index
12
- assigns(:event_import_results).should eq(EventImportResult.page(1))
12
+ assigns(:event_import_results).should eq(EventImportResult.order(created_at: :desc).page(1))
13
13
  end
14
14
  end
15
15
 
@@ -18,7 +18,7 @@ describe EventImportResultsController do
18
18
 
19
19
  it "assigns all event_import_results as @event_import_results" do
20
20
  get :index
21
- assigns(:event_import_results).should eq(EventImportResult.page(1))
21
+ assigns(:event_import_results).should eq(EventImportResult.order(created_at: :desc).page(1))
22
22
  end
23
23
  end
24
24
 
@@ -55,8 +55,8 @@ describe EventsController do
55
55
  assigns(:events).should_not be_nil
56
56
  end
57
57
 
58
- it "assigns all events as @events in txt format" do
59
- get :index, format: 'txt'
58
+ it "assigns all events as @events in text format" do
59
+ get :index, format: :text
60
60
  assigns(:events).should_not be_nil
61
61
  end
62
62
 
@@ -0,0 +1,41 @@
1
+ require 'rails_helper'
2
+
3
+ describe LibrariesController do
4
+ fixtures :all
5
+
6
+ describe 'GET show', solr: true do
7
+ describe 'When logged in as Administrator' do
8
+ login_fixture_admin
9
+
10
+ it 'assigns the requested library as @library' do
11
+ get :show, params: { id: libraries(:library_00001).id }
12
+ assigns(:library).should eq(libraries(:library_00001))
13
+ end
14
+ end
15
+
16
+ describe 'When logged in as Librarian' do
17
+ login_fixture_librarian
18
+
19
+ it 'assigns the requested library as @library' do
20
+ get :show, params: { id: libraries(:library_00001).id }
21
+ assigns(:library).should eq(libraries(:library_00001))
22
+ end
23
+ end
24
+
25
+ describe 'When logged in as User' do
26
+ login_fixture_user
27
+
28
+ it 'assigns the requested library as @library' do
29
+ get :show, params: { id: libraries(:library_00001).id }
30
+ assigns(:library).should eq(libraries(:library_00001))
31
+ end
32
+ end
33
+
34
+ describe 'When not logged in' do
35
+ it 'assigns the requested library as @library' do
36
+ get :show, params: { id: libraries(:library_00001).id }
37
+ assigns(:library).should eq(libraries(:library_00001))
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
4
+ //= link icons/feed.png
5
+ //= link icons/page_white_excel.png
@@ -0,0 +1,7 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ # Automatically retry jobs that encountered a deadlock
3
+ # retry_on ActiveRecord::Deadlocked
4
+
5
+ # Most jobs are safe to ignore if the underlying records are no longer available
6
+ # discard_on ActiveJob::DeserializationError
7
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ end
4
+
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,4 +1,4 @@
1
- class User < ActiveRecord::Base
1
+ class User < ApplicationRecord
2
2
  # Include default devise modules. Others available are:
3
3
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4
4
  devise :database_authenticatable, #:registerable,
@@ -10,7 +10,7 @@ require "resque/server"
10
10
  module Dummy
11
11
  class Application < Rails::Application
12
12
  # Initialize configuration defaults for originally generated Rails version.
13
- config.load_defaults 5.1
13
+ config.load_defaults 5.2
14
14
 
15
15
  # Settings in config/environments/* take precedence over those specified here.
16
16
  # Application configuration should go into files in config/initializers
@@ -12,3 +12,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
12
12
  # application.js, application.css, and all non-JS/CSS in the app/assets
13
13
  # folder are already added.
14
14
  # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15
+ Rails.application.config.assets.precompile += %w( icons/*.png )
@@ -2,3 +2,4 @@
2
2
 
3
3
  # Add new mime types for use in respond_to blocks:
4
4
  # Mime::Type.register "text/richtext", :rtf
5
+ Mime::Type.register_alias "text/plain", :txt