enju_biblio 0.3.13 → 0.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (385) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -3
  3. data/app/controllers/agents_controller.rb +6 -0
  4. data/app/controllers/content_types_controller.rb +1 -1
  5. data/app/controllers/items_controller.rb +10 -18
  6. data/app/controllers/manifestations_controller.rb +85 -80
  7. data/app/controllers/resource_import_results_controller.rb +2 -6
  8. data/app/controllers/series_statements_controller.rb +6 -0
  9. data/app/helpers/enju_biblio/application_helper.rb +5 -5
  10. data/app/helpers/manifestations_helper.rb +12 -12
  11. data/app/models/agent.rb +4 -13
  12. data/app/models/agent_import_file.rb +1 -1
  13. data/app/models/agent_relationship_type.rb +8 -7
  14. data/app/models/agent_type.rb +10 -7
  15. data/app/models/carrier_type.rb +14 -11
  16. data/app/models/content_type.rb +10 -7
  17. data/app/models/create_type.rb +8 -7
  18. data/app/models/doi_record.rb +36 -0
  19. data/app/models/form_of_work.rb +11 -8
  20. data/app/models/frequency.rb +11 -8
  21. data/app/models/identifier.rb +1 -1
  22. data/app/models/identifier_type.rb +1 -0
  23. data/app/models/import_request.rb +3 -4
  24. data/app/models/isbn_record.rb +51 -0
  25. data/app/models/isbn_record_and_manifestation.rb +18 -0
  26. data/app/models/issn_record.rb +49 -0
  27. data/app/models/issn_record_and_manifestation.rb +18 -0
  28. data/app/models/item.rb +7 -55
  29. data/app/models/language.rb +10 -9
  30. data/app/models/license.rb +9 -7
  31. data/app/models/manifestation.rb +271 -158
  32. data/app/models/manifestation_relationship_type.rb +9 -7
  33. data/app/models/medium_of_performance.rb +11 -8
  34. data/app/models/periodical.rb +33 -0
  35. data/app/models/periodical_and_manifestation.rb +16 -0
  36. data/app/models/picture_file.rb +2 -0
  37. data/app/models/produce_type.rb +8 -7
  38. data/app/models/realize_type.rb +8 -7
  39. data/app/models/resource_export_file.rb +8 -6
  40. data/app/models/resource_export_file_state_machine.rb +1 -1
  41. data/app/models/resource_import_file.rb +62 -153
  42. data/app/views/agent_import_results/index.txt.erb +3 -0
  43. data/app/views/agent_relationship_types/index.html.erb +1 -1
  44. data/app/views/agent_relationship_types/show.html.erb +1 -1
  45. data/app/views/agent_relationships/_form.html.erb +1 -1
  46. data/app/views/agent_types/index.html.erb +1 -1
  47. data/app/views/agent_types/show.html.erb +1 -1
  48. data/app/views/agents/_agent.html.erb +1 -1
  49. data/app/views/agents/_agent_list.html.erb +2 -2
  50. data/app/views/agents/_form.html.erb +4 -4
  51. data/app/views/agents/_index_agent.html.erb +1 -1
  52. data/app/views/agents/_index_agent_merge_list.html.erb +1 -1
  53. data/app/views/agents/_index_expression.html.erb +2 -2
  54. data/app/views/agents/_index_manifestation.html.erb +2 -2
  55. data/app/views/agents/_index_work.html.erb +2 -2
  56. data/app/views/agents/index.atom.builder +1 -1
  57. data/app/views/agents/index.rss.builder +3 -3
  58. data/app/views/agents/show.html+phone.erb +2 -2
  59. data/app/views/agents/show.html.erb +2 -2
  60. data/app/views/carrier_types/index.html.erb +2 -2
  61. data/app/views/carrier_types/show.html.erb +3 -3
  62. data/app/views/content_types/index.html.erb +1 -1
  63. data/app/views/content_types/show.html.erb +1 -1
  64. data/app/views/countries/index.html.erb +1 -1
  65. data/app/views/countries/show.html.erb +1 -1
  66. data/app/views/create_types/index.html.erb +1 -1
  67. data/app/views/create_types/show.html.erb +1 -1
  68. data/app/views/creates/_form.html.erb +1 -1
  69. data/app/views/form_of_works/index.html.erb +1 -1
  70. data/app/views/form_of_works/show.html.erb +1 -1
  71. data/app/views/frequencies/index.html.erb +1 -1
  72. data/app/views/frequencies/show.html.erb +1 -1
  73. data/app/views/identifier_types/index.html.erb +1 -1
  74. data/app/views/identifier_types/show.html.erb +1 -1
  75. data/app/views/items/_form.html.erb +13 -33
  76. data/app/views/items/index.html+phone.erb +3 -3
  77. data/app/views/items/index.html.erb +3 -3
  78. data/app/views/items/show.html+phone.erb +5 -5
  79. data/app/views/items/show.html.erb +119 -134
  80. data/app/views/languages/index.html.erb +1 -1
  81. data/app/views/languages/show.html.erb +1 -1
  82. data/app/views/layouts/agents.html.erb +2 -2
  83. data/app/views/layouts/items.html.erb +1 -1
  84. data/app/views/layouts/manifestations.html.erb +4 -4
  85. data/app/views/licenses/index.html.erb +1 -1
  86. data/app/views/licenses/show.html.erb +1 -1
  87. data/app/views/manifestation_relationship_types/index.html.erb +1 -1
  88. data/app/views/manifestation_relationship_types/show.html.erb +1 -1
  89. data/app/views/manifestation_relationships/_form.html.erb +1 -1
  90. data/app/views/manifestations/_call_number.html.erb +3 -3
  91. data/app/views/manifestations/_carrier_type_facet.html.erb +1 -1
  92. data/app/views/manifestations/_classification_facet.html.erb +2 -2
  93. data/app/views/manifestations/_export_detail.html.erb +0 -1
  94. data/app/views/manifestations/_export_list.html.erb +3 -4
  95. data/app/views/manifestations/_form.html.erb +8 -31
  96. data/app/views/manifestations/_identifier_fields.html.erb +1 -1
  97. data/app/views/manifestations/_language_facet.html.erb +1 -1
  98. data/app/views/manifestations/_library_facet.html.erb +1 -1
  99. data/app/views/manifestations/_manifestation.txt.erb +1 -1
  100. data/app/views/manifestations/_pub_year_facet.html.erb +1 -1
  101. data/app/views/manifestations/_reservable_facet.html.erb +2 -2
  102. data/app/views/manifestations/_show_creators.html.erb +1 -1
  103. data/app/views/manifestations/_show_detail_librarian.html.erb +13 -37
  104. data/app/views/manifestations/_show_detail_user.html.erb +13 -25
  105. data/app/views/manifestations/_show_holding.html+phone.erb +3 -3
  106. data/app/views/manifestations/_show_holding.html.erb +2 -2
  107. data/app/views/manifestations/explain.sru +9 -0
  108. data/app/views/manifestations/index.atom.builder +1 -1
  109. data/app/views/manifestations/index.html.erb +7 -7
  110. data/app/views/manifestations/index.opds.builder +1 -1
  111. data/app/views/manifestations/index.rdf.builder +3 -3
  112. data/app/views/manifestations/index.rss.builder +3 -3
  113. data/app/views/manifestations/index.sru.builder +101 -0
  114. data/app/views/manifestations/index.txt.erb +1 -0
  115. data/app/views/manifestations/show.txt.erb +1 -0
  116. data/app/views/medium_of_performances/index.html.erb +1 -1
  117. data/app/views/medium_of_performances/show.html.erb +1 -1
  118. data/app/views/notifier/manifestation_info.en.text.erb +1 -1
  119. data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
  120. data/app/views/picture_files/edit.html.erb +0 -4
  121. data/app/views/produce_types/index.html.erb +1 -1
  122. data/app/views/produce_types/show.html.erb +1 -1
  123. data/app/views/produces/_form.html.erb +1 -1
  124. data/app/views/realize_types/index.html.erb +1 -1
  125. data/app/views/realize_types/show.html.erb +1 -1
  126. data/app/views/realizes/_form.html.erb +1 -1
  127. data/app/views/resource_import_files/_results.html.erb +0 -6
  128. data/app/views/resource_import_files/new.html.erb +2 -2
  129. data/app/views/resource_import_results/index.html.erb +11 -0
  130. data/app/views/resource_import_results/index.txt.erb +3 -0
  131. data/app/views/series_statements/_form.html.erb +8 -6
  132. data/app/views/series_statements/show.html.erb +0 -12
  133. data/config/locales/translation_en.yml +1 -28
  134. data/config/locales/translation_ja.yml +3 -30
  135. data/config/routes.rb +0 -2
  136. data/db/migrate/20081027150907_create_picture_files.rb +2 -0
  137. data/db/migrate/20160319144230_create_issn_records.rb +11 -0
  138. data/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  139. data/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
  140. data/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
  141. data/db/migrate/20190102034126_create_doi_records.rb +13 -0
  142. data/db/migrate/20190311154610_create_periodicals.rb +10 -0
  143. data/db/migrate/20190312033839_create_periodical_and_manifestations.rb +11 -0
  144. data/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
  145. data/lib/enju_biblio/openurl.rb +1 -5
  146. data/lib/enju_biblio/porta_cql.rb +282 -0
  147. data/lib/enju_biblio/sru.rb +83 -0
  148. data/lib/enju_biblio/version.rb +1 -1
  149. data/lib/enju_biblio.rb +2 -0
  150. data/lib/generators/enju_biblio/setup/setup_generator.rb +0 -2
  151. data/lib/generators/enju_biblio/setup/templates/db/fixtures/agent_relationship_types.yml +3 -3
  152. data/lib/generators/enju_biblio/setup/templates/db/fixtures/agent_types.yml +2 -4
  153. data/lib/generators/enju_biblio/setup/templates/db/fixtures/carrier_types.yml +8 -26
  154. data/lib/generators/enju_biblio/setup/templates/db/fixtures/content_types.yml +12 -24
  155. data/lib/generators/enju_biblio/setup/templates/db/fixtures/create_types.yml +4 -22
  156. data/lib/generators/enju_biblio/setup/templates/db/fixtures/form_of_works.yml +1 -1
  157. data/lib/generators/enju_biblio/setup/templates/db/fixtures/frequencies.yml +9 -18
  158. data/lib/generators/enju_biblio/setup/templates/db/fixtures/languages.yml +2 -4
  159. data/lib/generators/enju_biblio/setup/templates/db/fixtures/licenses.yml +2 -2
  160. data/lib/generators/enju_biblio/setup/templates/db/fixtures/manifestation_relationship_types.yml +2 -4
  161. data/lib/generators/enju_biblio/setup/templates/db/fixtures/medium_of_performances.yml +15 -0
  162. data/lib/generators/enju_biblio/setup/templates/db/fixtures/produce_types.yml +2 -19
  163. data/lib/generators/enju_biblio/setup/templates/db/fixtures/realize_types.yml +3 -21
  164. data/spec/cassette_library/ImportRequestsController/POST_create/When_logged_in_as_Administrator/with_isbn_which_is_already_imported/assigns_a_newly_created_import_request_as_import_request.yml +121 -0
  165. data/spec/controllers/content_types_controller_spec.rb +1 -1
  166. data/spec/controllers/items_controller_spec.rb +1 -59
  167. data/spec/controllers/manifestations_controller_spec.rb +19 -49
  168. data/spec/dummy/app/helpers/application_helper.rb +1 -1
  169. data/spec/dummy/app/models/user.rb +4 -0
  170. data/spec/dummy/bin/bundle +1 -1
  171. data/spec/dummy/bin/setup +1 -3
  172. data/spec/dummy/bin/update +4 -2
  173. data/spec/dummy/bin/yarn +3 -3
  174. data/spec/dummy/config/application.rb +1 -2
  175. data/spec/dummy/config/database.yml +70 -9
  176. data/spec/dummy/config/initializers/assets.rb +2 -2
  177. data/spec/dummy/db/development.sqlite3 +0 -0
  178. data/spec/dummy/db/migrate/002_devise_create_users.rb +1 -0
  179. data/spec/dummy/db/migrate/113_create_events.rb +2 -4
  180. data/spec/dummy/db/migrate/154_create_messages.rb +4 -8
  181. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +3 -3
  182. data/spec/dummy/db/migrate/20081028093607_create_event_import_files.rb +2 -4
  183. data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -4
  184. data/spec/dummy/db/migrate/20100925074639_create_event_import_results.rb +2 -2
  185. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +1 -0
  186. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +1 -1
  187. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +1 -1
  188. data/spec/dummy/db/migrate/20140523171309_create_event_import_file_transitions.rb +1 -1
  189. data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +1 -1
  190. data/spec/dummy/db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb +1 -1
  191. data/spec/dummy/db/migrate/20140812152348_create_event_export_files.rb +1 -1
  192. data/spec/dummy/db/migrate/20140812153137_create_event_export_file_transitions.rb +1 -1
  193. data/spec/dummy/db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb +1 -1
  194. data/spec/dummy/db/migrate/20151128142913_create_places.rb +14 -0
  195. data/spec/dummy/db/migrate/20151201163718_add_place_id_to_event.rb +5 -0
  196. data/spec/dummy/db/migrate/20160703184258_add_most_recent_to_event_import_file_transitions.rb +9 -0
  197. data/spec/dummy/db/migrate/20160703184311_add_most_recent_to_event_export_file_transitions.rb +9 -0
  198. data/spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb +1 -1
  199. data/spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb +1 -1
  200. data/spec/dummy/db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb +9 -0
  201. data/spec/dummy/db/migrate/20170116150432_create_jpno_records.rb +10 -0
  202. data/spec/dummy/db/migrate/20171126072934_create_ndla_records.rb +10 -0
  203. data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
  204. data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
  205. data/spec/dummy/db/migrate/20180107164558_add_constraints_to_most_recent_for_event_import_file_transitions.rb +13 -0
  206. data/spec/dummy/db/migrate/20180107164617_add_constraints_to_most_recent_for_event_export_file_transitions.rb +13 -0
  207. data/spec/dummy/db/migrate/20180107172413_add_constraints_to_most_recent_for_bookmark_stat_transitions.rb +13 -0
  208. data/spec/dummy/db/migrate/20180709023035_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +36 -0
  209. data/spec/dummy/db/migrate/20180709023036_add_missing_unique_indices.acts_as_taggable_on_engine.rb +26 -0
  210. data/spec/dummy/db/migrate/20180709023037_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +20 -0
  211. data/spec/dummy/db/migrate/20180709023038_add_missing_taggable_index.acts_as_taggable_on_engine.rb +15 -0
  212. data/spec/dummy/db/migrate/20180709023039_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +15 -0
  213. data/spec/dummy/db/migrate/20180709023040_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
  214. data/spec/dummy/db/migrate/20180709161346_add_created_at_to_tag.rb +6 -0
  215. data/spec/dummy/db/migrate/20181119170645_add_foreign_key_to_events_referencing_event_categories.rb +5 -0
  216. data/spec/dummy/db/migrate/20190501043418_create_ndl_bib_id_records.rb +10 -0
  217. data/spec/dummy/db/migrate/20190508160525_create_retains.rb +10 -0
  218. data/spec/dummy/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
  219. data/spec/dummy/db/migrate/20190630115523_add_login_banner_translations_to_library_group.rb +6 -0
  220. data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
  221. data/spec/dummy/db/migrate/20190630153136_add_display_name_translations_to_event.rb +6 -0
  222. data/spec/dummy/db/migrate/20190706052525_add_display_name_translations_to_circulation_status.rb +5 -0
  223. data/spec/dummy/db/schema.rb +335 -221
  224. data/spec/dummy/db/test.sqlite3 +0 -0
  225. data/spec/factories/create_types.rb +8 -7
  226. data/spec/factories/produce_types.rb +8 -7
  227. data/spec/factories/realize_types.rb +8 -7
  228. data/spec/factories/series_statement.rb +3 -4
  229. data/spec/fixtures/agent_relationship_types.yml +8 -7
  230. data/spec/fixtures/agent_types.yml +11 -10
  231. data/spec/fixtures/carrier_types.yml +16 -15
  232. data/spec/fixtures/content_types.yml +20 -31
  233. data/spec/fixtures/create_types.yml +12 -15
  234. data/spec/fixtures/creates.yml +0 -2
  235. data/spec/fixtures/form_of_works.yml +11 -10
  236. data/spec/fixtures/frequencies.yml +17 -25
  237. data/spec/fixtures/items.yml +11 -12
  238. data/spec/fixtures/languages.yml +11 -11
  239. data/spec/fixtures/libraries.yml +30 -30
  240. data/spec/fixtures/library_groups.yml +11 -6
  241. data/spec/fixtures/licenses.yml +8 -7
  242. data/spec/fixtures/manifestation_relationship_types.yml +12 -11
  243. data/spec/fixtures/manifestations.yml +0 -1
  244. data/spec/fixtures/medium_of_performances.yml +10 -9
  245. data/spec/fixtures/picture_files.yml +2 -0
  246. data/spec/fixtures/produce_types.yml +10 -11
  247. data/spec/fixtures/produces.yml +0 -2
  248. data/spec/fixtures/profiles.yml +8 -5
  249. data/spec/fixtures/realize_types.yml +11 -13
  250. data/spec/fixtures/realizes.yml +0 -2
  251. data/spec/fixtures/request_status_types.yml +14 -14
  252. data/spec/fixtures/request_types.yml +13 -13
  253. data/spec/fixtures/resource_export_files.yml +1 -1
  254. data/spec/fixtures/resource_import_results.yml +2 -2
  255. data/spec/fixtures/roles.yml +22 -5
  256. data/spec/fixtures/shelves.yml +16 -16
  257. data/spec/fixtures/user_groups.yml +12 -12
  258. data/spec/fixtures/user_has_roles.yml +3 -4
  259. data/spec/fixtures/users.yml +0 -3
  260. data/spec/models/agent_relationship_type_spec.rb +8 -7
  261. data/spec/models/agent_type_spec.rb +8 -7
  262. data/spec/models/carrier_type_spec.rb +12 -11
  263. data/spec/models/content_type_spec.rb +8 -7
  264. data/spec/models/create_type_spec.rb +8 -7
  265. data/spec/models/doi_record_spec.rb +19 -0
  266. data/spec/models/form_of_work_spec.rb +8 -7
  267. data/spec/models/frequency_spec.rb +8 -7
  268. data/spec/models/item_spec.rb +0 -7
  269. data/spec/models/language_spec.rb +10 -9
  270. data/spec/models/license_spec.rb +8 -7
  271. data/spec/models/manifestation_relationship_type_spec.rb +8 -7
  272. data/spec/models/manifestation_spec.rb +81 -24
  273. data/spec/models/medium_of_performance_spec.rb +8 -7
  274. data/spec/models/periodical_and_manifestation_spec.rb +17 -0
  275. data/spec/models/periodical_spec.rb +16 -0
  276. data/spec/models/picture_file_spec.rb +2 -0
  277. data/spec/models/produce_type_spec.rb +8 -7
  278. data/spec/models/realize_type_spec.rb +8 -7
  279. data/spec/models/resource_export_file_spec.rb +9 -62
  280. data/spec/models/resource_import_file_spec.rb +14 -44
  281. data/spec/rails_helper.rb +8 -4
  282. data/spec/system/manifestations_spec.rb +0 -30
  283. data/spec/views/items/index.html.erb_spec.rb +6 -7
  284. data/spec/views/manifestations/index.html.erb_spec.rb +1 -1
  285. data/spec/views/manifestations/index.rdf.builder_spec.rb +1 -0
  286. data/spec/views/manifestations/{index.txt.ruby_spec.rb → index.txt.erb_spec.rb} +1 -1
  287. data/spec/views/manifestations/{show.txt.ruby_spec.rb → show.txt.erb_spec.rb} +2 -2
  288. data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
  289. metadata +560 -718
  290. data/app/controllers/item_custom_properties_controller.rb +0 -69
  291. data/app/controllers/manifestation_custom_properties_controller.rb +0 -69
  292. data/app/models/item_custom_property.rb +0 -18
  293. data/app/models/item_custom_value.rb +0 -17
  294. data/app/models/manifestation_custom_property.rb +0 -18
  295. data/app/models/manifestation_custom_value.rb +0 -17
  296. data/app/policies/item_custom_property_policy.rb +0 -21
  297. data/app/policies/manifestation_custom_property_policy.rb +0 -21
  298. data/app/views/agent_import_results/index.txt.ruby +0 -5
  299. data/app/views/item_custom_properties/_form.html.erb +0 -32
  300. data/app/views/item_custom_properties/edit.html.erb +0 -13
  301. data/app/views/item_custom_properties/index.html.erb +0 -43
  302. data/app/views/item_custom_properties/new.html.erb +0 -12
  303. data/app/views/item_custom_properties/show.html.erb +0 -28
  304. data/app/views/items/_item.json.jbuilder +0 -17
  305. data/app/views/items/index.json.jbuilder +0 -5
  306. data/app/views/items/show.json.jbuilder +0 -1
  307. data/app/views/manifestation_custom_properties/_form.html.erb +0 -32
  308. data/app/views/manifestation_custom_properties/edit.html.erb +0 -13
  309. data/app/views/manifestation_custom_properties/index.html.erb +0 -43
  310. data/app/views/manifestation_custom_properties/new.html.erb +0 -12
  311. data/app/views/manifestation_custom_properties/show.html.erb +0 -28
  312. data/app/views/manifestations/index.txt.ruby +0 -7
  313. data/app/views/manifestations/show.json.jbuilder +0 -2
  314. data/app/views/manifestations/show.txt.ruby +0 -5
  315. data/app/views/resource_import_results/index.txt.ruby +0 -5
  316. data/db/migrate/20190818075603_add_memo_to_manifestation.rb +0 -5
  317. data/db/migrate/20190818075628_add_memo_to_item.rb +0 -5
  318. data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +0 -12
  319. data/db/migrate/20200425072349_create_item_custom_properties.rb +0 -12
  320. data/db/migrate/20200425074758_create_manifestation_custom_values.rb +0 -12
  321. data/db/migrate/20200425074822_create_item_custom_values.rb +0 -12
  322. data/lib/generators/enju_biblio/setup/templates/db/fixtures/agents.yml +0 -19
  323. data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +0 -121
  324. data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +0 -121
  325. data/spec/controllers/item_custom_properties_controller_spec.rb +0 -449
  326. data/spec/controllers/manifestation_custom_properties_controller_spec.rb +0 -449
  327. data/spec/dummy/db/migrate/20081117143156_create_inventory_files.rb +0 -18
  328. data/spec/dummy/db/migrate/20081117143455_create_inventories.rb +0 -17
  329. data/spec/dummy/db/migrate/20090706125521_add_attachments_inventory_to_inventory_file.rb +0 -15
  330. data/spec/dummy/db/migrate/20091202124834_create_versions.rb +0 -18
  331. data/spec/dummy/db/migrate/20100525171356_acts_as_taggable_on_migration.rb +0 -30
  332. data/spec/dummy/db/migrate/20111217234412_add_save_checkout_history_to_user.rb +0 -5
  333. data/spec/dummy/db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb +0 -6
  334. data/spec/dummy/db/migrate/20120413100431_add_fingerprint_to_inventory_file.rb +0 -5
  335. data/spec/dummy/db/migrate/20150421023923_create_identities.rb +0 -14
  336. data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +0 -5
  337. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -18
  338. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +0 -22
  339. data/spec/factories/item_custom_property.rb +0 -6
  340. data/spec/factories/item_custom_value.rb +0 -6
  341. data/spec/factories/manifestation_custom_property.rb +0 -6
  342. data/spec/factories/manifestation_custom_value.rb +0 -6
  343. data/spec/fixtures/carrier_type_has_checkout_types.yml +0 -31
  344. data/spec/fixtures/checkout_stat_has_manifestations.yml +0 -24
  345. data/spec/fixtures/checkout_stat_has_users.yml +0 -24
  346. data/spec/fixtures/checkout_types.yml +0 -34
  347. data/spec/fixtures/circulation_statuses.yml +0 -136
  348. data/spec/fixtures/inventory_files.yml +0 -40
  349. data/spec/fixtures/item_custom_properties.yml +0 -24
  350. data/spec/fixtures/manifestation_checkout_stats.yml +0 -29
  351. data/spec/fixtures/manifestation_custom_properties.yml +0 -24
  352. data/spec/fixtures/manifestation_reserve_stats.yml +0 -29
  353. data/spec/fixtures/reserve_stat_has_manifestations.yml +0 -24
  354. data/spec/fixtures/reserve_stat_has_users.yml +0 -24
  355. data/spec/fixtures/reserve_transitions.yml +0 -104
  356. data/spec/fixtures/reserves.yml +0 -143
  357. data/spec/fixtures/use_restrictions.yml +0 -93
  358. data/spec/fixtures/user_checkout_stats.yml +0 -28
  359. data/spec/fixtures/user_group_has_checkout_types.yml +0 -111
  360. data/spec/fixtures/user_reserve_stats.yml +0 -28
  361. data/spec/models/item_custom_property_spec.rb +0 -18
  362. data/spec/models/item_custom_value_spec.rb +0 -17
  363. data/spec/models/manifestation_custom_property_spec.rb +0 -18
  364. data/spec/models/manifestation_custom_value_spec.rb +0 -17
  365. data/spec/requests/item_custom_properties_spec.rb +0 -129
  366. data/spec/requests/manifestation_custom_properties_spec.rb +0 -129
  367. data/spec/routing/item_custom_properties_routing_spec.rb +0 -38
  368. data/spec/routing/manifestation_custom_properties_routing_spec.rb +0 -38
  369. data/spec/system/items_spec.rb +0 -121
  370. data/spec/system/series_statements_spec.rb +0 -16
  371. data/spec/views/agent_import_results/index.html.erb_spec.rb +0 -29
  372. data/spec/views/agent_import_results/index.txt.ruby_spec.rb +0 -20
  373. data/spec/views/agent_import_results/show.html.erb_spec.rb +0 -24
  374. data/spec/views/item_custom_properties/edit.html.erb_spec.rb +0 -21
  375. data/spec/views/item_custom_properties/index.html.erb_spec.rb +0 -25
  376. data/spec/views/item_custom_properties/new.html.erb_spec.rb +0 -21
  377. data/spec/views/item_custom_properties/show.html.erb_spec.rb +0 -16
  378. data/spec/views/items/index.json.jbuilder_spec.rb +0 -15
  379. data/spec/views/items/show.json.jbuilder_spec.rb +0 -15
  380. data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +0 -21
  381. data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +0 -25
  382. data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +0 -21
  383. data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +0 -16
  384. data/spec/views/manifestations/show.json.jbuilder_spec.rb +0 -16
  385. data/spec/views/resource_import_results/index.txt.ruby_spec.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afa249847e374fa2a87ea6801bfb851af30e99edc72fd982a32ce52d1674fa0c
4
- data.tar.gz: 5ab7f1b8abd52e9c841c0445dd1a04db2d752fd077aada5672d70ea2ed2d8262
3
+ metadata.gz: 25f3dd27c99737a4cfbba700c0963f4352b7e237bf30bdea0bf9c446208906be
4
+ data.tar.gz: 544ee9521de65fb2cc918332e4c15ca88a89b346a021f7ca9a0bdabdb66841d5
5
5
  SHA512:
6
- metadata.gz: e937c7448b783f607e851da92fa21b38c7bb44677b572e47b7f11a3ef5cc9133e76e74a1b2a13657041acfbeef89ed9240fbbe8cc606179167606cfd8fd5075a
7
- data.tar.gz: 42b259f6e9d84b40a93b66d649c171b1d8a6ec84cdffc773d8871223a5de707383e3e82dfaddb4ceb76d980001cb8e1ec6096b35d29647dd298d0426460a936a
6
+ metadata.gz: 139f55a88e3958bfe75f687fac126219a964d15485bde0e66e264f54244cd550c4b44d284130582026090267de93693fbdcbaf2cf117166e34c0b2c62ccddc54
7
+ data.tar.gz: 895a8713dea2a69800fd2aa0edf8842ef20f9c9ebae86c92aff7d6c014fb5f5f90f1e689471f13918ed671f304f09fa933027bf7752bcac765aed7c3b209f28c
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # EnjuBiblio
2
- [![Travis CI](https://travis-ci.com/next-l/enju_biblio.svg?branch=1.3)](https://travis-ci.com/next-l/enju_biblio)
3
- [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_biblio/badge.svg?branch=1.3)](https://coveralls.io/github/next-l/enju_biblio?branch=1.3)
4
- [![security](https://hakiri.io/github/next-l/enju_biblio/1.3.svg)](https://hakiri.io/github/next-l/enju_biblio/1.3)
2
+ [![CircleCI](https://circleci.com/gh/next-l/enju_biblio/tree/2.x.svg?style=svg)](https://circleci.com/gh/next-l/enju_biblio/tree/2.x)
3
+ [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_biblio/badge.svg?branch=master)](https://coveralls.io/github/next-l/enju_biblio?branch=master)
5
4
 
6
5
  This project rocks and uses MIT-LICENSE.
7
6
 
@@ -227,4 +227,10 @@ class AgentsController < ApplicationController
227
227
  @languages = Language.all
228
228
  @agent_type = AgentType.where(name: 'person').first
229
229
  end
230
+
231
+ def filtered_params
232
+ params.permit([:view, :format, :page, :language, :sort_by, :per_page])
233
+ end
234
+
235
+ helper_method :filtered_params
230
236
  end
@@ -5,7 +5,7 @@ class ContentTypesController < ApplicationController
5
5
  # GET /content_types
6
6
  # GET /content_types.json
7
7
  def index
8
- @content_types = ContentType.order(:position)
8
+ @content_types = ContentType.all
9
9
 
10
10
  respond_to do |format|
11
11
  format.html # index.html.erb
@@ -51,17 +51,6 @@ class ItemsController < ApplicationController
51
51
 
52
52
  unless @inventory_file
53
53
  search = Sunspot.new_search(Item)
54
- selected_attributes = [
55
- :id, :item_identifier, :call_number, :manifestation_id, :acquired_at,
56
- :binding_item_identifier, :binding_call_number, :binded_at,
57
- :include_supplements, :url, :note,
58
- :circulation_status_id, :shelf_id,
59
- :created_at, :updated_at
60
- ]
61
- selected_attributes += [
62
- :memo, :required_role_id, :budget_type_id, :bookstore_id, :price
63
- ] if current_user.try(:has_role?, 'Librarian')
64
- search.data_accessor_for(Item).select = selected_attributes
65
54
  set_role_query(current_user, search)
66
55
 
67
56
  @query = query.dup
@@ -133,7 +122,7 @@ class ItemsController < ApplicationController
133
122
 
134
123
  respond_to do |format|
135
124
  format.html # index.html.erb
136
- format.json
125
+ format.json { render json: @items }
137
126
  format.txt { render layout: false }
138
127
  format.atom
139
128
  end
@@ -148,7 +137,7 @@ class ItemsController < ApplicationController
148
137
 
149
138
  respond_to do |format|
150
139
  format.html # show.html.erb
151
- format.json
140
+ format.json { render json: @item }
152
141
  end
153
142
  end
154
143
 
@@ -283,11 +272,8 @@ class ItemsController < ApplicationController
283
272
  :acquired_at, :bookstore_id, :missing_since, :budget_type_id,
284
273
  :lock_version, :manifestation_id, :library_id, :required_role_id,
285
274
  :binding_item_identifier, :binding_call_number, :binded_at,
286
- :use_restriction_id, :memo,
287
- {item_has_use_restriction_attributes: :use_restriction_id}, # EnjuCirculation
288
- {item_custom_values_attributes: [
289
- :id, :item_custom_property_id, :item_id, :value,:_destroy
290
- ]}
275
+ :use_restriction_id,
276
+ item_has_use_restriction_attributes: :use_restriction_id # EnjuCirculation
291
277
  )
292
278
  end
293
279
 
@@ -312,4 +298,10 @@ class ItemsController < ApplicationController
312
298
  end
313
299
  end
314
300
  end
301
+
302
+ def filtered_params
303
+ params.permit([:view, :format, :page, :library, :carrier_type, :reservable, :pub_date_from, :pub_date_until, :language, :sort_by, :per_page])
304
+ end
305
+
306
+ helper_method :filtered_params
315
307
  end
@@ -33,14 +33,25 @@ class ManifestationsController < ApplicationController
33
33
  per_page = 65534
34
34
  end
35
35
 
36
- if params[:api] == 'openurl'
37
- openurl = Openurl.new(params)
38
- @manifestations = openurl.search
39
- query = openurl.query_text
40
- sort = set_search_result_order(params[:sort_by], params[:order])
36
+ if params[:format] == 'sru'
37
+ if params[:operation] == 'searchRetrieve'
38
+ sru = Sru.new(params)
39
+ query = sru.cql.to_sunspot
40
+ sort = sru.sort_by
41
+ else
42
+ render template: 'manifestations/explain', layout: false
43
+ return
44
+ end
41
45
  else
42
- query = make_query(params[:query], params)
43
- sort = set_search_result_order(params[:sort_by], params[:order])
46
+ if params[:api] == 'openurl'
47
+ openurl = Openurl.new(params)
48
+ @manifestations = openurl.search
49
+ query = openurl.query_text
50
+ sort = set_search_result_order(params[:sort_by], params[:order])
51
+ else
52
+ query = make_query(params[:query], params)
53
+ sort = set_search_result_order(params[:sort_by], params[:order])
54
+ end
44
55
  end
45
56
 
46
57
  # 絞り込みを行わない状態のクエリ
@@ -180,37 +191,37 @@ class ManifestationsController < ApplicationController
180
191
  else
181
192
  per_page = Manifestation.default_per_page
182
193
  end
183
-
184
- pub_dates = parse_pub_date(params)
185
- pub_date_range = {}
186
-
187
- if pub_dates[:from] == '*'
188
- pub_date_range[:from] = 0
189
- else
190
- pub_date_range[:from] = Time.zone.parse(pub_dates[:from]).year
191
- end
192
- if pub_dates[:until] == '*'
193
- pub_date_range[:until] = 10000
194
- else
195
- pub_date_range[:until] = Time.zone.parse(pub_dates[:until]).year
196
- end
197
-
198
- if params[:pub_year_range_interval]
199
- pub_year_range_interval = params[:pub_year_range_interval].to_i
194
+ if params[:format] == 'sru'
195
+ #search.query.start_record(params[:startRecord] || 1, params[:maximumRecords] || 200)
200
196
  else
201
- pub_year_range_interval = @library_group.pub_year_facet_range_interval || 10
202
- end
197
+ pub_dates = parse_pub_date(params)
198
+ pub_date_range = {}
199
+ if pub_dates[:from] == '*'
200
+ pub_date_range[:from] = 0
201
+ else
202
+ pub_date_range[:from] = Time.zone.parse(pub_dates[:from]).year
203
+ end
204
+ if pub_dates[:until] == '*'
205
+ pub_date_range[:until] = 10000
206
+ else
207
+ pub_date_range[:until] = Time.zone.parse(pub_dates[:until]).year
208
+ end
209
+ if params[:pub_year_range_interval]
210
+ pub_year_range_interval = params[:pub_year_range_interval].to_i
211
+ else
212
+ pub_year_range_interval = @library_group.pub_year_facet_range_interval || 10
213
+ end
203
214
 
204
- search.build do
205
- facet :reservable if defined?(EnjuCirculation)
206
- facet :carrier_type
207
- facet :library
208
- facet :language
209
- facet :pub_year, range: pub_date_range[:from]..pub_date_range[:until], range_interval: pub_year_range_interval
210
- facet :subject_ids if defined?(EnjuSubject)
211
- paginate page: page.to_i, per_page: per_page
215
+ search.build do
216
+ facet :reservable if defined?(EnjuCirculation)
217
+ facet :carrier_type
218
+ facet :library
219
+ facet :language
220
+ facet :pub_year, range: pub_date_range[:from]..pub_date_range[:until], range_interval: pub_year_range_interval
221
+ facet :subject_ids if defined?(EnjuSubject)
222
+ paginate page: page.to_i, per_page: per_page
223
+ end
212
224
  end
213
-
214
225
  search_result = search.execute
215
226
  if @count[:query_result] > @max_number_of_results
216
227
  max_count = @max_number_of_results
@@ -250,6 +261,7 @@ class ManifestationsController < ApplicationController
250
261
  format.html
251
262
  format.html.phone
252
263
  format.xml { render xml: @manifestations }
264
+ format.sru { render layout: false }
253
265
  format.rss { render layout: false }
254
266
  format.txt { render layout: false }
255
267
  format.rdf { render layout: false }
@@ -320,7 +332,7 @@ class ManifestationsController < ApplicationController
320
332
  }
321
333
  format.rdf
322
334
  format.mods
323
- format.json
335
+ format.json { render json: @manifestation }
324
336
  format.txt
325
337
  format.js
326
338
  format.download {
@@ -343,8 +355,8 @@ class ManifestationsController < ApplicationController
343
355
  # GET /manifestations/new.json
344
356
  def new
345
357
  @manifestation = Manifestation.new
346
- @manifestation.language = Language.find_by(iso_639_1: @locale)
347
- @parent = Manifestation.find_by(id: params[:parent_id]) if params[:parent_id].present?
358
+ @manifestation.language = Language.where(iso_639_1: @locale).first
359
+ @parent = Manifestation.where(id: params[:parent_id]).first if params[:parent_id].present?
348
360
  if @parent
349
361
  @manifestation.parent_id = @parent.id
350
362
  [ :original_title, :title_transcription,
@@ -382,8 +394,11 @@ class ManifestationsController < ApplicationController
382
394
  # POST /manifestations
383
395
  # POST /manifestations.json
384
396
  def create
385
- @manifestation = Manifestation.new(manifestation_params)
386
- parent = Manifestation.find_by(id: @manifestation.parent_id)
397
+ creators_params = manifestation_params[:creators_attributes]
398
+ @manifestation = Manifestation.new(manifestation_params.delete_if{|k, v|
399
+ k == 'creators_attributes'
400
+ })
401
+ parent = Manifestation.where(id: @manifestation.parent_id).first
387
402
  unless @manifestation.original_title?
388
403
  @manifestation.original_title = @manifestation.attachment_file_name
389
404
  end
@@ -391,16 +406,14 @@ class ManifestationsController < ApplicationController
391
406
  respond_to do |format|
392
407
  if @manifestation.save
393
408
  Manifestation.transaction do
394
- set_creators
395
-
396
- if parent
397
- parent.derived_manifestations << @manifestation
398
- parent.index
399
- @manifestation.index
400
- end
401
-
402
- Sunspot.commit
409
+ @manifestation.creators = Agent.new_agents(creators_params)
410
+ parent.derived_manifestations << @manifestation if parent
411
+ end
412
+ if parent
413
+ parent.index
414
+ @manifestation.index
403
415
  end
416
+ Sunspot.commit
404
417
 
405
418
  format.html { redirect_to @manifestation, notice: t('controller.successfully_created', model: t('activerecord.models.manifestation')) }
406
419
  format.json { render json: @manifestation, status: :created, location: @manifestation }
@@ -415,12 +428,16 @@ class ManifestationsController < ApplicationController
415
428
  # PUT /manifestations/1
416
429
  # PUT /manifestations/1.json
417
430
  def update
418
- @manifestation.assign_attributes(manifestation_params)
431
+ creators_params = manifestation_params[:creators_attributes]
432
+ Manifestation.transaction do
433
+ @manifestation.update(manifestation_params.delete_if{|k, v|
434
+ k == 'creators_attributes'
435
+ })
436
+ @manifestation.creators = Agent.new_agents(creators_params)
437
+ end
419
438
 
420
439
  respond_to do |format|
421
- if @manifestation.save
422
- set_creators
423
-
440
+ if @manifestation.valid?
424
441
  format.html { redirect_to @manifestation, notice: t('controller.successfully_updated', model: t('activerecord.models.manifestation')) }
425
442
  format.json { head :no_content }
426
443
  else
@@ -472,7 +489,7 @@ class ManifestationsController < ApplicationController
472
489
  :valid_until, :date_submitted, :date_accepted, :date_captured,
473
490
  :ndl_bib_id, :pub_date, :edition_string, :volume_number, :issue_number,
474
491
  :serial_number, :content_type_id, :attachment, :lock_version,
475
- :dimensions, :fulltext_content, :extent, :memo,
492
+ :dimensions, :fulltext_content, :extent,
476
493
  :parent_id,
477
494
  :serial, :statement_of_responsibility,
478
495
  {creators_attributes: [
@@ -530,9 +547,6 @@ class ManifestationsController < ApplicationController
530
547
  {identifiers_attributes: [
531
548
  :id, :body, :identifier_type_id,
532
549
  :_destroy
533
- ]},
534
- {manifestation_custom_values_attributes: [
535
- :id, :manifestation_custom_property_id, :manifestation_id, :value,:_destroy
536
550
  ]}
537
551
  )
538
552
  end
@@ -718,12 +732,12 @@ class ManifestationsController < ApplicationController
718
732
  end
719
733
 
720
734
  def prepare_options
721
- @carrier_types = CarrierType.order(:position).select([:id, :display_name, :position])
722
- @content_types = ContentType.order(:position).select([:id, :display_name, :position])
723
- @roles = Role.select([:id, :display_name, :position])
724
- @languages = Language.order(:position).select([:id, :display_name, :position])
725
- @frequencies = Frequency.order(:position).select([:id, :display_name, :position])
726
- @identifier_types = IdentifierType.order(:position).select([:id, :display_name, :position])
735
+ @carrier_types = CarrierType.select([:id, :display_name_translations, :position])
736
+ @content_types = ContentType.select([:id, :display_name_translations, :position])
737
+ @roles = Role.select([:id, :display_name_translations, :position])
738
+ @languages = Language.select([:id, :display_name, :position])
739
+ @frequencies = Frequency.select([:id, :display_name_translations, :position])
740
+ @identifier_types = IdentifierType.select([:id, :display_name, :position])
727
741
  @nii_types = NiiType.select([:id, :display_name, :position]) if defined?(EnjuNii)
728
742
  if defined?(EnjuSubject)
729
743
  @subject_types = SubjectType.select([:id, :display_name, :position])
@@ -763,7 +777,7 @@ class ManifestationsController < ApplicationController
763
777
  if options[:pub_date_from].blank?
764
778
  pub_date[:from] = "*"
765
779
  else
766
- year = options[:pub_date_from].to_s.gsub(/\D/, '').rjust(4, "0")
780
+ year = options[:pub_date_from].rjust(4, "0")
767
781
  if year.length == 4
768
782
  pub_date[:from] = Time.zone.parse(Time.utc(year).to_s).beginning_of_year.utc.iso8601
769
783
  else
@@ -777,7 +791,7 @@ class ManifestationsController < ApplicationController
777
791
  if options[:pub_date_until].blank?
778
792
  pub_date[:until] = "*"
779
793
  else
780
- year = options[:pub_date_until].to_s.gsub(/\D/, '').rjust(4, "0")
794
+ year = options[:pub_date_until].rjust(4, "0")
781
795
  if year.length == 4
782
796
  pub_date[:until] = Time.zone.parse(Time.utc(year).to_s).end_of_year.utc.iso8601
783
797
  else
@@ -792,6 +806,8 @@ class ManifestationsController < ApplicationController
792
806
 
793
807
  def set_pub_date(query, options)
794
808
  unless options[:pub_date_from].blank? && options[:pub_date_until].blank?
809
+ options[:pub_date_from].to_s.gsub!(/\D/, '')
810
+ options[:pub_date_until].to_s.gsub!(/\D/, '')
795
811
  pub_date = parse_pub_date(options)
796
812
  query = "#{query} date_of_publication_d:[#{pub_date[:from]} TO #{pub_date[:until]}]"
797
813
  end
@@ -837,20 +853,9 @@ class ManifestationsController < ApplicationController
837
853
  query
838
854
  end
839
855
 
840
- def set_creators
841
- creators_params = manifestation_params[:creators_attributes]
842
- contributors_params = manifestation_params[:contributors_attributes]
843
- publishers_params = manifestation_params[:publishers_attributes]
844
-
845
- Manifestation.transaction do
846
- @manifestation.creates.destroy_all
847
- @manifestation.realizes.destroy_all
848
- @manifestation.produces.destroy_all
849
- @manifestation.reload
850
-
851
- @manifestation.creators = Agent.new_agents(creators_params)
852
- @manifestation.contributors = Agent.new_agents(contributors_params)
853
- @manifestation.publishers = Agent.new_agents(publishers_params)
854
- end
856
+ def filtered_params
857
+ params.permit([:view, :format, :library, :carrier_type, :reservable, :pub_date_from, :pub_date_until, :language, :sort_by, :per_page, :query])
855
858
  end
859
+
860
+ helper_method :filtered_params
856
861
  end
@@ -5,13 +5,9 @@ class ResourceImportResultsController < ApplicationController
5
5
  # GET /resource_import_results
6
6
  # GET /resource_import_results.json
7
7
  def index
8
- @resource_import_file = ResourceImportFile.find_by(id: params[:resource_import_file_id])
8
+ @resource_import_file = ResourceImportFile.where(id: params[:resource_import_file_id]).first
9
9
  if @resource_import_file
10
- if params[:format].to_s.downcase == 'txt'
11
- @resource_import_results = @resource_import_file.resource_import_results
12
- else
13
- @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])
14
- end
10
+ @resource_import_results = @resource_import_file.resource_import_results.page(params[:page])
15
11
  else
16
12
  @resource_import_results = ResourceImportResult.page(params[:page])
17
13
  end
@@ -133,4 +133,10 @@ class SeriesStatementsController < ApplicationController
133
133
  :series_master
134
134
  )
135
135
  end
136
+
137
+ def filtered_params
138
+ params.permit([:locale, :format, :page, :per_page])
139
+ end
140
+
141
+ helper_method :filtered_params
136
142
  end
@@ -1,7 +1,7 @@
1
1
  module EnjuBiblio
2
2
  module ApplicationHelper
3
3
  def form_icon(carrier_type)
4
- image_tag(carrier_type_path(carrier_type, format: :download), size: '16x16', class: 'enju_icon', alt: carrier_type.display_name.localize)
4
+ image_tag(carrier_type_path(carrier_type, format: :download), size: '16x16', class: 'enju_icon', alt: carrier_type.display_name)
5
5
  rescue NoMethodError
6
6
  image_tag('icons/help.png', size: '16x16', class: 'enju_icon', alt: t('page.unknown'))
7
7
  end
@@ -9,13 +9,13 @@ module EnjuBiblio
9
9
  def content_type_icon(content_type)
10
10
  case content_type.name
11
11
  when 'text'
12
- image_tag('icons/page_white_text.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name.localize)
12
+ image_tag('icons/page_white_text.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name)
13
13
  when 'still_image'
14
- image_tag('icons/picture.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name.localize)
14
+ image_tag('icons/picture.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name)
15
15
  when 'sounds'
16
- image_tag('icons/sound.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name.localize)
16
+ image_tag('icons/sound.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name)
17
17
  when 'two_dimensional_moving_image'
18
- image_tag('icons/film.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name.localize)
18
+ image_tag('icons/film.png', size: '16x16', class: 'enju_icon', alt: content_type.display_name)
19
19
  else
20
20
  image_tag('icons/help.png', size: '16x16', class: 'enju_icon', alt: t('page.unknown'))
21
21
  end
@@ -2,7 +2,7 @@ module ManifestationsHelper
2
2
  include EnjuCirculation::ManifestationsHelper if defined?(EnjuCirculation)
3
3
 
4
4
  def resource_title(manifestation, action)
5
- string = LibraryGroup.site_config.display_name.localize.dup
5
+ string = LibraryGroup.site_config.display_name.dup
6
6
  unless action == ('index' or 'new')
7
7
  if manifestation.try(:original_title)
8
8
  string << ' - ' + manifestation.original_title.to_s
@@ -40,7 +40,7 @@ module ManifestationsHelper
40
40
  def language_list(languages)
41
41
  list = []
42
42
  languages.each do |language|
43
- list << language.display_name.localize if language.name != 'unknown'
43
+ list << language.display_name if language.name != 'unknown'
44
44
  end
45
45
  list.join("; ")
46
46
  end
@@ -71,41 +71,41 @@ module ManifestationsHelper
71
71
  current = true if languages.include?(language.name)
72
72
  if current
73
73
  content_tag :strong do
74
- link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, language: language.name, view: nil, only_path: true)))
74
+ link_to("#{language.display_name} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, language: language.name, view: nil, only_path: true)))
75
75
  end
76
76
  else
77
- link_to("#{language.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, language: language.name, view: nil, only_path: true)))
77
+ link_to("#{language.display_name} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, language: language.name, view: nil, only_path: true)))
78
78
  end
79
79
  end
80
80
 
81
81
  def library_facet(current_libraries, facet)
82
- library = Library.where(name: facet.value).select([:name, :display_name]).first
82
+ library = Library.where(name: facet.value).select([:name, :display_name_translations]).first
83
83
  return nil unless library
84
84
  string = ''
85
85
  current = true if current_libraries.include?(library.name)
86
86
  content_tag :li do
87
87
  if current
88
88
  content_tag :strong do
89
- link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, library: (current_libraries << library.name).uniq.join(' '), view: nil, only_path: true)))
89
+ link_to("#{library.display_name} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, library: (current_libraries << library.name).uniq.join(' '), view: nil, only_path: true)))
90
90
  end
91
91
  else
92
- link_to("#{library.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(page: nil, library: (current_libraries << library.name).uniq.join(' '), view: nil, only_path: true)))
92
+ link_to("#{library.display_name} (" + facet.count.to_s + ")", url_for(filtered_params.merge(page: nil, library: (current_libraries << library.name).uniq.join(' '), view: nil, only_path: true)))
93
93
  end
94
94
  end
95
95
  end
96
96
 
97
97
  def carrier_type_facet(facet)
98
98
  string = ''
99
- carrier_type = CarrierType.where(name: facet.value).select([:id, :name, :display_name]).first
99
+ carrier_type = CarrierType.where(name: facet.value).select([:id, :name, :display_name_translations]).first
100
100
  if carrier_type
101
101
  string << form_icon(carrier_type)
102
102
  current = true if params[:carrier_type] == carrier_type.name
103
103
  if current
104
104
  content_tag :strong do
105
- link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
105
+ link_to("#{carrier_type.display_name} (" + facet.count.to_s + ")", url_for(filtered_params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
106
106
  end
107
107
  else
108
- link_to("#{carrier_type.display_name.localize} (" + facet.count.to_s + ")", url_for(request.params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
108
+ link_to("#{carrier_type.display_name} (" + facet.count.to_s + ")", url_for(filtered_params.merge(carrier_type: carrier_type.name, page: nil, view: nil, only_path: true)))
109
109
  end
110
110
  end
111
111
  end
@@ -115,10 +115,10 @@ module ManifestationsHelper
115
115
  current = true if facet.value.first.to_i == pub_date_from.to_i and facet.value.last.to_i - 1 == pub_date_until.to_i
116
116
  if current
117
117
  content_tag :strong do
118
- link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(request.params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
118
+ link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(filtered_params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
119
119
  end
120
120
  else
121
- link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(request.params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
121
+ link_to("#{facet.value.first.to_i} - #{facet.value.last.to_i - 1} (" + facet.count.to_s + ")", url_for(filtered_params.merge(pub_date_from: facet.value.first.to_i, pub_date_until: facet.value.last.to_i - 1, page: nil, view: nil, only_path: true)))
122
122
  end
123
123
  end
124
124
 
data/app/models/agent.rb CHANGED
@@ -17,7 +17,7 @@ class Agent < ApplicationRecord
17
17
  has_many :derived_agents, through: :children, source: :child
18
18
  has_many :original_agents, through: :parents, source: :parent
19
19
  has_many :picture_files, as: :picture_attachable, dependent: :destroy
20
- has_many :donates, dependent: :destroy
20
+ has_many :donates
21
21
  has_many :donated_items, through: :donates, source: :item
22
22
  has_many :owns, dependent: :destroy
23
23
  has_many :items, through: :owns
@@ -97,7 +97,7 @@ class Agent < ApplicationRecord
97
97
  def set_date_of_birth
98
98
  return if birth_date.blank?
99
99
  begin
100
- date = Time.zone.parse(birth_date.to_s)
100
+ date = Time.zone.parse("#{birth_date}")
101
101
  rescue ArgumentError
102
102
  begin
103
103
  date = Time.zone.parse("#{birth_date}-01")
@@ -115,7 +115,7 @@ class Agent < ApplicationRecord
115
115
  def set_date_of_death
116
116
  return if death_date.blank?
117
117
  begin
118
- date = Time.zone.parse(death_date.to_s)
118
+ date = Time.zone.parse("#{death_date}")
119
119
  rescue ArgumentError
120
120
  begin
121
121
  date = Time.zone.parse("#{death_date}-01")
@@ -256,26 +256,17 @@ class Agent < ApplicationRecord
256
256
  Agent.transaction do
257
257
  agents_params.each do |k, v|
258
258
  next if v['_destroy'] == '1'
259
-
260
- agent = nil
261
-
262
259
  if v['agent_id'].present?
263
260
  agent = Agent.find(v['agent_id'])
264
261
  elsif v['id'].present?
265
262
  agent = Agent.find(v['id'])
266
- end
267
-
268
- if !agent or agent.full_name != v['full_name']
269
- v.delete('id')
270
- v.delete('agent_id')
263
+ else
271
264
  v.delete('_destroy')
272
265
  agent = Agent.create(v)
273
266
  end
274
-
275
267
  agents << agent
276
268
  end
277
269
  end
278
-
279
270
  agents
280
271
  end
281
272
  end
@@ -151,7 +151,7 @@ class AgentImportFile < ApplicationRecord
151
151
  rows.each do |row|
152
152
  row_num += 1
153
153
  next if row['dummy'].to_s.strip.present?
154
- agent = Agent.find_by(id: row['id'].to_s.strip)
154
+ agent = Agent.where(id: row['id'].to_s.strip).first
155
155
  if agent
156
156
  agent.picture_files.destroy_all
157
157
  agent.reload
@@ -8,11 +8,12 @@ end
8
8
  #
9
9
  # Table name: agent_relationship_types
10
10
  #
11
- # id :integer not null, primary key
12
- # name :string not null
13
- # display_name :text
14
- # note :text
15
- # position :integer
16
- # created_at :datetime
17
- # updated_at :datetime
11
+ # id :integer not null, primary key
12
+ # name :string not null
13
+ # display_name :text
14
+ # note :text
15
+ # position :integer
16
+ # created_at :datetime
17
+ # updated_at :datetime
18
+ # display_name_translations :jsonb not null
18
19
  #
@@ -1,5 +1,7 @@
1
1
  class AgentType < ApplicationRecord
2
2
  include MasterModel
3
+ default_scope { order('agent_types.position') }
4
+ translates :display_name
3
5
  has_many :agents
4
6
  end
5
7
 
@@ -7,11 +9,12 @@ end
7
9
  #
8
10
  # Table name: agent_types
9
11
  #
10
- # id :integer not null, primary key
11
- # name :string not null
12
- # display_name :text
13
- # note :text
14
- # position :integer
15
- # created_at :datetime
16
- # updated_at :datetime
12
+ # id :integer not null, primary key
13
+ # name :string not null
14
+ # display_name :text
15
+ # note :text
16
+ # position :integer
17
+ # created_at :datetime
18
+ # updated_at :datetime
19
+ # display_name_translations :jsonb not null
17
20
  #