enju_biblio 0.3.10 → 0.4.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/app/controllers/content_types_controller.rb +1 -1
- data/app/controllers/items_controller.rb +2 -5
- data/app/controllers/manifestations_controller.rb +20 -23
- data/app/controllers/resource_import_results_controller.rb +2 -6
- data/app/helpers/enju_biblio/application_helper.rb +5 -5
- data/app/helpers/manifestations_helper.rb +10 -10
- data/app/models/agent.rb +3 -3
- data/app/models/agent_import_file.rb +1 -1
- data/app/models/agent_relationship_type.rb +8 -7
- data/app/models/agent_type.rb +10 -7
- data/app/models/carrier_type.rb +14 -11
- data/app/models/content_type.rb +10 -7
- data/app/models/create_type.rb +8 -7
- data/app/models/doi_record.rb +36 -0
- data/app/models/form_of_work.rb +11 -8
- data/app/models/frequency.rb +10 -7
- data/app/models/identifier_type.rb +1 -0
- data/app/models/import_request.rb +0 -2
- data/app/models/isbn_record.rb +51 -0
- data/app/models/isbn_record_and_manifestation.rb +18 -0
- data/app/models/issn_record.rb +49 -0
- data/app/models/issn_record_and_manifestation.rb +18 -0
- data/app/models/item.rb +2 -50
- data/app/models/language.rb +10 -9
- data/app/models/license.rb +9 -7
- data/app/models/manifestation.rb +252 -148
- data/app/models/manifestation_relationship_type.rb +9 -7
- data/app/models/medium_of_performance.rb +11 -8
- data/app/models/periodical.rb +33 -0
- data/app/models/periodical_and_manifestation.rb +16 -0
- data/app/models/picture_file.rb +2 -0
- data/app/models/produce_type.rb +8 -7
- data/app/models/realize_type.rb +8 -7
- data/app/models/resource_export_file.rb +8 -6
- data/app/models/resource_export_file_state_machine.rb +1 -1
- data/app/models/resource_import_file.rb +62 -153
- data/app/views/agent_import_results/index.txt.erb +3 -0
- data/app/views/agent_relationship_types/index.html.erb +1 -1
- data/app/views/agent_relationship_types/show.html.erb +1 -1
- data/app/views/agent_relationships/_form.html.erb +1 -1
- data/app/views/agent_types/index.html.erb +1 -1
- data/app/views/agent_types/show.html.erb +1 -1
- data/app/views/agents/_agent.html.erb +1 -1
- data/app/views/agents/_agent_list.html.erb +2 -2
- data/app/views/agents/_form.html.erb +4 -4
- data/app/views/agents/_index_agent.html.erb +1 -1
- data/app/views/agents/_index_agent_merge_list.html.erb +1 -1
- data/app/views/agents/_index_expression.html.erb +2 -2
- data/app/views/agents/_index_manifestation.html.erb +2 -2
- data/app/views/agents/_index_work.html.erb +2 -2
- data/app/views/agents/index.atom.builder +1 -1
- data/app/views/agents/index.rss.builder +1 -1
- data/app/views/agents/show.html+phone.erb +2 -2
- data/app/views/agents/show.html.erb +2 -2
- data/app/views/carrier_types/index.html.erb +2 -2
- data/app/views/carrier_types/show.html.erb +3 -3
- data/app/views/content_types/index.html.erb +1 -1
- data/app/views/content_types/show.html.erb +1 -1
- data/app/views/countries/index.html.erb +1 -1
- data/app/views/countries/show.html.erb +1 -1
- data/app/views/create_types/index.html.erb +1 -1
- data/app/views/create_types/show.html.erb +1 -1
- data/app/views/creates/_form.html.erb +1 -1
- data/app/views/form_of_works/index.html.erb +1 -1
- data/app/views/form_of_works/show.html.erb +1 -1
- data/app/views/frequencies/index.html.erb +1 -1
- data/app/views/frequencies/show.html.erb +1 -1
- data/app/views/identifier_types/index.html.erb +1 -1
- data/app/views/identifier_types/show.html.erb +1 -1
- data/app/views/items/_form.html.erb +13 -33
- data/app/views/items/index.html+phone.erb +3 -3
- data/app/views/items/index.html.erb +3 -3
- data/app/views/items/show.html+phone.erb +5 -5
- data/app/views/items/show.html.erb +12 -27
- data/app/views/languages/index.html.erb +1 -1
- data/app/views/languages/show.html.erb +1 -1
- data/app/views/layouts/agents.html.erb +2 -2
- data/app/views/layouts/items.html.erb +1 -1
- data/app/views/layouts/manifestations.html.erb +4 -4
- data/app/views/licenses/index.html.erb +1 -1
- data/app/views/licenses/show.html.erb +1 -1
- data/app/views/manifestation_relationship_types/index.html.erb +1 -1
- data/app/views/manifestation_relationship_types/show.html.erb +1 -1
- data/app/views/manifestation_relationships/_form.html.erb +1 -1
- data/app/views/manifestations/_call_number.html.erb +3 -3
- data/app/views/manifestations/_export_detail.html.erb +0 -1
- data/app/views/manifestations/_export_list.html.erb +0 -1
- data/app/views/manifestations/_form.html.erb +5 -28
- data/app/views/manifestations/_identifier_fields.html.erb +1 -1
- data/app/views/manifestations/_manifestation.txt.erb +1 -1
- data/app/views/manifestations/_show_creators.html.erb +1 -1
- data/app/views/manifestations/_show_detail_librarian.html.erb +5 -25
- data/app/views/manifestations/_show_detail_user.html.erb +5 -13
- data/app/views/manifestations/_show_holding.html+phone.erb +3 -3
- data/app/views/manifestations/_show_holding.html.erb +2 -2
- data/app/views/manifestations/index.atom.builder +1 -1
- data/app/views/manifestations/index.opds.builder +1 -1
- data/app/views/manifestations/index.rdf.builder +1 -1
- data/app/views/manifestations/index.rss.builder +1 -1
- data/app/views/manifestations/index.txt.erb +1 -0
- data/app/views/manifestations/show.txt.erb +1 -0
- data/app/views/medium_of_performances/index.html.erb +1 -1
- data/app/views/medium_of_performances/show.html.erb +1 -1
- data/app/views/notifier/manifestation_info.en.text.erb +1 -1
- data/app/views/notifier/manifestation_info.ja.text.erb +1 -1
- data/app/views/picture_files/edit.html.erb +0 -4
- data/app/views/produce_types/index.html.erb +1 -1
- data/app/views/produce_types/show.html.erb +1 -1
- data/app/views/produces/_form.html.erb +1 -1
- data/app/views/realize_types/index.html.erb +1 -1
- data/app/views/realize_types/show.html.erb +1 -1
- data/app/views/realizes/_form.html.erb +1 -1
- data/app/views/resource_import_files/_results.html.erb +0 -6
- data/app/views/resource_import_files/new.html.erb +2 -2
- data/app/views/resource_import_results/index.html.erb +11 -0
- data/app/views/resource_import_results/index.txt.erb +3 -0
- data/app/views/series_statements/_form.html.erb +8 -6
- data/app/views/series_statements/show.html.erb +0 -12
- data/config/locales/translation_en.yml +1 -28
- data/config/locales/translation_ja.yml +3 -30
- data/config/routes.rb +0 -2
- data/db/migrate/20081027150907_create_picture_files.rb +2 -0
- data/db/migrate/20160319144230_create_issn_records.rb +11 -0
- data/db/migrate/20160506144040_create_isbn_records.rb +11 -0
- data/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
- data/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
- data/db/migrate/20190102034126_create_doi_records.rb +13 -0
- data/db/migrate/20190311154610_create_periodicals.rb +10 -0
- data/db/migrate/20190312033839_create_periodical_and_manifestations.rb +11 -0
- data/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
- data/lib/enju_biblio/version.rb +1 -1
- data/lib/generators/enju_biblio/setup/setup_generator.rb +0 -2
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/agent_relationship_types.yml +3 -3
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/agent_types.yml +2 -4
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/carrier_types.yml +8 -26
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/content_types.yml +12 -24
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/create_types.yml +4 -22
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/form_of_works.yml +1 -1
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/frequencies.yml +9 -18
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/languages.yml +2 -4
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/licenses.yml +2 -2
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/manifestation_relationship_types.yml +2 -4
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/medium_of_performances.yml +15 -0
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/produce_types.yml +2 -19
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/realize_types.yml +3 -21
- 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
- data/spec/controllers/content_types_controller_spec.rb +1 -1
- data/spec/controllers/items_controller_spec.rb +1 -23
- data/spec/controllers/manifestations_controller_spec.rb +0 -49
- data/spec/dummy/app/helpers/application_helper.rb +1 -1
- data/spec/dummy/app/models/user.rb +4 -0
- data/spec/dummy/bin/bundle +1 -1
- data/spec/dummy/bin/setup +1 -3
- data/spec/dummy/bin/update +4 -2
- data/spec/dummy/bin/yarn +3 -3
- data/spec/dummy/config/application.rb +1 -2
- data/spec/dummy/config/database.yml +70 -9
- data/spec/dummy/config/initializers/assets.rb +2 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/migrate/002_devise_create_users.rb +1 -0
- data/spec/dummy/db/migrate/113_create_events.rb +2 -4
- data/spec/dummy/db/migrate/154_create_messages.rb +4 -8
- data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +3 -3
- data/spec/dummy/db/migrate/20081028093607_create_event_import_files.rb +2 -4
- data/spec/dummy/db/migrate/20090519203307_create_participates.rb +2 -4
- data/spec/dummy/db/migrate/20100925074639_create_event_import_results.rb +2 -2
- data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +1 -0
- data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140523171309_create_event_import_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140524135607_create_bookmark_stat_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140720192418_add_default_library_id_to_event_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20140812152348_create_event_export_files.rb +1 -1
- data/spec/dummy/db/migrate/20140812153137_create_event_export_file_transitions.rb +1 -1
- data/spec/dummy/db/migrate/20140814070854_add_default_event_category_id_to_event_import_file.rb +1 -1
- data/spec/dummy/db/migrate/20151128142913_create_places.rb +14 -0
- data/spec/dummy/db/migrate/20151201163718_add_place_id_to_event.rb +5 -0
- data/spec/dummy/db/migrate/20160703184258_add_most_recent_to_event_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160703184311_add_most_recent_to_event_export_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160813191533_add_book_jacket_source_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160813191820_add_screenshot_generator_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20160815045420_add_most_recent_to_bookmark_stat_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20170116150432_create_jpno_records.rb +10 -0
- data/spec/dummy/db/migrate/20171126072934_create_ndla_records.rb +10 -0
- data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107164558_add_constraints_to_most_recent_for_event_import_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107164617_add_constraints_to_most_recent_for_event_export_file_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107172413_add_constraints_to_most_recent_for_bookmark_stat_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180709023035_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +36 -0
- data/spec/dummy/db/migrate/20180709023036_add_missing_unique_indices.acts_as_taggable_on_engine.rb +26 -0
- data/spec/dummy/db/migrate/20180709023037_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +20 -0
- data/spec/dummy/db/migrate/20180709023038_add_missing_taggable_index.acts_as_taggable_on_engine.rb +15 -0
- data/spec/dummy/db/migrate/20180709023039_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +15 -0
- data/spec/dummy/db/migrate/20180709023040_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
- data/spec/dummy/db/migrate/20180709161346_add_created_at_to_tag.rb +6 -0
- data/spec/dummy/db/migrate/20181119170645_add_foreign_key_to_events_referencing_event_categories.rb +5 -0
- data/spec/dummy/db/migrate/20190501043418_create_ndl_bib_id_records.rb +10 -0
- data/spec/dummy/db/migrate/20190508160525_create_retains.rb +10 -0
- data/spec/dummy/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
- data/spec/dummy/db/migrate/20190630115523_add_login_banner_translations_to_library_group.rb +6 -0
- data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
- data/spec/dummy/db/migrate/20190630153136_add_display_name_translations_to_event.rb +6 -0
- data/spec/dummy/db/migrate/20190706052525_add_display_name_translations_to_circulation_status.rb +5 -0
- data/spec/dummy/db/schema.rb +335 -221
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/create_types.rb +8 -7
- data/spec/factories/produce_types.rb +8 -7
- data/spec/factories/realize_types.rb +8 -7
- data/spec/factories/series_statement.rb +3 -4
- data/spec/fixtures/agent_relationship_types.yml +8 -7
- data/spec/fixtures/agent_types.yml +11 -10
- data/spec/fixtures/carrier_types.yml +16 -15
- data/spec/fixtures/content_types.yml +20 -31
- data/spec/fixtures/create_types.yml +12 -15
- data/spec/fixtures/creates.yml +0 -2
- data/spec/fixtures/form_of_works.yml +11 -10
- data/spec/fixtures/frequencies.yml +17 -25
- data/spec/fixtures/items.yml +11 -12
- data/spec/fixtures/languages.yml +11 -11
- data/spec/fixtures/libraries.yml +30 -30
- data/spec/fixtures/library_groups.yml +11 -6
- data/spec/fixtures/licenses.yml +8 -7
- data/spec/fixtures/manifestation_relationship_types.yml +12 -11
- data/spec/fixtures/manifestations.yml +0 -1
- data/spec/fixtures/medium_of_performances.yml +10 -9
- data/spec/fixtures/picture_files.yml +2 -0
- data/spec/fixtures/produce_types.yml +10 -11
- data/spec/fixtures/produces.yml +0 -2
- data/spec/fixtures/profiles.yml +8 -5
- data/spec/fixtures/realize_types.yml +11 -13
- data/spec/fixtures/realizes.yml +0 -2
- data/spec/fixtures/request_status_types.yml +14 -14
- data/spec/fixtures/request_types.yml +13 -13
- data/spec/fixtures/resource_export_files.yml +1 -1
- data/spec/fixtures/resource_import_results.yml +2 -2
- data/spec/fixtures/roles.yml +22 -5
- data/spec/fixtures/shelves.yml +16 -16
- data/spec/fixtures/user_groups.yml +12 -12
- data/spec/fixtures/user_has_roles.yml +3 -4
- data/spec/fixtures/users.yml +0 -3
- data/spec/models/agent_relationship_type_spec.rb +8 -7
- data/spec/models/agent_type_spec.rb +8 -7
- data/spec/models/carrier_type_spec.rb +12 -11
- data/spec/models/content_type_spec.rb +8 -7
- data/spec/models/create_type_spec.rb +8 -7
- data/spec/models/doi_record_spec.rb +19 -0
- data/spec/models/form_of_work_spec.rb +8 -7
- data/spec/models/frequency_spec.rb +8 -7
- data/spec/models/item_spec.rb +0 -7
- data/spec/models/language_spec.rb +10 -9
- data/spec/models/license_spec.rb +8 -7
- data/spec/models/manifestation_relationship_type_spec.rb +8 -7
- data/spec/models/manifestation_spec.rb +16 -24
- data/spec/models/medium_of_performance_spec.rb +8 -7
- data/spec/models/periodical_and_manifestation_spec.rb +17 -0
- data/spec/models/periodical_spec.rb +16 -0
- data/spec/models/picture_file_spec.rb +2 -0
- data/spec/models/produce_type_spec.rb +8 -7
- data/spec/models/realize_type_spec.rb +8 -7
- data/spec/models/resource_export_file_spec.rb +9 -62
- data/spec/models/resource_import_file_spec.rb +14 -44
- data/spec/rails_helper.rb +8 -4
- data/spec/system/manifestations_spec.rb +0 -30
- data/spec/views/items/index.html.erb_spec.rb +6 -7
- data/spec/views/manifestations/{index.txt.ruby_spec.rb → index.txt.erb_spec.rb} +1 -1
- data/spec/views/manifestations/{show.txt.ruby_spec.rb → show.txt.erb_spec.rb} +2 -2
- data/spec/views/resource_import_results/show.html.erb_spec.rb +1 -1
- metadata +129 -285
- data/app/controllers/item_custom_properties_controller.rb +0 -69
- data/app/controllers/manifestation_custom_properties_controller.rb +0 -69
- data/app/models/item_custom_property.rb +0 -18
- data/app/models/item_custom_value.rb +0 -17
- data/app/models/manifestation_custom_property.rb +0 -18
- data/app/models/manifestation_custom_value.rb +0 -17
- data/app/policies/item_custom_property_policy.rb +0 -21
- data/app/policies/manifestation_custom_property_policy.rb +0 -21
- data/app/views/agent_import_results/index.txt.ruby +0 -5
- data/app/views/item_custom_properties/_form.html.erb +0 -32
- data/app/views/item_custom_properties/edit.html.erb +0 -13
- data/app/views/item_custom_properties/index.html.erb +0 -43
- data/app/views/item_custom_properties/new.html.erb +0 -12
- data/app/views/item_custom_properties/show.html.erb +0 -28
- data/app/views/manifestation_custom_properties/_form.html.erb +0 -32
- data/app/views/manifestation_custom_properties/edit.html.erb +0 -13
- data/app/views/manifestation_custom_properties/index.html.erb +0 -43
- data/app/views/manifestation_custom_properties/new.html.erb +0 -12
- data/app/views/manifestation_custom_properties/show.html.erb +0 -28
- data/app/views/manifestations/index.txt.ruby +0 -7
- data/app/views/manifestations/show.json.jbuilder +0 -2
- data/app/views/manifestations/show.txt.ruby +0 -5
- data/app/views/resource_import_results/index.txt.ruby +0 -5
- data/db/migrate/20190818075603_add_memo_to_manifestation.rb +0 -5
- data/db/migrate/20190818075628_add_memo_to_item.rb +0 -5
- data/db/migrate/20200425072340_create_manifestation_custom_properties.rb +0 -12
- data/db/migrate/20200425072349_create_item_custom_properties.rb +0 -12
- data/db/migrate/20200425074758_create_manifestation_custom_values.rb +0 -12
- data/db/migrate/20200425074822_create_item_custom_values.rb +0 -12
- data/lib/generators/enju_biblio/setup/templates/db/fixtures/agents.yml +0 -19
- data/spec/cassette_library/ResourceImportFile/when_its_mode_is_create_/when_it_is_written_in_utf-8/should_import_custom_values.yml +0 -121
- data/spec/cassette_library/resource_import_results/index_txt_ruby/renders_a_list_of_resource_import_results.yml +0 -121
- data/spec/controllers/item_custom_properties_controller_spec.rb +0 -449
- data/spec/controllers/manifestation_custom_properties_controller_spec.rb +0 -449
- data/spec/dummy/db/migrate/20081117143156_create_inventory_files.rb +0 -18
- data/spec/dummy/db/migrate/20081117143455_create_inventories.rb +0 -17
- data/spec/dummy/db/migrate/20090706125521_add_attachments_inventory_to_inventory_file.rb +0 -15
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +0 -18
- data/spec/dummy/db/migrate/20100525171356_acts_as_taggable_on_migration.rb +0 -30
- data/spec/dummy/db/migrate/20111217234412_add_save_checkout_history_to_user.rb +0 -5
- data/spec/dummy/db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb +0 -6
- data/spec/dummy/db/migrate/20120413100431_add_fingerprint_to_inventory_file.rb +0 -5
- data/spec/dummy/db/migrate/20150421023923_create_identities.rb +0 -14
- data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +0 -5
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -18
- data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +0 -22
- data/spec/factories/item_custom_property.rb +0 -6
- data/spec/factories/item_custom_value.rb +0 -6
- data/spec/factories/manifestation_custom_property.rb +0 -6
- data/spec/factories/manifestation_custom_value.rb +0 -6
- data/spec/fixtures/carrier_type_has_checkout_types.yml +0 -31
- data/spec/fixtures/checkout_stat_has_manifestations.yml +0 -24
- data/spec/fixtures/checkout_stat_has_users.yml +0 -24
- data/spec/fixtures/checkout_types.yml +0 -34
- data/spec/fixtures/circulation_statuses.yml +0 -136
- data/spec/fixtures/inventory_files.yml +0 -40
- data/spec/fixtures/item_custom_properties.yml +0 -24
- data/spec/fixtures/manifestation_checkout_stats.yml +0 -29
- data/spec/fixtures/manifestation_custom_properties.yml +0 -24
- data/spec/fixtures/manifestation_reserve_stats.yml +0 -29
- data/spec/fixtures/reserve_stat_has_manifestations.yml +0 -24
- data/spec/fixtures/reserve_stat_has_users.yml +0 -24
- data/spec/fixtures/reserve_transitions.yml +0 -104
- data/spec/fixtures/reserves.yml +0 -143
- data/spec/fixtures/use_restrictions.yml +0 -93
- data/spec/fixtures/user_checkout_stats.yml +0 -28
- data/spec/fixtures/user_group_has_checkout_types.yml +0 -111
- data/spec/fixtures/user_reserve_stats.yml +0 -28
- data/spec/models/item_custom_property_spec.rb +0 -18
- data/spec/models/item_custom_value_spec.rb +0 -17
- data/spec/models/manifestation_custom_property_spec.rb +0 -18
- data/spec/models/manifestation_custom_value_spec.rb +0 -17
- data/spec/requests/item_custom_properties_spec.rb +0 -129
- data/spec/requests/manifestation_custom_properties_spec.rb +0 -129
- data/spec/routing/item_custom_properties_routing_spec.rb +0 -38
- data/spec/routing/manifestation_custom_properties_routing_spec.rb +0 -38
- data/spec/system/items_spec.rb +0 -115
- data/spec/system/series_statements_spec.rb +0 -16
- data/spec/views/agent_import_results/index.html.erb_spec.rb +0 -29
- data/spec/views/agent_import_results/index.txt.ruby_spec.rb +0 -20
- data/spec/views/agent_import_results/show.html.erb_spec.rb +0 -24
- data/spec/views/item_custom_properties/edit.html.erb_spec.rb +0 -21
- data/spec/views/item_custom_properties/index.html.erb_spec.rb +0 -25
- data/spec/views/item_custom_properties/new.html.erb_spec.rb +0 -21
- data/spec/views/item_custom_properties/show.html.erb_spec.rb +0 -16
- data/spec/views/manifestation_custom_properties/edit.html.erb_spec.rb +0 -21
- data/spec/views/manifestation_custom_properties/index.html.erb_spec.rb +0 -25
- data/spec/views/manifestation_custom_properties/new.html.erb_spec.rb +0 -21
- data/spec/views/manifestation_custom_properties/show.html.erb_spec.rb +0 -16
- data/spec/views/manifestations/show.json.jbuilder_spec.rb +0 -16
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25f3dd27c99737a4cfbba700c0963f4352b7e237bf30bdea0bf9c446208906be
|
4
|
+
data.tar.gz: 544ee9521de65fb2cc918332e4c15ca88a89b346a021f7ca9a0bdabdb66841d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 139f55a88e3958bfe75f687fac126219a964d15485bde0e66e264f54244cd550c4b44d284130582026090267de93693fbdcbaf2cf117166e34c0b2c62ccddc54
|
7
|
+
data.tar.gz: 895a8713dea2a69800fd2aa0edf8842ef20f9c9ebae86c92aff7d6c014fb5f5f90f1e689471f13918ed671f304f09fa933027bf7752bcac765aed7c3b209f28c
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# EnjuBiblio
|
2
|
-
[![
|
3
|
-
[![Coverage Status](https://coveralls.io/repos/github/next-l/enju_biblio/badge.svg?branch=
|
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
|
|
@@ -272,11 +272,8 @@ class ItemsController < ApplicationController
|
|
272
272
|
:acquired_at, :bookstore_id, :missing_since, :budget_type_id,
|
273
273
|
:lock_version, :manifestation_id, :library_id, :required_role_id,
|
274
274
|
:binding_item_identifier, :binding_call_number, :binded_at,
|
275
|
-
:use_restriction_id,
|
276
|
-
|
277
|
-
{item_custom_values_attributes: [
|
278
|
-
:id, :item_custom_property_id, :item_id, :value,:_destroy
|
279
|
-
]}
|
275
|
+
:use_restriction_id,
|
276
|
+
item_has_use_restriction_attributes: :use_restriction_id # EnjuCirculation
|
280
277
|
)
|
281
278
|
end
|
282
279
|
|
@@ -332,7 +332,7 @@ class ManifestationsController < ApplicationController
|
|
332
332
|
}
|
333
333
|
format.rdf
|
334
334
|
format.mods
|
335
|
-
format.json
|
335
|
+
format.json { render json: @manifestation }
|
336
336
|
format.txt
|
337
337
|
format.js
|
338
338
|
format.download {
|
@@ -355,8 +355,8 @@ class ManifestationsController < ApplicationController
|
|
355
355
|
# GET /manifestations/new.json
|
356
356
|
def new
|
357
357
|
@manifestation = Manifestation.new
|
358
|
-
@manifestation.language = Language.
|
359
|
-
@parent = Manifestation.
|
358
|
+
@manifestation.language = Language.where(iso_639_1: @locale).first
|
359
|
+
@parent = Manifestation.where(id: params[:parent_id]).first if params[:parent_id].present?
|
360
360
|
if @parent
|
361
361
|
@manifestation.parent_id = @parent.id
|
362
362
|
[ :original_title, :title_transcription,
|
@@ -429,17 +429,15 @@ class ManifestationsController < ApplicationController
|
|
429
429
|
# PUT /manifestations/1.json
|
430
430
|
def update
|
431
431
|
creators_params = manifestation_params[:creators_attributes]
|
432
|
-
|
433
|
-
k
|
434
|
-
|
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
|
435
438
|
|
436
439
|
respond_to do |format|
|
437
440
|
if @manifestation.valid?
|
438
|
-
Manifestation.transaction do
|
439
|
-
@manifestation.creators = Agent.new_agents(creators_params)
|
440
|
-
@manifestation.save!
|
441
|
-
end
|
442
|
-
|
443
441
|
format.html { redirect_to @manifestation, notice: t('controller.successfully_updated', model: t('activerecord.models.manifestation')) }
|
444
442
|
format.json { head :no_content }
|
445
443
|
else
|
@@ -491,7 +489,7 @@ class ManifestationsController < ApplicationController
|
|
491
489
|
:valid_until, :date_submitted, :date_accepted, :date_captured,
|
492
490
|
:ndl_bib_id, :pub_date, :edition_string, :volume_number, :issue_number,
|
493
491
|
:serial_number, :content_type_id, :attachment, :lock_version,
|
494
|
-
:dimensions, :fulltext_content, :extent,
|
492
|
+
:dimensions, :fulltext_content, :extent,
|
495
493
|
:parent_id,
|
496
494
|
:serial, :statement_of_responsibility,
|
497
495
|
{creators_attributes: [
|
@@ -549,9 +547,6 @@ class ManifestationsController < ApplicationController
|
|
549
547
|
{identifiers_attributes: [
|
550
548
|
:id, :body, :identifier_type_id,
|
551
549
|
:_destroy
|
552
|
-
]},
|
553
|
-
{manifestation_custom_values_attributes: [
|
554
|
-
:id, :manifestation_custom_property_id, :manifestation_id, :value,:_destroy
|
555
550
|
]}
|
556
551
|
)
|
557
552
|
end
|
@@ -737,12 +732,12 @@ class ManifestationsController < ApplicationController
|
|
737
732
|
end
|
738
733
|
|
739
734
|
def prepare_options
|
740
|
-
@carrier_types = CarrierType.
|
741
|
-
@content_types = ContentType.
|
742
|
-
@roles = Role.select([:id, :
|
743
|
-
@languages = Language.
|
744
|
-
@frequencies = Frequency.
|
745
|
-
@identifier_types = IdentifierType.
|
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])
|
746
741
|
@nii_types = NiiType.select([:id, :display_name, :position]) if defined?(EnjuNii)
|
747
742
|
if defined?(EnjuSubject)
|
748
743
|
@subject_types = SubjectType.select([:id, :display_name, :position])
|
@@ -782,7 +777,7 @@ class ManifestationsController < ApplicationController
|
|
782
777
|
if options[:pub_date_from].blank?
|
783
778
|
pub_date[:from] = "*"
|
784
779
|
else
|
785
|
-
year = options[:pub_date_from].
|
780
|
+
year = options[:pub_date_from].rjust(4, "0")
|
786
781
|
if year.length == 4
|
787
782
|
pub_date[:from] = Time.zone.parse(Time.utc(year).to_s).beginning_of_year.utc.iso8601
|
788
783
|
else
|
@@ -796,7 +791,7 @@ class ManifestationsController < ApplicationController
|
|
796
791
|
if options[:pub_date_until].blank?
|
797
792
|
pub_date[:until] = "*"
|
798
793
|
else
|
799
|
-
year = options[:pub_date_until].
|
794
|
+
year = options[:pub_date_until].rjust(4, "0")
|
800
795
|
if year.length == 4
|
801
796
|
pub_date[:until] = Time.zone.parse(Time.utc(year).to_s).end_of_year.utc.iso8601
|
802
797
|
else
|
@@ -811,6 +806,8 @@ class ManifestationsController < ApplicationController
|
|
811
806
|
|
812
807
|
def set_pub_date(query, options)
|
813
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/, '')
|
814
811
|
pub_date = parse_pub_date(options)
|
815
812
|
query = "#{query} date_of_publication_d:[#{pub_date[:from]} TO #{pub_date[:until]}]"
|
816
813
|
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.
|
8
|
+
@resource_import_file = ResourceImportFile.where(id: params[:resource_import_file_id]).first
|
9
9
|
if @resource_import_file
|
10
|
-
|
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
|
@@ -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
|
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
|
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
|
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
|
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
|
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.
|
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
|
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
|
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
|
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, :
|
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
|
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
|
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, :
|
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
|
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
|
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
|
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
|
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
|
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
|
118
|
+
date = Time.zone.parse("#{death_date}")
|
119
119
|
rescue ArgumentError
|
120
120
|
begin
|
121
121
|
date = Time.zone.parse("#{death_date}-01")
|
@@ -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.
|
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
|
12
|
-
# name
|
13
|
-
# display_name
|
14
|
-
# note
|
15
|
-
# position
|
16
|
-
# created_at
|
17
|
-
# updated_at
|
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
|
#
|
data/app/models/agent_type.rb
CHANGED
@@ -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
|
11
|
-
# name
|
12
|
-
# display_name
|
13
|
-
# note
|
14
|
-
# position
|
15
|
-
# created_at
|
16
|
-
# updated_at
|
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
|
#
|
data/app/models/carrier_type.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class CarrierType < ApplicationRecord
|
2
2
|
include MasterModel
|
3
|
+
default_scope { order("carrier_types.position") }
|
4
|
+
translates :display_name
|
3
5
|
has_many :manifestations
|
4
6
|
if ENV['ENJU_STORAGE'] == 's3'
|
5
7
|
has_attached_file :attachment, storage: :s3,
|
@@ -34,15 +36,16 @@ end
|
|
34
36
|
#
|
35
37
|
# Table name: carrier_types
|
36
38
|
#
|
37
|
-
# id
|
38
|
-
# name
|
39
|
-
# display_name
|
40
|
-
# note
|
41
|
-
# position
|
42
|
-
# created_at
|
43
|
-
# updated_at
|
44
|
-
# attachment_file_name
|
45
|
-
# attachment_content_type
|
46
|
-
# attachment_file_size
|
47
|
-
# attachment_updated_at
|
39
|
+
# id :integer not null, primary key
|
40
|
+
# name :string not null
|
41
|
+
# display_name :text
|
42
|
+
# note :text
|
43
|
+
# position :integer
|
44
|
+
# created_at :datetime
|
45
|
+
# updated_at :datetime
|
46
|
+
# attachment_file_name :string
|
47
|
+
# attachment_content_type :string
|
48
|
+
# attachment_file_size :bigint
|
49
|
+
# attachment_updated_at :datetime
|
50
|
+
# display_name_translations :jsonb not null
|
48
51
|
#
|
data/app/models/content_type.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class ContentType < ApplicationRecord
|
2
2
|
include MasterModel
|
3
|
+
default_scope { order('content_types.position') }
|
4
|
+
translates :display_name
|
3
5
|
has_many :manifestations
|
4
6
|
end
|
5
7
|
|
@@ -7,11 +9,12 @@ end
|
|
7
9
|
#
|
8
10
|
# Table name: content_types
|
9
11
|
#
|
10
|
-
# id
|
11
|
-
# name
|
12
|
-
# display_name
|
13
|
-
# note
|
14
|
-
# position
|
15
|
-
# created_at
|
16
|
-
# updated_at
|
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
|
#
|
data/app/models/create_type.rb
CHANGED
@@ -7,11 +7,12 @@ end
|
|
7
7
|
#
|
8
8
|
# Table name: create_types
|
9
9
|
#
|
10
|
-
# id
|
11
|
-
# name
|
12
|
-
# display_name
|
13
|
-
# note
|
14
|
-
# position
|
15
|
-
# created_at
|
16
|
-
# updated_at
|
10
|
+
# id :integer not null, primary key
|
11
|
+
# name :string
|
12
|
+
# display_name :text
|
13
|
+
# note :text
|
14
|
+
# position :integer
|
15
|
+
# created_at :datetime
|
16
|
+
# updated_at :datetime
|
17
|
+
# display_name_translations :jsonb not null
|
17
18
|
#
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class DoiRecord < ApplicationRecord
|
2
|
+
belongs_to :manifestation
|
3
|
+
validates :body, presence: true, uniqueness: true, format: {with: /\A[0-9]{2}\.[0-9]{2,}\/.+\Z/}
|
4
|
+
before_save :normalize
|
5
|
+
before_save :set_display_body
|
6
|
+
|
7
|
+
strip_attributes
|
8
|
+
|
9
|
+
def normalize
|
10
|
+
url = URI.parse(body)
|
11
|
+
if url.host =~ /doi\.org\Z/
|
12
|
+
self.body = url.path.gsub(/\A\//, '').downcase
|
13
|
+
else
|
14
|
+
self.body = body.downcase
|
15
|
+
end
|
16
|
+
rescue URI::InvalidURIError
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_display_body
|
20
|
+
self.display_body = body unless display_body
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# == Schema Information
|
25
|
+
#
|
26
|
+
# Table name: doi_records
|
27
|
+
#
|
28
|
+
# id :bigint not null, primary key
|
29
|
+
# body :string not null
|
30
|
+
# display_body :string not null
|
31
|
+
# source :string
|
32
|
+
# response :jsonb not null
|
33
|
+
# manifestation_id :bigint not null
|
34
|
+
# created_at :datetime not null
|
35
|
+
# updated_at :datetime not null
|
36
|
+
#
|