enju_library 0.3.11 → 0.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -3
  3. data/app/controllers/accepts_controller.rb +2 -2
  4. data/app/controllers/concerns/enju_library/controller.rb +7 -7
  5. data/app/controllers/libraries_controller.rb +4 -1
  6. data/app/controllers/library_groups_controller.rb +7 -1
  7. data/app/controllers/request_status_types_controller.rb +6 -1
  8. data/app/controllers/request_types_controller.rb +6 -1
  9. data/app/controllers/shelves_controller.rb +4 -1
  10. data/app/controllers/user_groups_controller.rb +3 -0
  11. data/app/controllers/user_import_results_controller.rb +1 -1
  12. data/app/controllers/withdraws_controller.rb +2 -2
  13. data/app/helpers/enju_library/application_helper.rb +18 -0
  14. data/app/models/budget_type.rb +9 -7
  15. data/app/models/concerns/enju_library/enju_user.rb +10 -0
  16. data/app/models/library.rb +29 -43
  17. data/app/models/library_group.rb +10 -11
  18. data/app/models/request_status_type.rb +9 -7
  19. data/app/models/request_type.rb +9 -7
  20. data/app/models/search_engine.rb +14 -18
  21. data/app/models/shelf.rb +13 -11
  22. data/app/models/user_export_file.rb +2 -2
  23. data/app/models/user_export_file_state_machine.rb +1 -1
  24. data/app/models/user_group.rb +2 -0
  25. data/app/models/user_import_file.rb +28 -27
  26. data/app/models/user_import_file_state_machine.rb +1 -1
  27. data/app/models/withdraw.rb +6 -0
  28. data/app/policies/shelf_policy.rb +1 -1
  29. data/app/views/accepts/_list.html.erb +2 -2
  30. data/app/views/accepts/index.html.erb +2 -2
  31. data/app/views/accepts/{index.text.erb → index.txt.csv} +0 -0
  32. data/app/views/budget_types/_form.html.erb +1 -1
  33. data/app/views/budget_types/index.html.erb +1 -1
  34. data/app/views/budget_types/show.html.erb +1 -1
  35. data/app/views/libraries/_calendar.html.erb +1 -1
  36. data/app/views/libraries/_form.html.erb +2 -12
  37. data/app/views/libraries/_map.html+phone.erb +2 -2
  38. data/app/views/libraries/_map.html.erb +23 -10
  39. data/app/views/libraries/index.html.erb +1 -1
  40. data/app/views/libraries/show.html+phone.erb +1 -1
  41. data/app/views/libraries/show.html+phone.slim +1 -1
  42. data/app/views/libraries/show.html.erb +2 -2
  43. data/app/views/library_groups/_form.html.erb +14 -13
  44. data/app/views/library_groups/index.html.erb +1 -1
  45. data/app/views/library_groups/show.html.erb +2 -2
  46. data/app/views/picture_files/_index_shelf.html.erb +1 -1
  47. data/app/views/request_status_types/_form.html.erb +1 -1
  48. data/app/views/request_status_types/index.html.erb +1 -1
  49. data/app/views/request_status_types/show.html.erb +1 -1
  50. data/app/views/request_types/_form.html.erb +1 -1
  51. data/app/views/request_types/index.html.erb +2 -2
  52. data/app/views/request_types/show.html.erb +1 -1
  53. data/app/views/shelves/_form.html.erb +1 -1
  54. data/app/views/shelves/_select_form.html.erb +1 -1
  55. data/app/views/shelves/index.html.erb +3 -3
  56. data/app/views/shelves/show.html+phone.erb +1 -1
  57. data/app/views/shelves/show.html+phone.slim +1 -1
  58. data/app/views/shelves/show.html.erb +2 -2
  59. data/app/views/user_groups/_form.html.erb +1 -1
  60. data/app/views/user_groups/index.html.erb +1 -1
  61. data/app/views/user_groups/show.html.erb +2 -2
  62. data/app/views/user_import_files/_results.html.erb +0 -5
  63. data/app/views/user_import_files/new.html.erb +2 -2
  64. data/app/views/user_import_files/show.html.erb +2 -2
  65. data/app/views/user_import_results/index.html.erb +11 -0
  66. data/app/views/user_import_results/{index.text.erb → index.txt.erb} +0 -0
  67. data/app/views/withdraws/_list.html.erb +2 -2
  68. data/app/views/withdraws/index.html.erb +3 -3
  69. data/app/views/withdraws/{index.text.erb → index.txt.csv} +0 -0
  70. data/app/views/withdraws/new.html.erb +1 -1
  71. data/config/locales/translation_en.yml +2 -4
  72. data/config/locales/translation_ja.yml +2 -4
  73. data/db/migrate/20160813191647_add_max_number_of_results_to_library_group.rb +1 -1
  74. data/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
  75. data/db/migrate/20190630115523_add_login_banner_translations_to_library_group.rb +6 -0
  76. data/lib/enju_library/version.rb +1 -1
  77. data/lib/generators/enju_library/setup/setup_generator.rb +2 -7
  78. data/lib/generators/enju_library/setup/templates/db/fixtures/budget_types.yml +4 -0
  79. data/lib/generators/enju_library/setup/templates/db/fixtures/libraries.yml +2 -2
  80. data/lib/generators/enju_library/setup/templates/db/fixtures/library_groups.yml +11 -5
  81. data/lib/generators/enju_library/setup/templates/db/fixtures/user_groups.yml +1 -2
  82. data/spec/controllers/budget_types_controller_spec.rb +1 -1
  83. data/spec/controllers/items_controller_spec.rb +35 -0
  84. data/spec/dummy/app/helpers/application_helper.rb +1 -0
  85. data/spec/dummy/app/models/user.rb +1 -2
  86. data/spec/dummy/bin/bundle +1 -1
  87. data/spec/dummy/bin/setup +1 -3
  88. data/spec/dummy/bin/update +4 -2
  89. data/spec/dummy/bin/yarn +3 -3
  90. data/spec/dummy/config/application.rb +1 -0
  91. data/spec/dummy/config/database.yml +70 -9
  92. data/spec/dummy/config/initializers/assets.rb +1 -1
  93. data/spec/dummy/config/storage.yml +34 -0
  94. data/spec/dummy/db/development.sqlite3 +0 -0
  95. data/spec/dummy/db/migrate/113_create_events.rb +2 -4
  96. data/spec/dummy/db/migrate/20081028093607_create_event_import_files.rb +2 -4
  97. data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -4
  98. data/spec/dummy/db/migrate/20100925074639_create_event_import_results.rb +2 -2
  99. data/spec/dummy/db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb +1 -1
  100. data/spec/dummy/db/migrate/20140812152348_create_event_export_files.rb +1 -1
  101. data/spec/dummy/db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb +1 -1
  102. data/spec/dummy/db/migrate/20151128142913_create_places.rb +14 -0
  103. data/spec/dummy/db/migrate/20151201163718_add_place_id_to_event.rb +5 -0
  104. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
  105. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  106. data/spec/dummy/db/migrate/20160703184258_add_most_recent_to_event_import_file_transitions.rb +9 -0
  107. data/spec/dummy/db/migrate/20160703184311_add_most_recent_to_event_export_file_transitions.rb +9 -0
  108. data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
  109. data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
  110. data/spec/dummy/db/migrate/20170116150432_create_jpno_records.rb +10 -0
  111. data/spec/dummy/db/migrate/20171126072934_create_ndla_records.rb +10 -0
  112. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
  113. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
  114. data/spec/dummy/db/migrate/20180107164558_add_constraints_to_most_recent_for_event_import_file_transitions.rb +13 -0
  115. data/spec/dummy/db/migrate/20180107164617_add_constraints_to_most_recent_for_event_export_file_transitions.rb +13 -0
  116. data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
  117. data/spec/dummy/db/migrate/20181119170645_add_foreign_key_to_events_referencing_event_categories.rb +5 -0
  118. data/spec/dummy/db/migrate/20190102034126_create_doi_records.rb +13 -0
  119. data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
  120. data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +10 -0
  121. data/spec/dummy/db/migrate/20190312033839_create_periodical_and_manifestations.rb +11 -0
  122. data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +7 -0
  123. data/spec/dummy/db/migrate/20190501043418_create_ndl_bib_id_records.rb +10 -0
  124. data/spec/dummy/db/migrate/20190508160525_create_retains.rb +10 -0
  125. data/spec/dummy/db/migrate/20190512133459_upgrade_enju_event_to_enju_leaf20.rb +115 -0
  126. data/spec/dummy/db/migrate/20190629134017_rename_user_group_has_checkout_type_due_date_before_to_due_date_after.rb +5 -0
  127. data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
  128. data/spec/dummy/db/migrate/20190630153136_add_display_name_translations_to_event.rb +6 -0
  129. data/spec/dummy/db/migrate/20190706052525_add_display_name_translations_to_circulation_status.rb +5 -0
  130. data/spec/dummy/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
  131. data/spec/dummy/db/migrate/20190713114724_add_checkout_id_to_checkin.rb +6 -0
  132. data/spec/dummy/db/migrate/20190713114940_add_profile_id_to_user.rb +5 -0
  133. data/spec/dummy/db/migrate/20190713115451_add_full_name_translations_to_profile.rb +5 -0
  134. data/spec/dummy/db/migrate/20190814120827_add_display_name_translations_to_checkout_type.rb +5 -0
  135. data/spec/dummy/db/schema.rb +402 -204
  136. data/spec/dummy/db/test.sqlite3 +0 -0
  137. data/spec/factories/budget_types.rb +8 -7
  138. data/spec/factories/profile.rb +9 -2
  139. data/spec/factories/user.rb +25 -31
  140. data/spec/factories/user_export_file.rb +5 -0
  141. data/spec/factories/user_import_file.rb +7 -0
  142. data/spec/factories/user_import_result.rb +6 -0
  143. data/spec/fixtures/agent_relationship_types.yml +34 -0
  144. data/spec/fixtures/agent_types.yml +11 -11
  145. data/spec/fixtures/agents.yml +27 -27
  146. data/spec/fixtures/baskets.yml +1 -0
  147. data/spec/fixtures/bookstores.yml +1 -0
  148. data/spec/fixtures/budget_types.yml +9 -7
  149. data/spec/fixtures/carrier_type_has_checkout_types.yml +5 -5
  150. data/spec/fixtures/carrier_types.yml +28 -24
  151. data/spec/fixtures/checked_items.yml +6 -6
  152. data/spec/fixtures/checkins.yml +4 -11
  153. data/spec/fixtures/checkout_stat_has_manifestations.yml +5 -5
  154. data/spec/fixtures/checkout_stat_has_users.yml +6 -6
  155. data/spec/fixtures/checkout_types.yml +11 -11
  156. data/spec/fixtures/checkouts.yml +16 -17
  157. data/spec/fixtures/circulation_statuses.yml +29 -38
  158. data/spec/fixtures/classification_types.yml +63 -0
  159. data/spec/fixtures/content_types.yml +20 -31
  160. data/spec/fixtures/create_types.yml +43 -0
  161. data/spec/fixtures/event_categories.yml +23 -23
  162. data/spec/fixtures/frequencies.yml +17 -25
  163. data/spec/fixtures/identifier_types.yml +42 -0
  164. data/spec/fixtures/item_has_use_restrictions.yml +11 -11
  165. data/spec/fixtures/items.yml +28 -17
  166. data/spec/fixtures/languages.yml +12 -13
  167. data/spec/fixtures/lending_policies.yml +8 -15
  168. data/spec/fixtures/libraries.yml +30 -29
  169. data/spec/fixtures/library_groups.yml +12 -9
  170. data/spec/fixtures/manifestation_checkout_stats.yml +4 -3
  171. data/spec/fixtures/manifestation_relationship_types.yml +29 -0
  172. data/spec/fixtures/manifestation_reserve_stats.yml +4 -3
  173. data/spec/fixtures/manifestations.yml +60 -50
  174. data/spec/fixtures/message_requests.yml +3 -3
  175. data/spec/fixtures/produce_types.yml +29 -0
  176. data/spec/fixtures/profiles.yml +11 -6
  177. data/spec/fixtures/realize_types.yml +36 -0
  178. data/spec/fixtures/request_status_types.yml +14 -13
  179. data/spec/fixtures/request_types.yml +13 -12
  180. data/spec/fixtures/reserve_stat_has_manifestations.yml +5 -5
  181. data/spec/fixtures/reserve_stat_has_users.yml +5 -5
  182. data/spec/fixtures/reserve_transitions.yml +8 -7
  183. data/spec/fixtures/reserves.yml +44 -64
  184. data/spec/fixtures/roles.yml +22 -5
  185. data/spec/fixtures/search_engines.yml +13 -12
  186. data/spec/fixtures/shelves.yml +16 -15
  187. data/spec/fixtures/subject_heading_types.yml +39 -0
  188. data/spec/fixtures/subject_types.yml +28 -0
  189. data/spec/fixtures/use_restrictions.yml +4 -4
  190. data/spec/fixtures/user_checkout_stats.yml +4 -4
  191. data/spec/fixtures/user_export_files.yml +1 -1
  192. data/spec/fixtures/user_group_has_checkout_types.yml +19 -19
  193. data/spec/fixtures/user_groups.yml +4 -3
  194. data/spec/fixtures/user_has_roles.yml +3 -4
  195. data/spec/fixtures/user_reserve_stats.yml +5 -4
  196. data/spec/models/budget_type_spec.rb +8 -7
  197. data/spec/models/library_group_spec.rb +5 -14
  198. data/spec/models/library_spec.rb +26 -25
  199. data/spec/models/request_status_type_spec.rb +8 -7
  200. data/spec/models/request_type_spec.rb +8 -7
  201. data/spec/models/search_engine_spec.rb +13 -12
  202. data/spec/models/shelf_spec.rb +12 -11
  203. data/spec/models/user_export_file_spec.rb +2 -2
  204. data/spec/models/user_group_spec.rb +1 -6
  205. data/spec/models/user_import_file_spec.rb +23 -23
  206. data/spec/rails_helper.rb +10 -2
  207. data/spec/system/libraries_spec.rb +5 -5
  208. metadata +476 -491
  209. data/app/helpers/shelves_helper.rb +0 -16
  210. data/app/views/layouts/libraries.html.erb +0 -31
  211. data/app/views/libraries/_map_header.html.erb +0 -6
  212. data/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -18
  213. data/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +0 -22
  214. data/lib/generators/enju_library/setup/templates/db/fixtures/library_group/translations.yml +0 -12
  215. data/spec/dummy/app/assets/config/manifest.js +0 -5
  216. data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +0 -5
  217. data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +0 -5
  218. data/spec/dummy/db/migrate/20200425072340_create_manifestation_custom_properties.rb +0 -12
  219. data/spec/dummy/db/migrate/20200425072349_create_item_custom_properties.rb +0 -12
  220. data/spec/dummy/db/migrate/20200425074758_create_manifestation_custom_values.rb +0 -12
  221. data/spec/dummy/db/migrate/20200425074822_create_item_custom_values.rb +0 -12
@@ -34,13 +34,13 @@
34
34
 
35
35
  <div class="field">
36
36
  <%= f.label :default_user_group_id -%>
37
- <%= f.select(:default_user_group_id, @user_groups.collect{|u| [u.display_name.localize, u.id]}) -%><br />
37
+ <%= f.select(:default_user_group_id, @user_groups.collect{|u| [u.display_name, u.id]}) -%><br />
38
38
  <%= t('user_import_file.default_user_group') %>
39
39
  </div>
40
40
 
41
41
  <div class="field">
42
42
  <%= f.label :default_library_id -%>
43
- <%= f.select(:default_library_id, @libraries.collect{|l| [l.display_name.localize, l.id]}) -%><br />
43
+ <%= f.select(:default_library_id, @libraries.collect{|l| [l.display_name, l.id]}) -%><br />
44
44
  <%= t('user_import_file.default_library') %>
45
45
  </div>
46
46
 
@@ -43,12 +43,12 @@
43
43
 
44
44
  <p>
45
45
  <strong><%= t('activerecord.attributes.user_import_file.default_user_group_id') -%>:</strong>
46
- <%= link_to @user_import_file.default_user_group.display_name.localize, @user_import_file.default_user_group if @user_import_file.default_user_group.try(:display_name) -%>
46
+ <%= link_to @user_import_file.default_user_group.display_name, @user_import_file.default_user_group if @user_import_file.default_user_group.try(:display_name) -%>
47
47
  </p>
48
48
 
49
49
  <p>
50
50
  <strong><%= t('activerecord.attributes.user_import_file.default_library_id') -%>:</strong>
51
- <%= link_to @user_import_file.default_library.display_name.localize, @user_import_file.default_library if @user_import_file.default_library.try(:display_name) -%>
51
+ <%= link_to @user_import_file.default_library.display_name, @user_import_file.default_library if @user_import_file.default_library.try(:display_name) -%>
52
52
  </p>
53
53
 
54
54
  <p>
@@ -11,4 +11,15 @@
11
11
  </div>
12
12
 
13
13
  <div id="submenu" class="ui-corner-all ui-widget-content">
14
+ <ul>
15
+ <li>
16
+ <% if @user_import_file %>
17
+ <%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), user_import_results_path(user_import_file_id: @user_import_file.id, format: :txt, locale: @locale.to_s)) -%>
18
+ (<%= link_to 'TSV', user_import_results_path(user_import_file_id: @user_import_file.id, format: :txt, locale: @locale.to_s) -%>)
19
+ <% else %>
20
+ <%= link_to((image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), user_import_results_path(format: :txt, locale: @locale.to_s)) -%>
21
+ (<%= link_to 'TSV', user_import_results_path(format: :txt, locale: @locale.to_s) -%>)
22
+ <% end %>
23
+ </li>
24
+ </ul>
14
25
  </div>
@@ -20,8 +20,8 @@
20
20
  <td>
21
21
  <%= render 'manifestations/show_index', manifestation: withdraw.item.manifestation %>
22
22
  <%= link_to withdraw.item.item_identifier, withdraw.item -%> / <%= withdraw.item.call_number %>
23
- (<%= link_to withdraw.item.shelf.library.display_name.localize, withdraw.item.shelf.library %> /
24
- <%= link_to withdraw.item.shelf.display_name.localize, withdraw.item.shelf %>)<br />
23
+ (<%= link_to withdraw.item.shelf.library.display_name, withdraw.item.shelf.library %> /
24
+ <%= link_to withdraw.item.shelf.display_name, withdraw.item.shelf %>)<br />
25
25
  <%=l withdraw.created_at %>
26
26
  </td>
27
27
  </tr>
@@ -23,8 +23,8 @@
23
23
  <% if withdraw.item %>
24
24
  <%= render 'manifestations/show_index', manifestation: withdraw.item.manifestation %>
25
25
  <%= link_to withdraw.item.item_identifier, withdraw.item -%> / <%= withdraw.item.call_number %>
26
- (<%= link_to withdraw.item.shelf.library.display_name.localize, withdraw.item.shelf.library %> /
27
- <%= link_to withdraw.item.shelf.display_name.localize, withdraw.item.shelf %>)<br />
26
+ (<%= link_to withdraw.item.shelf.library.display_name, withdraw.item.shelf.library %> /
27
+ <%= link_to withdraw.item.shelf.display_name, withdraw.item.shelf %>)<br />
28
28
  <%=l withdraw.created_at %>
29
29
  <% end %>
30
30
  </td>
@@ -45,6 +45,6 @@
45
45
  <div id="submenu" class="ui-corner-all ui-widget-content">
46
46
  <ul>
47
47
  <li><%= link_to t('page.new', model: t('activerecord.models.withdraw')), new_withdraw_path -%></li>
48
- <li><%= link_to t('page.listing', model: t('activerecord.attributes.withdraw.removed_items', status: CirculationStatus.where(name: 'Removed').first.display_name.localize) + t('activerecord.models.item')), items_path(circulation_status: 'Removed') -%></li>
48
+ <li><%= link_to t('page.listing', model: t('activerecord.attributes.withdraw.removed_items', status: CirculationStatus.where(name: 'Removed').first.display_name) + t('activerecord.models.item')), items_path(circulation_status: 'Removed') -%></li>
49
49
  </ul>
50
50
  </div>
@@ -10,6 +10,6 @@
10
10
  <div id="submenu" class="ui-corner-all ui-widget-content">
11
11
  <ul>
12
12
  <li><%= link_to t('page.listing', model: t('activerecord.models.withdraw')), withdraws_path -%></li>
13
- <li><%= link_to t('page.listing', model: t('activerecord.attributes.withdraw.removed_items', status: CirculationStatus.where(name: 'Removed').first.display_name.localize) + t('activerecord.models.item')), items_path(circulation_status: 'Removed') -%></li>
13
+ <li><%= link_to t('page.listing', model: t('activerecord.attributes.withdraw.removed_items', status: CirculationStatus.where(name: 'Removed').first.display_name) + t('activerecord.models.item')), items_path(circulation_status: 'Removed') -%></li>
14
14
  </ul>
15
15
  </div>
@@ -26,8 +26,8 @@ en:
26
26
  telephone_number_1: Telephone number 1
27
27
  telephone_number_2: Telephone number 2
28
28
  fax_number: Fax number
29
- latitude: Latitude
30
- longitude: Longitude
29
+ lat: Lat
30
+ lng: Lng
31
31
  note: Note
32
32
  call_number_rows: Call number rows
33
33
  call_number_delimiter: Call number delimiter
@@ -59,8 +59,6 @@ en:
59
59
  max_number_of_results: Max number of results
60
60
  book_jacket_source: Book jacket source
61
61
  header_logo: Header logo
62
- default_custom_manifestation_label: Default custom properties (Manifestation)
63
- default_custom_item_label: Default custom properties (Item)
64
62
  bookstore:
65
63
  name: Name
66
64
  zip_code: Zip code
@@ -26,8 +26,8 @@ ja:
26
26
  telephone_number_1: 電話番号1
27
27
  telephone_number_2: 電話番号2
28
28
  fax_number: ファックス番号
29
- latitude: 緯度
30
- longitude: 経度
29
+ lat: 緯度
30
+ lng: 経度
31
31
  note: 注記
32
32
  call_number_rows: 請求記号の列数
33
33
  call_number_delimiter: 請求番号の区切り文字
@@ -59,8 +59,6 @@ ja:
59
59
  max_number_of_results: 検索結果の最大件数
60
60
  book_jacket_source: 書影の取得元
61
61
  header_logo: ヘッダーのロゴ
62
- default_custom_manifestation_label: 既定のカスタム項目(書誌)
63
- default_custom_item_label: 既定のカスタム項目(所蔵)
64
62
  bookstore:
65
63
  name: 名前
66
64
  zip_code: 郵便番号
@@ -1,5 +1,5 @@
1
1
  class AddMaxNumberOfResultsToLibraryGroup < ActiveRecord::Migration[4.2]
2
2
  def change
3
- add_column :library_groups, :max_number_of_results, :integer, default: 1000
3
+ add_column :library_groups, :max_number_of_results, :integer, default: 500
4
4
  end
5
5
  end
@@ -0,0 +1,12 @@
1
+ class AddDisplayNameTranslationsToLibraryGroup < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :budget_types, :display_name_translations, :jsonb, default: {}, null: false
4
+ add_column :libraries, :display_name_translations, :jsonb, default: {}, null: false
5
+ add_column :library_groups, :display_name_translations, :jsonb, default: {}, null: false
6
+ add_column :request_status_types, :display_name_translations, :jsonb, default: {}, null: false
7
+ add_column :request_types, :display_name_translations, :jsonb, default: {}, null: false
8
+ add_column :search_engines, :display_name_translations, :jsonb, default: {}, null: false
9
+ add_column :shelves, :display_name_translations, :jsonb, default: {}, null: false
10
+ add_column :user_groups, :display_name_translations, :jsonb, default: {}, null: false
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ class AddLoginBannerTranslationsToLibraryGroup < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :library_groups, :login_banner_translations, :jsonb, default: {}, null: false
4
+ add_column :library_groups, :footer_banner_translations, :jsonb, default: {}, null: false
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module EnjuLibrary
2
- VERSION = "0.3.11".freeze
2
+ VERSION = "0.4.0.beta.1"
3
3
  end
@@ -5,13 +5,8 @@ class EnjuLibrary::SetupGenerator < Rails::Generators::Base
5
5
  def copy_setup_files
6
6
  directory("db/fixtures", "db/fixtures/enju_library")
7
7
  return if file == 'fixture'
8
- inject_into_class 'app/controllers/application_controller.rb', ApplicationController,
9
- " include EnjuLibrary::Controller\n"
8
+ inject_into_file 'app/controllers/application_controller.rb',
9
+ " include EnjuLibrary::Controller\n", after: "include EnjuLeaf::Controller\n"
10
10
  append_to_file("app/models/user.rb", "Item.include(EnjuLibrary::EnjuItem)\n")
11
- gsub_file 'app/models/user.rb', /, :validatable$/, <<EOS
12
- , # :validatable,
13
- :lockable, lock_strategy: :none, unlock_strategy: :none
14
- include EnjuSeed::EnjuUser
15
- EOS
16
11
  end
17
12
  end
@@ -0,0 +1,4 @@
1
+ default:
2
+ name: default
3
+ display_name: "既定の予算"
4
+ position: 1
@@ -2,7 +2,7 @@
2
2
  library_00001:
3
3
  name: web
4
4
  short_display_name: Web
5
- display_name: World Wide Web
5
+ display_name_translations: {"en": "World Wide Web", "ja": "ウェブ"}
6
6
  fax_number:
7
7
  telephone_number_1:
8
8
  telephone_number_2:
@@ -14,7 +14,7 @@ library_00001:
14
14
  library_00002:
15
15
  name: yours
16
16
  short_display_name: your_library
17
- display_name: Your Library
17
+ display_name_translations: {"en": "Your Library", "ja": "自分の図書館"}
18
18
  fax_number:
19
19
  telephone_number_1:
20
20
  telephone_number_2:
@@ -1,12 +1,18 @@
1
- library_group_00001:
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ one:
2
3
  id: 1
3
4
  name: enju_library
4
- display_name: "en: Enju Library\r\n\
5
- ja: えんじゅ図書館"
6
- short_name: enju
5
+ display_name_translations: {"en": "Enju Library", "ja": "えんじゅ図書館"}
6
+ short_name: enju_library
7
7
  note:
8
8
  my_networks: "0.0.0.0/0\r\n\
9
9
  ::/0"
10
+ url: "http://localhost:3000/"
11
+ position: 1
12
+ login_banner_translations: {"ja": "オープンソース図書館システム Next-L Enju です。このメッセージは管理者としてログインした後に変更することができます。",
13
+ "en": "Next-L Enju, an open-source integrated library system. You can edit this message after logging in as Administrator."}
14
+ footer_banner_translations: {"en":"[Next-L Enju Leaf __VERSION__](https://github.com/next-l/enju_leaf), an open source integrated library system | [About this system](/page/about) | [Report bugs](https://github.com/next-l/enju_leaf/issues) | [Manual](https://next-l.github.io/manual/)",
15
+ "ja":"[Next-L Enju Leaf __VERSION__](https://github.com/next-l/enju_leaf), オープンソース統合図書館システム | [このシステムについて](/page/about) | [不具合を報告する](https://github.com/next-l/enju_leaf/issues) | [マニュアル](https://next-l.github.io/manual/)"}
10
16
  admin_networks: "0.0.0.0/0\r\n\
11
17
  ::/0"
12
- settings: "{\"max_number_of_results\":500, \"family_name_first\":true, \"skip_mobile_agents\":\"ipad\"}"
18
+ pub_year_facet_range_interval: 10
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  user_group_00001:
3
3
  name: "first_group"
4
- display_name: "First group"
4
+ display_name_translations: {"en": "First group", "ja": "最初のグループ"}
5
5
  note: ""
6
6
  position: 1
7
- id: 1
@@ -103,7 +103,7 @@ describe BudgetTypesController do
103
103
  budget_type = BudgetType.create! valid_attributes
104
104
  # Assuming there are no other budget_types in the database, this
105
105
  # specifies that the BudgetType created on the previous line
106
- # receives the :update message with whatever params are
106
+ # receives the :update_attributes message with whatever params are
107
107
  # submitted in the request.
108
108
  BudgetType.any_instance.should_receive(:update).with('note' => 'test')
109
109
  put :update, params: { id: budget_type.id, budget_type: { note: 'test' } }
@@ -0,0 +1,35 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe WithdrawsController, type: :controller do
4
+ fixtures :all
5
+
6
+ describe 'GET #show' do
7
+ before do
8
+ @withdraw = FactoryBot.create(:withdraw)
9
+ end
10
+
11
+ describe 'When logged in as Librarian' do
12
+ login_fixture_librarian
13
+ it 'should show withdrawn item' do
14
+ get :show, params: { id: @withdraw.to_param }
15
+ response.should be_successful
16
+ end
17
+ end
18
+
19
+ describe 'When logged in as User' do
20
+ login_fixture_user
21
+ it 'should show withdrawn item' do
22
+ get :show, params: { id: @withdraw.to_param }
23
+ response.should be_forbidden
24
+ end
25
+ end
26
+
27
+ describe 'When not logged in' do
28
+ it 'should show withdrawn item' do
29
+ item = FactoryBot.create(:item)
30
+ get :show, params: { id: @withdraw.to_param }
31
+ response.should redirect_to new_user_session_url
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,4 +1,5 @@
1
1
  module ApplicationHelper
2
2
  include EnjuLeaf::ApplicationHelper
3
+ include EnjuLibrary::ApplicationHelper
3
4
  include EnjuBiblio::ApplicationHelper
4
5
  end
@@ -3,9 +3,8 @@ class User < ApplicationRecord
3
3
  :recoverable, :rememberable, :trackable, #, :validatable
4
4
  :lockable, lock_strategy: :none, unlock_strategy: :none
5
5
 
6
- include EnjuSeed::EnjuUser
6
+ include EnjuLibrary::EnjuUser
7
7
  include EnjuCirculation::EnjuUser
8
- has_one :profile, dependent: :nullify
9
8
  end
10
9
 
11
10
  Accept.include(EnjuCirculation::EnjuAccept)
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
  load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/setup CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
2
  require 'fileutils'
4
3
  include FileUtils
5
4
 
6
5
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+ APP_ROOT = File.expand_path('..', __dir__)
8
7
 
9
8
  def system!(*args)
10
9
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -21,7 +20,6 @@ chdir APP_ROOT do
21
20
  # Install JavaScript dependencies if using Yarn
22
21
  # system('bin/yarn')
23
22
 
24
-
25
23
  # puts "\n== Copying sample files =="
26
24
  # unless File.exist?('config/database.yml')
27
25
  # cp 'config/database.yml.sample', 'config/database.yml'
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
2
  require 'fileutils'
4
3
  include FileUtils
5
4
 
6
5
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+ APP_ROOT = File.expand_path('..', __dir__)
8
7
 
9
8
  def system!(*args)
10
9
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -18,6 +17,9 @@ chdir APP_ROOT do
18
17
  system! 'gem install bundler --conservative'
19
18
  system('bundle check') || system!('bundle install')
20
19
 
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
21
23
  puts "\n== Updating database =="
22
24
  system! 'bin/rails db:migrate'
23
25
 
data/spec/dummy/bin/yarn CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- VENDOR_PATH = File.expand_path('..', __dir__)
3
- Dir.chdir(VENDOR_PATH) do
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
4
  begin
5
- exec "yarnpkg #{ARGV.join(" ")}"
5
+ exec "yarnpkg", *ARGV
6
6
  rescue Errno::ENOENT
7
7
  $stderr.puts "Yarn executable was not detected in the system."
8
8
  $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
@@ -17,6 +17,7 @@ module Dummy
17
17
  # Settings in config/environments/* take precedence over those specified here.
18
18
  # Application configuration should go into files in config/initializers
19
19
  # -- all .rb files in that directory are automatically loaded.
20
+ config.i18n.available_locales = [:en, :ja]
20
21
  end
21
22
  end
22
23
 
@@ -1,25 +1,86 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
1
+ # PostgreSQL. Versions 9.1 and up are supported.
3
2
  #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On OS X with Homebrew:
6
+ # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+ # On OS X with MacPorts:
8
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+ # On Windows:
10
+ # gem install pg
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+ #
14
+ # Configure Using Gemfile
15
+ # gem 'pg'
6
16
  #
7
17
  default: &default
8
- adapter: sqlite3
18
+ adapter: postgresql
19
+ encoding: unicode
20
+ # For details on connection pooling, see Rails configuration guide
21
+ # http://guides.rubyonrails.org/configuring.html#database-pooling
9
22
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
- timeout: 5000
23
+ user: postgres
11
24
 
12
25
  development:
13
26
  <<: *default
14
- database: db/development.sqlite3
27
+ database: enju_library_dummy_development
28
+
29
+ # The specified database role being used to connect to postgres.
30
+ # To create additional roles in postgres see `$ createuser --help`.
31
+ # When left blank, postgres will use the default role. This is
32
+ # the same name as the operating system user that initialized the database.
33
+ #username: enju_library_dummy
34
+
35
+ # The password associated with the postgres role (username).
36
+ #password:
37
+
38
+ # Connect on a TCP socket. Omitted by default since the client uses a
39
+ # domain socket that doesn't need configuration. Windows does not have
40
+ # domain sockets, so uncomment these lines.
41
+ #host: localhost
42
+
43
+ # The TCP port the server listens on. Defaults to 5432.
44
+ # If your server runs on a different port number, change accordingly.
45
+ #port: 5432
46
+
47
+ # Schema search path. The server defaults to $user,public
48
+ #schema_search_path: myapp,sharedapp,public
49
+
50
+ # Minimum log levels, in increasing order:
51
+ # debug5, debug4, debug3, debug2, debug1,
52
+ # log, notice, warning, error, fatal, and panic
53
+ # Defaults to warning.
54
+ #min_messages: notice
15
55
 
16
56
  # Warning: The database defined as "test" will be erased and
17
57
  # re-generated from your development database when you run "rake".
18
58
  # Do not set this db to the same as development or production.
19
59
  test:
20
60
  <<: *default
21
- database: db/test.sqlite3
61
+ database: enju_library_dummy_test
22
62
 
63
+ # As with config/secrets.yml, you never want to store sensitive information,
64
+ # like your database password, in your source code. If your source code is
65
+ # ever seen by anyone, they now have access to your database.
66
+ #
67
+ # Instead, provide the password as a unix environment variable when you boot
68
+ # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
69
+ # for a full rundown on how to provide these environment variables in a
70
+ # production deployment.
71
+ #
72
+ # On Heroku and other platform providers, you may have a full connection URL
73
+ # available as an environment variable. For example:
74
+ #
75
+ # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
76
+ #
77
+ # You can use this database configuration with:
78
+ #
79
+ # production:
80
+ # url: <%= ENV['DATABASE_URL'] %>
81
+ #
23
82
  production:
24
83
  <<: *default
25
- database: db/production.sqlite3
84
+ database: enju_library_dummy_production
85
+ username: enju_library_dummy
86
+ password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
@@ -6,7 +6,7 @@ Rails.application.config.assets.version = '1.0'
6
6
  # Add additional assets to the asset load path.
7
7
  # Rails.application.config.assets.paths << Emoji.images_path
8
8
  # Add Yarn node_modules folder to the asset load path.
9
- Rails.application.config.assets.paths << Rails.root.join('node_modules')
9
+ Rails.application.config.assets.paths << Rails.root.join('../../', 'node_modules')
10
10
 
11
11
  # Precompile additional assets.
12
12
  # application.js, application.css, and all non-JS/CSS in the app/assets
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
File without changes
@@ -1,8 +1,8 @@
1
1
  class CreateEvents < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :events do |t|
4
- t.integer :library_id, null: false
5
- t.integer :event_category_id, null: false
4
+ t.references :library, index: true, null: false
5
+ t.references :event_category, index: true, null: false
6
6
  t.string :name
7
7
  t.text :note
8
8
  t.datetime :start_at
@@ -13,8 +13,6 @@ class CreateEvents < ActiveRecord::Migration[4.2]
13
13
 
14
14
  t.timestamps
15
15
  end
16
- add_index :events, :library_id
17
- add_index :events, :event_category_id
18
16
  end
19
17
 
20
18
  def self.down
@@ -1,10 +1,10 @@
1
1
  class CreateEventImportFiles < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :event_import_files do |t|
4
- t.integer :parent_id
4
+ t.references :parent, index: true
5
5
  t.string :content_type
6
6
  t.integer :size
7
- t.integer :user_id
7
+ t.references :user, index: true
8
8
  t.text :note
9
9
  t.datetime :imported_at
10
10
  t.string :event_import_file_name
@@ -15,8 +15,6 @@ class CreateEventImportFiles < ActiveRecord::Migration[4.2]
15
15
 
16
16
  t.timestamps
17
17
  end
18
- add_index :event_import_files, :parent_id
19
- add_index :event_import_files, :user_id
20
18
  end
21
19
 
22
20
  def self.down
@@ -1,14 +1,12 @@
1
1
  class CreateParticipates < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :participates do |t|
4
- t.integer :agent_id, null: false
5
- t.integer :event_id, null: false
4
+ t.references :agent, index: true, null: false
5
+ t.references :event, index: true, null: false
6
6
  t.integer :position
7
7
 
8
8
  t.timestamps
9
9
  end
10
- add_index :participates, :event_id
11
- add_index :participates, :agent_id
12
10
  end
13
11
 
14
12
  def self.down
@@ -1,8 +1,8 @@
1
1
  class CreateEventImportResults < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :event_import_results do |t|
4
- t.integer :event_import_file_id
5
- t.integer :event_id
4
+ t.references :event_import_file
5
+ t.references :event
6
6
  t.text :body
7
7
 
8
8
  t.timestamps
@@ -1,5 +1,5 @@
1
1
  class AddDefaultLibraryIdToEventImportFile < ActiveRecord::Migration[4.2]
2
2
  def change
3
- add_column :event_import_files, :default_library_id, :integer
3
+ add_reference :event_import_files, :default_library
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  class CreateEventExportFiles < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :event_export_files do |t|
4
- t.integer :user_id
4
+ t.references :user, index: true
5
5
  t.attachment :event_export
6
6
  t.datetime :executed_at
7
7
 
@@ -1,5 +1,5 @@
1
1
  class AddDefaultEventCategoryIdToEventImportFile < ActiveRecord::Migration[4.2]
2
2
  def change
3
- add_column :event_import_files, :default_event_category_id, :integer
3
+ add_reference :event_import_files, :default_event_category
4
4
  end
5
5
  end