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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4dbb62ca68cff89a7a1cbe0bc7846ab68173e8935dc4ee727fbd47e61ef0a0d0
4
- data.tar.gz: fdd0531c2f9ec6ee496755af0017ef7696a50efdbd00087c4b6b8bf477b25cfe
3
+ metadata.gz: e934beedc96dce953f9b68e7cb6d95bea1e0e4cb83454f03a5f2404797a52269
4
+ data.tar.gz: 0fc18a6416735b39a602e6389a6ccfe1b5410bab4ccf648d88a77ea76e1077ef
5
5
  SHA512:
6
- metadata.gz: 6f85b0664a3aa469ff3308a597fd3f120119eca3476d816c8af653c3b62b20bb5b64df151a07556014d693188f97ac79e0a2a863b7af65fa2284b80bcb9dcb8f
7
- data.tar.gz: 1dc33c9d09baf4918a42f7aba5d0a9c7d08fc7609f6bfcd3b68c17005ee3216f1da573c9e5ca4438cda36e899f306a63b8d983415c658ff40b55b617792be424
6
+ metadata.gz: 1ebd80409b9b708aaf8253f17276c4c250f5d743606d016332fbc639669a009c4b35359f22264f0f73a0b5f327cbe867a5067d0ae953b88461c77767fdaa7d99
7
+ data.tar.gz: 2c60aa8ecdecfe494380649894c571de5634024a10006b4b41067da1fde3e7aa40e218baa1bf64a858f31f79eefa4cfd0cb5b66b2e750bceb1b86711bc87228e
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # EnjuLibrary
2
- [![Travis CI](https://travis-ci.com/next-l/enju_library.svg?branch=1.3)](https://travis-ci.com/next-l/enju_library)
3
- [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_library/badge.svg?branch=1.3)](https://coveralls.io/github/next-l/enju_library?branch=1.3)
4
- [![security](https://hakiri.io/github/next-l/enju_library/1.3.svg)](https://hakiri.io/github/next-l/enju_library/1.3)
2
+ [![CircleCI](https://circleci.com/gh/next-l/enju_library/tree/2.x.svg?style=svg)](https://circleci.com/gh/next-l/enju_library/tree/2.x)
3
+ [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_library/badge.svg?branch=2.x)](https://coveralls.io/github/next-l/enju_library?branch=2.x)
5
4
 
6
5
  This project rocks and uses MIT-LICENSE.
7
6
 
@@ -6,7 +6,7 @@ class AcceptsController < ApplicationController
6
6
  # GET /accepts
7
7
  # GET /accepts.json
8
8
  def index
9
- if params[:format] == 'text'
9
+ if params[:format] == 'txt'
10
10
  @accepts = Accept.order('accepts.created_at DESC').page(params[:page]).per(65534)
11
11
  else
12
12
  if params[:accept]
@@ -29,7 +29,7 @@ class AcceptsController < ApplicationController
29
29
  format.html # index.html.erb
30
30
  format.json { render json: @accepts }
31
31
  format.js { @accept = Accept.new }
32
- format.text
32
+ format.txt
33
33
  end
34
34
  end
35
35
 
@@ -21,7 +21,7 @@ module EnjuLibrary
21
21
  format.html {render template: 'page/403', status: :forbidden}
22
22
  # format.html.phone {render template: 'page/403', status: 403}
23
23
  format.xml {render template: 'page/403', status: :forbidden}
24
- format.json { render json: {"error": "forbidden"} }
24
+ format.json { render text: '{"error": "forbidden"}' }
25
25
  format.rss {render template: 'page/403.xml', status: :forbidden}
26
26
  end
27
27
  else
@@ -29,7 +29,7 @@ module EnjuLibrary
29
29
  format.html { redirect_to main_app.new_user_session_url }
30
30
  # format.html.phone { redirect_to new_user_session_url }
31
31
  format.xml { render template: 'page/403', status: :forbidden }
32
- format.json { render json: {"error": "forbidden"} }
32
+ format.json { render text: '{"error": "forbidden"}' }
33
33
  format.rss { render template: 'page/403.xml', status: :forbidden }
34
34
  end
35
35
  end
@@ -41,7 +41,7 @@ module EnjuLibrary
41
41
  format.html { render template: 'page/404', status: :not_found }
42
42
  # format.html.phone { render template: 'page/404', status: 404 }
43
43
  format.xml { render template: 'page/404', status: :not_found }
44
- format.json { render json: {"error": "not_found"} }
44
+ format.json { render text: '{"error": "not_found"}' }
45
45
  format.rss { render template: 'page/404.xml', status: :not_found }
46
46
  end
47
47
  end
@@ -57,8 +57,8 @@ module EnjuLibrary
57
57
  format.html {render file: "#{Rails.root}/public/500", layout: false, status: :internal_server_error}
58
58
  # format.html.phone {render file: "#{Rails.root}/public/500", layout: false, status: 500}
59
59
  format.xml {render template: 'page/500', status: :internal_server_error}
60
- format.json { render json: {"error": "server_error"} }
61
- format.rss {render template: 'page/500.xml', status: :internal_server_error}
60
+ format.json { render text: '{"error": "server_error"}' }
61
+ format.xml {render template: 'page/500.xml', status: :internal_server_error}
62
62
  end
63
63
  end
64
64
 
@@ -70,8 +70,8 @@ module EnjuLibrary
70
70
  format.html {render template: "page/500_nosolr", layout: false, status: :internal_server_error}
71
71
  # format.html.phone {render template: "page/500_nosolr", layout: false, status: 500}
72
72
  format.xml {render template: 'page/500', status: :internal_server_error}
73
- format.json { render json: {"error": "server_error"} }
74
- format.rss {render template: 'page/500.xml', status: :internal_server_error}
73
+ format.json { render text: '{"error": "server_error"}' }
74
+ format.xml {render template: 'page/500.xml', status: :internal_server_error}
75
75
  end
76
76
  end
77
77
 
@@ -133,7 +133,10 @@ class LibrariesController < ApplicationController
133
133
  :name, :display_name, :short_display_name, :zip_code, :street,
134
134
  :locality, :region, :telephone_number_1, :telephone_number_2, :fax_number,
135
135
  :note, :call_number_rows, :call_number_delimiter, :library_group_id,
136
- :country_id, :opening_hour, :isil, :position, :latitude, :longitude
136
+ :country_id, :opening_hour, :isil, :position,
137
+ I18n.available_locales.map{|locale|
138
+ :"display_name_#{locale.to_s}"
139
+ }
137
140
  )
138
141
  end
139
142
 
@@ -82,13 +82,19 @@ class LibraryGroupsController < ApplicationController
82
82
  :book_jacket_source, :screenshot_generator, :erms_url,
83
83
  :header_logo, :delete_header_logo,
84
84
  :allow_bookmark_external_url, # EnjuBookmark
85
+ I18n.available_locales.map{|locale|
86
+ [
87
+ :"display_name_#{locale.to_s}",
88
+ :"login_banner_#{locale.to_s}",
89
+ :"footer_banner_#{locale.to_s}"
90
+ ]
91
+ },
85
92
  {
86
93
  colors_attributes: [:id, :property, :code]
87
94
  },
88
95
  {
89
96
  user_attributes: [:email]
90
97
  },
91
- *LibraryGroup.globalize_attribute_names,
92
98
  )
93
99
  end
94
100
  end
@@ -95,6 +95,11 @@ class RequestStatusTypesController < ApplicationController
95
95
  end
96
96
 
97
97
  def request_status_type_params
98
- params.require(:request_status_type).permit(:name, :display_name, :note)
98
+ params.require(:request_status_type).permit(
99
+ :name, :display_name, :note,
100
+ I18n.available_locales.map{|locale|
101
+ :"display_name_#{locale.to_s}"
102
+ }
103
+ )
99
104
  end
100
105
  end
@@ -95,6 +95,11 @@ class RequestTypesController < ApplicationController
95
95
  end
96
96
 
97
97
  def request_type_params
98
- params.require(:request_type).permit(:name, :display_name, :note)
98
+ params.require(:request_type).permit(
99
+ :name, :display_name, :note,
100
+ I18n.available_locales.map{|locale|
101
+ :"display_name_#{locale.to_s}"
102
+ }
103
+ )
99
104
  end
100
105
  end
@@ -149,7 +149,10 @@ class ShelvesController < ApplicationController
149
149
 
150
150
  def shelf_params
151
151
  params.require(:shelf).permit(
152
- :name, :display_name, :note, :library_id, :closed
152
+ :name, :display_name, :note, :library_id, :closed,
153
+ I18n.available_locales.map{|locale|
154
+ :"display_name_#{locale.to_s}"
155
+ }
153
156
  )
154
157
  end
155
158
  end
@@ -103,6 +103,9 @@ class UserGroupsController < ApplicationController
103
103
  :number_of_day_to_notify_overdue,
104
104
  :number_of_day_to_notify_due_date,
105
105
  :number_of_time_to_notify_overdue,
106
+ I18n.available_locales.map{|locale|
107
+ :"display_name_#{locale.to_s}"
108
+ },
106
109
  # EnjuCirculation
107
110
  {user_group_has_checkout_types_attributes: [
108
111
  :id, :checkout_type_id, :checkout_limit, :checkout_period, :checkout_renewal_limit,
@@ -15,7 +15,7 @@ class UserImportResultsController < ApplicationController
15
15
  respond_to do |format|
16
16
  format.html # index.html.erb
17
17
  format.json { render json: @user_import_results }
18
- format.text
18
+ format.txt
19
19
  end
20
20
  end
21
21
 
@@ -6,7 +6,7 @@ class WithdrawsController < ApplicationController
6
6
  # GET /withdraws
7
7
  # GET /withdraws.json
8
8
  def index
9
- if params[:format] == 'text'
9
+ if params[:format] == 'txt'
10
10
  @withdraws = Withdraw.order('withdraws.created_at DESC').page(params[:page]).per(65534)
11
11
  else
12
12
  if params[:withdraw]
@@ -29,7 +29,7 @@ class WithdrawsController < ApplicationController
29
29
  format.html # index.html.erb
30
30
  format.json { render json: @withdraws }
31
31
  format.js { @withdraw = Withdraw.new }
32
- format.text
32
+ format.txt
33
33
  end
34
34
  end
35
35
 
@@ -0,0 +1,18 @@
1
+ module EnjuLibrary
2
+ module ApplicationHelper
3
+ def library_shelf_facet(current_library, facet)
4
+ library = Library.where(name: facet.value).select([:name, :display_name_translations]).first
5
+ return nil unless library
6
+ current = true if current_library.try(:name) == library.name
7
+ content_tag :li do
8
+ if current
9
+ content_tag :strong do
10
+ link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, library_id: library.name, only_path: true)))
11
+ end
12
+ else
13
+ link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, library_id: library.name, only_path: true)))
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -2,6 +2,7 @@ class BudgetType < ApplicationRecord
2
2
  include MasterModel
3
3
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
4
4
  has_many :items
5
+ translates :display_name
5
6
 
6
7
  private
7
8
 
@@ -14,11 +15,12 @@ end
14
15
  #
15
16
  # Table name: budget_types
16
17
  #
17
- # id :integer not null, primary key
18
- # name :string
19
- # display_name :text
20
- # note :text
21
- # position :integer
22
- # created_at :datetime
23
- # updated_at :datetime
18
+ # id :integer not null, primary key
19
+ # name :string
20
+ # display_name :text
21
+ # note :text
22
+ # position :integer
23
+ # created_at :datetime
24
+ # updated_at :datetime
25
+ # display_name_translations :jsonb not null
24
26
  #
@@ -0,0 +1,10 @@
1
+ module EnjuLibrary
2
+ module EnjuUser
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include EnjuSeed::EnjuUser
7
+ has_many :basket, dependent: :destroy
8
+ end
9
+ end
10
+ end
@@ -10,6 +10,7 @@ class Library < ApplicationRecord
10
10
  extend FriendlyId
11
11
  friendly_id :name
12
12
  geocoded_by :address
13
+ translates :display_name
13
14
 
14
15
  searchable do
15
16
  text :name, :display_name, :note, :address
@@ -28,20 +29,6 @@ class Library < ApplicationRecord
28
29
  validates :isil, format: { with: /\A[A-Za-z]{1,4}-[A-Za-z0-9\/:\-]{2,11}\z/ }, allow_blank: true
29
30
  after_validation :geocode, if: :address_changed?
30
31
  after_create :create_shelf
31
- after_save :clear_all_cache
32
- after_destroy :clear_all_cache
33
-
34
- def self.all_cache
35
- if Rails.env == 'production'
36
- Rails.cache.fetch('library_all'){ Library.all }
37
- else
38
- Library.all
39
- end
40
- end
41
-
42
- def clear_all_cache
43
- Rails.cache.delete('library_all')
44
- end
45
32
 
46
33
  def create_shelf
47
34
  shelf = Shelf.new
@@ -62,12 +49,10 @@ class Library < ApplicationRecord
62
49
  def address(locale = I18n.locale)
63
50
  case locale.to_sym
64
51
  when :ja
65
- "#{region.to_s.localize(locale)}#{locality.to_s.localize(locale)}#{street.to_s.localize(locale)}"
52
+ "#{region}#{locality}#{street}"
66
53
  else
67
- "#{street.to_s.localize(locale)} #{locality.to_s.localize(locale)} #{region.to_s.localize(locale)}"
54
+ "#{street} #{locality} #{region}"
68
55
  end
69
- rescue Psych::SyntaxError
70
- nil
71
56
  end
72
57
 
73
58
  def address_changed?
@@ -94,29 +79,30 @@ end
94
79
  #
95
80
  # Table name: libraries
96
81
  #
97
- # id :integer not null, primary key
98
- # name :string not null
99
- # display_name :text
100
- # short_display_name :string not null
101
- # zip_code :string
102
- # street :text
103
- # locality :text
104
- # region :text
105
- # telephone_number_1 :string
106
- # telephone_number_2 :string
107
- # fax_number :string
108
- # note :text
109
- # call_number_rows :integer default(1), not null
110
- # call_number_delimiter :string default("|"), not null
111
- # library_group_id :integer not null
112
- # users_count :integer default(0), not null
113
- # position :integer
114
- # country_id :integer
115
- # created_at :datetime
116
- # updated_at :datetime
117
- # deleted_at :datetime
118
- # opening_hour :text
119
- # isil :string
120
- # latitude :float
121
- # longitude :float
82
+ # id :integer not null, primary key
83
+ # name :string not null
84
+ # display_name :text
85
+ # short_display_name :string not null
86
+ # zip_code :string
87
+ # street :text
88
+ # locality :text
89
+ # region :text
90
+ # telephone_number_1 :string
91
+ # telephone_number_2 :string
92
+ # fax_number :string
93
+ # note :text
94
+ # call_number_rows :integer default(1), not null
95
+ # call_number_delimiter :string default("|"), not null
96
+ # library_group_id :integer not null
97
+ # users_count :integer default(0), not null
98
+ # position :integer
99
+ # country_id :integer
100
+ # created_at :datetime
101
+ # updated_at :datetime
102
+ # deleted_at :datetime
103
+ # opening_hour :text
104
+ # isil :string
105
+ # latitude :float
106
+ # longitude :float
107
+ # display_name_translations :jsonb not null
122
108
  #
@@ -2,14 +2,14 @@ class LibraryGroup < ApplicationRecord
2
2
  #include Singleton
3
3
  include MasterModel
4
4
 
5
- has_many :libraries, dependent: :destroy
6
- has_many :colors, dependent: :destroy
5
+ has_many :libraries
6
+ has_many :colors
7
7
  belongs_to :country, optional: true
8
8
  belongs_to :user, optional: true
9
9
 
10
10
  validates :url, presence: true, url: true
11
11
  validates :max_number_of_results, numericality: {
12
- greater_than_or_equal_to: 0
12
+ greater_than_or_equal_to: 1
13
13
  }
14
14
  accepts_nested_attributes_for :colors, update_only: true
15
15
  accepts_nested_attributes_for :user, update_only: true
@@ -18,8 +18,7 @@ class LibraryGroup < ApplicationRecord
18
18
  :erms_url
19
19
  ], coder: JSON
20
20
 
21
- translates :login_banner, :footer_banner
22
- globalize_accessors
21
+ translates :login_banner, :footer_banner, :display_name
23
22
 
24
23
  if ENV['ENJU_STORAGE'] == 's3'
25
24
  has_attached_file :header_logo, storage: :s3, styles: { medium: 'x80'},
@@ -44,7 +43,7 @@ class LibraryGroup < ApplicationRecord
44
43
  end
45
44
 
46
45
  def self.system_name(locale = I18n.locale)
47
- LibraryGroup.site_config.display_name.localize(locale)
46
+ LibraryGroup.site_config.send(:"display_name_#{locale.to_s}")
48
47
  end
49
48
 
50
49
  def config?
@@ -97,7 +96,7 @@ end
97
96
  # settings :text
98
97
  # html_snippet :text
99
98
  # book_jacket_source :string
100
- # max_number_of_results :integer default(1000)
99
+ # max_number_of_results :integer default(500)
101
100
  # family_name_first :boolean default(TRUE)
102
101
  # screenshot_generator :string
103
102
  # pub_year_facet_range_interval :integer default(10)
@@ -105,10 +104,10 @@ end
105
104
  # csv_charset_conversion :boolean default(FALSE), not null
106
105
  # header_logo_file_name :string
107
106
  # header_logo_content_type :string
108
- # header_logo_file_size :integer
107
+ # header_logo_file_size :bigint
109
108
  # header_logo_updated_at :datetime
110
109
  # header_logo_meta :text
111
- # library_group_id :integer not null
112
- # login_banner :text
113
- # footer_banner :text
110
+ # display_name_translations :jsonb not null
111
+ # login_banner_translations :jsonb not null
112
+ # footer_banner_translations :jsonb not null
114
113
  #
@@ -2,6 +2,7 @@ class RequestStatusType < ApplicationRecord
2
2
  include MasterModel
3
3
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
4
4
  has_many :reserves
5
+ translates :display_name
5
6
 
6
7
  private
7
8
 
@@ -14,11 +15,12 @@ end
14
15
  #
15
16
  # Table name: request_status_types
16
17
  #
17
- # id :integer not null, primary key
18
- # name :string not null
19
- # display_name :text
20
- # note :text
21
- # position :integer
22
- # created_at :datetime
23
- # updated_at :datetime
18
+ # id :integer not null, primary key
19
+ # name :string not null
20
+ # display_name :text
21
+ # note :text
22
+ # position :integer
23
+ # created_at :datetime
24
+ # updated_at :datetime
25
+ # display_name_translations :jsonb not null
24
26
  #
@@ -1,6 +1,7 @@
1
1
  class RequestType < ApplicationRecord
2
2
  include MasterModel
3
3
  validates :name, presence: true, format: { with: /\A[0-9A-Za-z][0-9A-Za-z_\-\s,]*[0-9a-z]\Z/ }
4
+ translates :display_name
4
5
 
5
6
  private
6
7
 
@@ -13,11 +14,12 @@ end
13
14
  #
14
15
  # Table name: request_types
15
16
  #
16
- # id :integer not null, primary key
17
- # name :string not null
18
- # display_name :text
19
- # note :text
20
- # position :integer
21
- # created_at :datetime
22
- # updated_at :datetime
17
+ # id :integer not null, primary key
18
+ # name :string not null
19
+ # display_name :text
20
+ # note :text
21
+ # position :integer
22
+ # created_at :datetime
23
+ # updated_at :datetime
24
+ # display_name_translations :jsonb not null
23
25
  #
@@ -6,14 +6,9 @@ class SearchEngine < ApplicationRecord
6
6
  validates :http_method, presence: true, inclusion: %w(get post)
7
7
  validates :url, presence: true, url: true, length: { maximum: 255 }
8
8
  validates :base_url, presence: true, url: true, length: { maximum: 255 }
9
- after_save :clear_all_cache
10
- after_destroy :clear_all_cache
11
9
 
12
10
  paginates_per 10
13
-
14
- def clear_all_cache
15
- Rails.cache.delete('search_engine_all')
16
- end
11
+ translates :display_name
17
12
 
18
13
  def search_params(query)
19
14
  params = {}
@@ -31,16 +26,17 @@ end
31
26
  #
32
27
  # Table name: search_engines
33
28
  #
34
- # id :integer not null, primary key
35
- # name :string not null
36
- # display_name :text
37
- # url :string not null
38
- # base_url :text not null
39
- # http_method :text not null
40
- # query_param :text not null
41
- # additional_param :text
42
- # note :text
43
- # position :integer
44
- # created_at :datetime
45
- # updated_at :datetime
29
+ # id :integer not null, primary key
30
+ # name :string not null
31
+ # display_name :text
32
+ # url :string not null
33
+ # base_url :text not null
34
+ # http_method :text not null
35
+ # query_param :text not null
36
+ # additional_param :text
37
+ # note :text
38
+ # position :integer
39
+ # created_at :datetime
40
+ # updated_at :datetime
41
+ # display_name_translations :jsonb not null
46
42
  #
data/app/models/shelf.rb CHANGED
@@ -12,6 +12,7 @@ class Shelf < ApplicationRecord
12
12
  before_update :reset_position
13
13
 
14
14
  acts_as_list scope: :library
15
+ translates :display_name
15
16
 
16
17
  searchable do
17
18
  string :shelf_name do
@@ -53,15 +54,16 @@ end
53
54
  #
54
55
  # Table name: shelves
55
56
  #
56
- # id :integer not null, primary key
57
- # name :string not null
58
- # display_name :text
59
- # note :text
60
- # library_id :integer not null
61
- # items_count :integer default(0), not null
62
- # position :integer
63
- # created_at :datetime
64
- # updated_at :datetime
65
- # deleted_at :datetime
66
- # closed :boolean default(FALSE), not null
57
+ # id :integer not null, primary key
58
+ # name :string not null
59
+ # display_name :text
60
+ # note :text
61
+ # library_id :integer not null
62
+ # items_count :integer default(0), not null
63
+ # position :integer
64
+ # created_at :datetime
65
+ # updated_at :datetime
66
+ # deleted_at :datetime
67
+ # closed :boolean default(FALSE), not null
68
+ # display_name_translations :jsonb not null
67
69
  #
@@ -30,7 +30,7 @@ class UserExportFile < ApplicationRecord
30
30
  def export!
31
31
  transition_to!(:started)
32
32
  tempfile = Tempfile.new(['user_export_file_', '.txt'])
33
- file = User.export(format: :text)
33
+ file = User.export(format: :txt)
34
34
  tempfile.puts(file)
35
35
  tempfile.close
36
36
  self.user_export = File.new(tempfile.path, 'r')
@@ -61,7 +61,7 @@ end
61
61
  # user_id :integer
62
62
  # user_export_file_name :string
63
63
  # user_export_content_type :string
64
- # user_export_file_size :integer
64
+ # user_export_file_size :bigint
65
65
  # user_export_updated_at :datetime
66
66
  # executed_at :datetime
67
67
  # created_at :datetime
@@ -6,7 +6,7 @@ class UserExportFileStateMachine
6
6
  state :completed
7
7
  state :failed
8
8
 
9
- transition from: :pending, to: [:started, :failed]
9
+ transition from: :pending, to: :started
10
10
  transition from: :started, to: [:completed, :failed]
11
11
 
12
12
  after_transition(from: :pending, to: :started) do |user_export_file|
@@ -5,6 +5,7 @@ class UserGroup < ApplicationRecord
5
5
  validates_numericality_of :valid_period_for_new_user,
6
6
  greater_than_or_equal_to: 0,
7
7
  allow_blank: true
8
+ translates :display_name
8
9
 
9
10
  paginates_per 10
10
11
  end
@@ -26,4 +27,5 @@ end
26
27
  # number_of_day_to_notify_overdue :integer default(7), not null
27
28
  # number_of_day_to_notify_due_date :integer default(3), not null
28
29
  # number_of_time_to_notify_overdue :integer default(3), not null
30
+ # display_name_translations :jsonb not null
29
31
  #