hyrax 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.dassie/.env +5 -1
- data/.dassie/Gemfile +4 -2
- data/.dassie/app/assets/images/bulkrax/removed.png +0 -0
- data/.dassie/app/assets/javascripts/application.js +2 -0
- data/.dassie/app/assets/stylesheets/application.css +1 -0
- data/.dassie/app/controllers/catalog_controller.rb +1 -0
- data/.dassie/app/forms/admin_set_resource_form.rb +6 -0
- data/.dassie/app/forms/collection_resource_form.rb +5 -2
- data/.dassie/app/forms/generic_work_resource_form.rb +5 -2
- data/.dassie/app/forms/monograph_form.rb +5 -3
- data/.dassie/app/indexers/admin_set_resource_indexer.rb +5 -0
- data/.dassie/app/indexers/collection_resource_indexer.rb +3 -3
- data/.dassie/app/indexers/generic_work_resource_indexer.rb +6 -3
- data/.dassie/app/indexers/monograph_indexer.rb +6 -2
- data/.dassie/app/models/ability.rb +8 -0
- data/.dassie/app/models/collection_resource.rb +4 -2
- data/.dassie/app/models/concerns/bulkrax/has_local_processing.rb +8 -0
- data/.dassie/app/models/generic_work_resource.rb +5 -2
- data/.dassie/app/models/monograph.rb +5 -2
- data/.dassie/app/views/blacklight_dynamic_sitemap/sitemap/show.xml.builder +22 -0
- data/.dassie/bin/importer +142 -0
- data/.dassie/bin/web +4 -0
- data/.dassie/config/browse_everything_providers.yml +1 -1
- data/.dassie/config/bulkrax_api.yml +86 -0
- data/.dassie/config/initializers/bulkrax.rb +92 -0
- data/.dassie/config/initializers/clamav.rb +2 -0
- data/.dassie/config/initializers/hyrax.rb +7 -1
- data/.dassie/config/initializers/riiif.rb +4 -80
- data/.dassie/config/initializers/wings.rb +1 -1
- data/.dassie/config/metadata_profiles/m3_profile.yaml +929 -0
- data/.dassie/config/puma.rb +4 -2
- data/.dassie/config/routes.rb +7 -0
- data/.dassie/config/sidekiq.yml +17 -0
- data/.dassie/config/uv/uv.html +63 -81
- data/.dassie/db/migrate/20240606205215_create_hyrax_flexible_schemas.rb +9 -0
- data/.dassie/db/migrate/20240606205216_add_contexts_to_hyrax_flexible_schemas.rb +5 -0
- data/.dassie/db/migrate/20250826142438_create_bulkrax_importers.bulkrax.rb +19 -0
- data/.dassie/db/migrate/20250826142439_create_bulkrax_importer_runs.bulkrax.rb +17 -0
- data/.dassie/db/migrate/20250826142440_create_bulkrax_entries.bulkrax.rb +17 -0
- data/.dassie/db/migrate/20250826142441_add_status_to_entry.bulkrax.rb +10 -0
- data/.dassie/db/migrate/20250826142442_add_collections_to_importer_runs.bulkrax.rb +7 -0
- data/.dassie/db/migrate/20250826142443_change_collection_ids_on_entries.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142444_create_bulkrax_exporters.bulkrax.rb +20 -0
- data/.dassie/db/migrate/20250826142445_create_bulkrax_exporter_runs.bulkrax.rb +15 -0
- data/.dassie/db/migrate/20250826142446_change_importer_and_exporter_to_polymorphic.bulkrax.rb +19 -0
- data/.dassie/db/migrate/20250826142447_add_total_collection_records_to_importer_runs.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142448_add_children_to_importer_runs.bulkrax.rb +7 -0
- data/.dassie/db/migrate/20250826142449_change_total_records_to_total_work_entries.bulkrax.rb +7 -0
- data/.dassie/db/migrate/20250826142450_change_entry_last_error.bulkrax.rb +20 -0
- data/.dassie/db/migrate/20250826142451_add_validate_only_to_bulkrax_importers.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142452_add_status_to_importers.bulkrax.rb +10 -0
- data/.dassie/db/migrate/20250826142453_remove_foreign_key_from_bulkrax_entries.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142454_add_status_to_exporters.bulkrax.rb +8 -0
- data/.dassie/db/migrate/20250826142455_add_invalid_record_to_importer_run.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142456_create_bulkrax_statuses.bulkrax.rb +19 -0
- data/.dassie/db/migrate/20250826142457_move_to_statuses.bulkrax.rb +31 -0
- data/.dassie/db/migrate/20250826142458_add_date_filter_and_status_to_bulkrax_exporters.bulkrax.rb +8 -0
- data/.dassie/db/migrate/20250826142459_add_workflow_status_to_bulkrax_exporter.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142460_remove_unused_last_error.bulkrax.rb +8 -0
- data/.dassie/db/migrate/20250826142461_increase_text_sizes.bulkrax.rb +13 -0
- data/.dassie/db/migrate/20250826142462_change_bulkrax_statuses_error_message_column_type_to_text.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142463_rename_children_counters_to_relationships.bulkrax.rb +7 -0
- data/.dassie/db/migrate/20250826142464_add_file_set_counters_to_importer_runs.bulkrax.rb +8 -0
- data/.dassie/db/migrate/20250826142465_add_import_attempts_to_entries.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142466_add_work_counters_to_importer_runs.bulkrax.rb +7 -0
- data/.dassie/db/migrate/20250826142467_create_bulkrax_pending_relationships.bulkrax.rb +14 -0
- data/.dassie/db/migrate/20250826142468_add_order_to_bulkrax_pending_relationships.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142469_add_include_thumbnails_to_bulkrax_exporters.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142470_add_generated_metadata_to_bulkrax_exporters.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142471_rename_bulkrax_importer_run_to_importer_run.bulkrax.rb +18 -0
- data/.dassie/db/migrate/20250826142472_add_indices_to_bulkrax.bulkrax.rb +26 -0
- data/.dassie/db/migrate/20250826142473_denormalize_status_message.bulkrax.rb +8 -0
- data/.dassie/db/migrate/20250826142474_update_identifier_index.bulkrax.rb +7 -0
- data/.dassie/db/migrate/20250826142475_add_index_to_metadata_bulkrax_identifier.bulkrax.rb +19 -0
- data/.dassie/db/migrate/20250826142476_add_file_name_to_uploaded_files.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142477_add_error_tracking_to_pending_relationships.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142478_add_last_imported_at_to_bulkrax_importers.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142479_add_next_import_at_to_bulkrax_importers.bulkrax.rb +6 -0
- data/.dassie/db/migrate/20250826142480_entry_error_denormalization.bulkrax.rb +8 -0
- data/.dassie/db/migrate/20250826142481_faster_first_entry.bulkrax.rb +8 -0
- data/.dassie/db/migrate/20260430000001_create_hyrax_redirect_paths.hyrax.rb +13 -0
- data/.dassie/db/migrate/20260521003627_add_additional_redirect_info.hyrax.rb +32 -0
- data/.dassie/db/schema.rb +154 -1
- data/.dassie/package.json +1 -1
- data/.dassie/rspec_split_configuration.json +835 -0
- data/.dassie/solr/conf/solrconfig.xml +21 -5
- data/.github/{ISSUE_TEMPLATE.md → ISSUE_TEMPLATE/issue_template.md} +5 -0
- data/.github/workflows/lint-build-test.yml +5 -1
- data/.github/workflows/release-charts.yml +48 -0
- data/.gitignore +6 -0
- data/.koppie/.env +5 -1
- data/.koppie/Gemfile +3 -1
- data/.koppie/app/assets/images/bulkrax/removed.png +0 -0
- data/.koppie/app/assets/javascripts/application.js +2 -0
- data/.koppie/app/assets/stylesheets/application.css +1 -0
- data/.koppie/app/controllers/catalog_controller.rb +1 -1
- data/.koppie/app/forms/collection_resource_form.rb +5 -2
- data/.koppie/app/forms/file_set_form.rb +5 -0
- data/.koppie/app/forms/generic_work_form.rb +5 -3
- data/.koppie/app/forms/monograph_form.rb +5 -3
- data/.koppie/app/indexers/collection_resource_indexer.rb +5 -2
- data/.koppie/app/indexers/file_set_indexer.rb +7 -0
- data/.koppie/app/indexers/generic_work_indexer.rb +6 -3
- data/.koppie/app/indexers/monograph_indexer.rb +6 -2
- data/.koppie/app/models/ability.rb +8 -0
- data/.koppie/app/models/collection_resource.rb +4 -2
- data/.koppie/app/models/concerns/bulkrax/has_local_processing.rb +8 -0
- data/.koppie/app/models/generic_work.rb +5 -2
- data/.koppie/app/models/monograph.rb +5 -2
- data/.koppie/app/views/blacklight_dynamic_sitemap/sitemap/show.xml.builder +22 -0
- data/.koppie/bin/importer +142 -0
- data/.koppie/bin/web +4 -0
- data/.koppie/config/browse_everything_providers.yml +2 -0
- data/.koppie/config/bulkrax_api.yml +86 -0
- data/.koppie/config/initializers/bulkrax.rb +92 -0
- data/.koppie/config/initializers/clamav.rb +2 -0
- data/.koppie/config/initializers/hyrax.rb +11 -3
- data/.koppie/config/initializers/riiif.rb +4 -82
- data/.koppie/config/metadata_profiles/m3_profile.yaml +930 -0
- data/.koppie/config/routes.rb +7 -0
- data/.koppie/config/sidekiq.yml +2 -0
- data/.koppie/config/uv/uv.html +63 -81
- data/.koppie/db/migrate/20240606205215_create_hyrax_flexible_schemas.rb +9 -0
- data/.koppie/db/migrate/20240606205216_add_contexts_to_hyrax_flexible_schemas.rb +5 -0
- data/.koppie/db/migrate/20250826142438_create_bulkrax_importers.bulkrax.rb +19 -0
- data/.koppie/db/migrate/20250826142439_create_bulkrax_importer_runs.bulkrax.rb +17 -0
- data/.koppie/db/migrate/20250826142440_create_bulkrax_entries.bulkrax.rb +17 -0
- data/.koppie/db/migrate/20250826142441_add_status_to_entry.bulkrax.rb +10 -0
- data/.koppie/db/migrate/20250826142442_add_collections_to_importer_runs.bulkrax.rb +7 -0
- data/.koppie/db/migrate/20250826142443_change_collection_ids_on_entries.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142444_create_bulkrax_exporters.bulkrax.rb +20 -0
- data/.koppie/db/migrate/20250826142445_create_bulkrax_exporter_runs.bulkrax.rb +15 -0
- data/.koppie/db/migrate/20250826142446_change_importer_and_exporter_to_polymorphic.bulkrax.rb +19 -0
- data/.koppie/db/migrate/20250826142447_add_total_collection_records_to_importer_runs.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142448_add_children_to_importer_runs.bulkrax.rb +7 -0
- data/.koppie/db/migrate/20250826142449_change_total_records_to_total_work_entries.bulkrax.rb +7 -0
- data/.koppie/db/migrate/20250826142450_change_entry_last_error.bulkrax.rb +20 -0
- data/.koppie/db/migrate/20250826142451_add_validate_only_to_bulkrax_importers.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142452_add_status_to_importers.bulkrax.rb +10 -0
- data/.koppie/db/migrate/20250826142453_remove_foreign_key_from_bulkrax_entries.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142454_add_status_to_exporters.bulkrax.rb +8 -0
- data/.koppie/db/migrate/20250826142455_add_invalid_record_to_importer_run.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142456_create_bulkrax_statuses.bulkrax.rb +19 -0
- data/.koppie/db/migrate/20250826142457_move_to_statuses.bulkrax.rb +31 -0
- data/.koppie/db/migrate/20250826142458_add_date_filter_and_status_to_bulkrax_exporters.bulkrax.rb +8 -0
- data/.koppie/db/migrate/20250826142459_add_workflow_status_to_bulkrax_exporter.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142460_remove_unused_last_error.bulkrax.rb +8 -0
- data/.koppie/db/migrate/20250826142461_increase_text_sizes.bulkrax.rb +13 -0
- data/.koppie/db/migrate/20250826142462_change_bulkrax_statuses_error_message_column_type_to_text.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142463_rename_children_counters_to_relationships.bulkrax.rb +7 -0
- data/.koppie/db/migrate/20250826142464_add_file_set_counters_to_importer_runs.bulkrax.rb +8 -0
- data/.koppie/db/migrate/20250826142465_add_import_attempts_to_entries.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142466_add_work_counters_to_importer_runs.bulkrax.rb +7 -0
- data/.koppie/db/migrate/20250826142467_create_bulkrax_pending_relationships.bulkrax.rb +14 -0
- data/.koppie/db/migrate/20250826142468_add_order_to_bulkrax_pending_relationships.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142469_add_include_thumbnails_to_bulkrax_exporters.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142470_add_generated_metadata_to_bulkrax_exporters.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142471_rename_bulkrax_importer_run_to_importer_run.bulkrax.rb +18 -0
- data/.koppie/db/migrate/20250826142472_add_indices_to_bulkrax.bulkrax.rb +26 -0
- data/.koppie/db/migrate/20250826142473_denormalize_status_message.bulkrax.rb +8 -0
- data/.koppie/db/migrate/20250826142474_update_identifier_index.bulkrax.rb +7 -0
- data/.koppie/db/migrate/20250826142475_add_index_to_metadata_bulkrax_identifier.bulkrax.rb +19 -0
- data/.koppie/db/migrate/20250826142476_add_file_name_to_uploaded_files.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142477_add_error_tracking_to_pending_relationships.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142478_add_last_imported_at_to_bulkrax_importers.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142479_add_next_import_at_to_bulkrax_importers.bulkrax.rb +6 -0
- data/.koppie/db/migrate/20250826142480_entry_error_denormalization.bulkrax.rb +8 -0
- data/.koppie/db/migrate/20250826142481_faster_first_entry.bulkrax.rb +8 -0
- data/.koppie/db/migrate/20260430000001_create_hyrax_redirect_paths.hyrax.rb +13 -0
- data/.koppie/db/migrate/20260521003627_add_additional_redirect_info.hyrax.rb +32 -0
- data/.koppie/db/schema.rb +154 -1
- data/.koppie/package.json +1 -1
- data/.koppie/rspec_split_configuration.json +835 -0
- data/.koppie/solr/conf/solrconfig.xml +0 -5
- data/.koppie/yarn.lock +5587 -752
- data/.rubocop.yml +1 -0
- data/CONTAINERS.md +2 -0
- data/Dockerfile +9 -22
- data/Gemfile +0 -1
- data/Gemfile.allinson +2 -0
- data/README.md +1 -2
- data/app/actors/hyrax/actors/file_actor.rb +2 -0
- data/app/actors/hyrax/actors/file_set_actor.rb +1 -1
- data/app/assets/javascripts/hyrax/app.js.erb +143 -10
- data/app/assets/javascripts/hyrax/collection_select.js +68 -0
- data/app/assets/javascripts/hyrax/copy_permalink_button.js +28 -0
- data/app/assets/javascripts/hyrax/redirects.js +45 -0
- data/app/assets/javascripts/hyrax/relationships/control.es6 +21 -1
- data/app/assets/javascripts/hyrax/select_work_type.es6 +7 -2
- data/app/assets/javascripts/hyrax.js +3 -1
- data/app/assets/stylesheets/hyrax/_file-show.scss +1 -0
- data/app/assets/stylesheets/hyrax/_viewer.scss +8 -0
- data/app/assets/stylesheets/hyrax/dashboard.scss +22 -1
- data/app/assets/stylesheets/hyrax/sidebar.scss +98 -3
- data/app/authorities/qa/authorities/collections.rb +9 -9
- data/app/controllers/concerns/hyrax/analytics_error_handling.rb +97 -0
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +3 -1
- data/app/controllers/concerns/hyrax/ensure_migrated_behavior.rb +50 -0
- data/app/controllers/concerns/hyrax/flexible_catalog_behavior.rb +206 -0
- data/app/controllers/concerns/hyrax/flexible_schema_behavior.rb +17 -0
- data/app/controllers/concerns/hyrax/redirect_to_display_url.rb +54 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +52 -10
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +21 -13
- data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +2 -0
- data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +1 -0
- data/app/controllers/hyrax/admin/metadata_profiles_controller.rb +66 -0
- data/app/controllers/hyrax/batch_uploads_controller.rb +2 -0
- data/app/controllers/hyrax/dashboard/collections_controller.rb +27 -6
- data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +2 -1
- data/app/controllers/hyrax/dashboard_controller.rb +2 -1
- data/app/controllers/hyrax/file_sets_controller.rb +19 -1
- data/app/controllers/hyrax/homepage_controller.rb +7 -0
- data/app/controllers/hyrax/my/works_controller.rb +2 -21
- data/app/controllers/hyrax/permissions_controller.rb +4 -2
- data/app/controllers/hyrax/redirects_controller.rb +56 -0
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +2 -1
- data/app/controllers/hyrax/transcripts_controller.rb +31 -0
- data/app/controllers/hyrax/uploads_controller.rb +18 -9
- data/app/forms/concerns/hyrax/based_near_field_behavior.rb +77 -0
- data/app/forms/concerns/hyrax/flexible_form_behavior.rb +37 -0
- data/app/forms/concerns/hyrax/redirects_field_behavior.rb +95 -0
- data/app/forms/concerns/hyrax/transcripts_behavior.rb +40 -0
- data/app/forms/hyrax/forms/admin_set_form.rb +1 -1
- data/app/forms/hyrax/forms/administrative_set_form.rb +3 -0
- data/app/forms/hyrax/forms/batch_edit_form.rb +1 -3
- data/app/forms/hyrax/forms/batch_upload_form.rb +14 -0
- data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
- data/app/forms/hyrax/forms/file_set_form.rb +6 -7
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +17 -5
- data/app/forms/hyrax/forms/pcdm_object_form.rb +11 -3
- data/app/forms/hyrax/forms/resource_batch_edit_form.rb +8 -22
- data/app/forms/hyrax/forms/resource_form.rb +110 -10
- data/app/forms/hyrax/forms.rb +1 -0
- data/app/helpers/hyrax/attributes_helper.rb +109 -0
- data/app/helpers/hyrax/blacklight_override.rb +26 -0
- data/app/helpers/hyrax/collections_helper.rb +2 -0
- data/app/helpers/hyrax/file_set_form_helper.rb +24 -0
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +51 -2
- data/app/helpers/hyrax/iiif_helper.rb +11 -1
- data/app/helpers/hyrax/permalink_helper.rb +37 -0
- data/app/helpers/hyrax/redirects_tab_helper.rb +29 -0
- data/app/helpers/hyrax/work_form_helper.rb +9 -5
- data/app/helpers/hyrax/works_helper.rb +14 -0
- data/app/indexers/concerns/hyrax/workflow_indexer.rb +30 -0
- data/app/indexers/hyrax/file_set_indexer.rb +1 -0
- data/app/indexers/hyrax/indexers/administrative_set_indexer.rb +2 -1
- data/app/indexers/hyrax/indexers/file_set_indexer.rb +6 -2
- data/app/indexers/hyrax/indexers/pcdm_collection_indexer.rb +11 -1
- data/app/indexers/hyrax/indexers/pcdm_object_indexer.rb +25 -4
- data/app/indexers/hyrax/indexers/redirects_indexer.rb +29 -0
- data/app/indexers/hyrax/indexers/resource_indexer.rb +4 -0
- data/app/indexers/hyrax/indexers.rb +2 -0
- data/app/inputs/controlled_vocabulary_input.rb +7 -1
- data/app/jobs/content_deposit_error_event_job.rb +14 -0
- data/app/jobs/create_work_job.rb +2 -0
- data/app/jobs/migrate_files_to_valkyrie_job.rb +7 -1
- data/app/models/batch_upload_item.rb +4 -0
- data/app/models/concerns/hyrax/ability/flexible_metadata_ability.rb +10 -0
- data/app/models/concerns/hyrax/ability.rb +3 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +4 -0
- data/app/models/concerns/hyrax/file_set/transcripts.rb +16 -0
- data/app/models/concerns/hyrax/file_set_behavior.rb +9 -0
- data/app/models/concerns/hyrax/flexibility.rb +107 -0
- data/app/models/concerns/hyrax/redirects_normalization.rb +38 -0
- data/app/models/concerns/hyrax/solr_document/characterization.rb +1 -1
- data/app/models/concerns/hyrax/solr_document/metadata.rb +9 -0
- data/app/models/concerns/hyrax/solr_document/ordered_members.rb +4 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +28 -6
- data/app/models/concerns/hyrax/suppressible.rb +1 -1
- data/app/models/concerns/hyrax/valkyrie_lazy_migration.rb +1 -1
- data/app/models/concerns/hyrax/with_embargoes_and_leases.rb +30 -0
- data/app/models/concerns/hyrax/work_behavior.rb +8 -0
- data/app/models/hyrax/administrative_set.rb +1 -1
- data/app/models/hyrax/change_set.rb +3 -1
- data/app/models/hyrax/embargo.rb +3 -1
- data/app/models/hyrax/file_set.rb +4 -2
- data/app/models/hyrax/flexible_schema.rb +219 -0
- data/app/models/hyrax/lease.rb +3 -1
- data/app/models/hyrax/pcdm_collection.rb +4 -1
- data/app/models/hyrax/redirect.rb +64 -0
- data/app/models/hyrax/redirect_path.rb +14 -0
- data/app/models/hyrax/resource.rb +22 -25
- data/app/models/hyrax/riiif/file.rb +43 -0
- data/app/models/hyrax/riiif/file_resolver.rb +65 -0
- data/app/models/hyrax/uploaded_file.rb +9 -0
- data/app/models/hyrax/virus_scanner.rb +16 -3
- data/app/models/hyrax/work.rb +4 -1
- data/app/models/job_io_wrapper.rb +12 -3
- data/app/models/user_mailbox.rb +3 -1
- data/app/presenters/hyrax/admin_set_presenter.rb +11 -0
- data/app/presenters/hyrax/annotates_content.rb +35 -0
- data/app/presenters/hyrax/collection_presenter.rb +5 -1
- data/app/presenters/hyrax/displays_content.rb +133 -0
- data/app/presenters/hyrax/displays_image.rb +11 -4
- data/app/presenters/hyrax/displays_transcripts.rb +59 -0
- data/app/presenters/hyrax/file_set_presenter.rb +8 -18
- data/app/presenters/hyrax/google_scholar_presenter.rb +39 -0
- data/app/presenters/hyrax/iiif_manifest_presenter.rb +22 -4
- data/app/presenters/hyrax/missing_method_behavior.rb +15 -0
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +2 -4
- data/app/presenters/hyrax/work_show_presenter.rb +56 -14
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +6 -2
- data/app/renderers/hyrax/renderers/license_attribute_renderer.rb +10 -10
- data/app/renderers/hyrax/renderers/redirects_label_attribute_renderer.rb +25 -0
- data/app/renderers/hyrax/renderers/rights_statement_attribute_renderer.rb +10 -11
- data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +1 -5
- data/app/search_builders/hyrax/filter_by_type.rb +1 -1
- data/app/services/hyrax/action/create_valkyrie_work.rb +3 -2
- data/app/services/hyrax/authority_rendering_helper.rb +28 -0
- data/app/services/hyrax/authority_service.rb +107 -0
- data/app/services/hyrax/callbacks.rb +2 -2
- data/app/services/hyrax/collections/nested_collection_query_service.rb +9 -3
- data/app/services/hyrax/collections_service.rb +17 -0
- data/app/services/hyrax/custom_queries/find_by_property_value.rb +89 -0
- data/app/services/hyrax/edit_permissions_service.rb +4 -4
- data/app/services/hyrax/file_set_type_service.rb +12 -4
- data/app/services/hyrax/flexible_schema_validator_service.rb +153 -0
- data/app/services/hyrax/flexible_schema_validators/class_validator.rb +123 -0
- data/app/services/hyrax/flexible_schema_validators/core_metadata_validator.rb +211 -0
- data/app/services/hyrax/flexible_schema_validators/existing_records_validator.rb +83 -0
- data/app/services/hyrax/flexible_schema_validators/redirects_validator.rb +116 -0
- data/app/services/hyrax/flexible_schema_validators/schema_validator.rb +34 -0
- data/app/services/hyrax/flexible_schema_validators/sort_properties_validator.rb +54 -0
- data/app/services/hyrax/license_service.rb +1 -1
- data/app/services/hyrax/listeners/metadata_index_listener.rb +11 -0
- data/app/services/hyrax/m3_profile_editor.rb +32 -0
- data/app/services/hyrax/m3_schema_loader.rb +119 -0
- data/app/services/hyrax/manifest_builder_service.rb +18 -24
- data/app/services/hyrax/permalink_path.rb +25 -0
- data/app/services/hyrax/qa_select_service.rb +9 -5
- data/app/services/hyrax/redirect_path_normalizer.rb +58 -0
- data/app/services/hyrax/redirects_lookup.rb +59 -0
- data/app/services/hyrax/resource_permissions_visibility_propagator.rb +54 -0
- data/app/services/hyrax/resource_types_service.rb +3 -20
- data/app/services/hyrax/rights_statement_service.rb +1 -1
- data/app/services/hyrax/schema_loader.rb +205 -0
- data/app/services/hyrax/search_service.rb +1 -1
- data/app/services/hyrax/simple_schema_loader.rb +28 -127
- data/app/services/hyrax/solr_service.rb +39 -2
- data/app/services/hyrax/tolerant_select_service.rb +5 -3
- data/app/services/hyrax/valkyrie_upload.rb +2 -2
- data/app/services/hyrax/visibility_propagator.rb +4 -1
- data/app/services/hyrax/work_uploads_handler.rb +17 -9
- data/app/services/hyrax/workflow/workflow_factory.rb +5 -4
- data/app/services/migrate_resource_service.rb +7 -1
- data/app/uploaders/hyrax/uploaded_file_uploader.rb +2 -2
- data/app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb +1 -1
- data/app/utils/hyrax/required_data_seeder.rb +1 -0
- data/app/utils/hyrax/required_data_seeders/collection_type_seeder.rb +1 -1
- data/app/utils/hyrax/required_data_seeders/flexible_profile_seeder.rb +28 -0
- data/app/validators/hyrax/controlled_vocabulary_validator.rb +64 -0
- data/app/validators/hyrax/redirect_validator.rb +128 -0
- data/app/views/catalog/_thumbnail_list_default.html.erb +2 -2
- data/app/views/collections/edit_fields/_schema_version.html.erb +1 -0
- data/app/views/hyrax/admin/admin_sets/_form_metadata.html.erb +24 -2
- data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/show.html.erb +1 -1
- data/app/views/hyrax/admin/analytics/_analytics_error.html.erb +42 -0
- data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +11 -9
- data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +60 -57
- data/app/views/hyrax/admin/features/index.html.erb +1 -1
- data/app/views/hyrax/admin/metadata_profiles/_import_modal.html.erb +20 -0
- data/app/views/hyrax/admin/metadata_profiles/index.html.erb +54 -0
- data/app/views/hyrax/base/_attribute_rows.html.erb +4 -21
- data/app/views/hyrax/base/_citations.html.erb +1 -0
- data/app/views/hyrax/base/_currently_shared.html.erb +2 -1
- data/app/views/hyrax/base/_file_manager_thumbnail.html.erb +1 -1
- data/app/views/hyrax/base/_form_member_of_collections.html.erb +6 -6
- data/app/views/hyrax/base/_form_redirects.html.erb +125 -0
- data/app/views/hyrax/base/_form_share.html.erb +7 -2
- data/app/views/hyrax/base/_member.html.erb +1 -1
- data/app/views/hyrax/base/_social_media.html.erb +1 -1
- data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +1 -1
- data/app/views/hyrax/base/show.html.erb +3 -0
- data/app/views/hyrax/collections/_default_group.html.erb +3 -0
- data/app/views/hyrax/collections/_list_collections.html.erb +3 -0
- data/app/views/hyrax/collections/_list_works.html.erb +1 -1
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +4 -0
- data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -2
- data/app/views/hyrax/dashboard/collections/_button_for_update_collection.html.erb +2 -1
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +3 -0
- data/app/views/hyrax/dashboard/collections/_form.html.erb +17 -0
- data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +7 -10
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +3 -0
- data/app/views/hyrax/dashboard/collections/_list_works.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +1 -8
- data/app/views/hyrax/dashboard/profiles/_trophy_edit.html.erb +1 -1
- data/app/views/hyrax/dashboard/profiles/show.html.erb +5 -5
- data/app/views/hyrax/dashboard/sidebar/_metadata.html.erb +11 -0
- data/app/views/hyrax/dashboard/sidebar/_repository_content.html.erb +1 -0
- data/app/views/hyrax/dashboard/works/_default_group.html.erb +3 -0
- data/app/views/hyrax/dashboard/works/_list_works.html.erb +4 -2
- data/app/views/hyrax/file_sets/_form.html.erb +16 -3
- data/app/views/hyrax/file_sets/_metadata.html.erb +35 -0
- data/app/views/hyrax/file_sets/_valkyrie_form.html.erb +37 -0
- data/app/views/hyrax/file_sets/edit.html.erb +14 -8
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +4 -0
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +2 -2
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +4 -0
- data/app/views/hyrax/homepage/_explore_collections.html.erb +1 -1
- data/app/views/hyrax/homepage/_featured_fields.html.erb +1 -1
- data/app/views/hyrax/homepage/_recent_document.html.erb +1 -1
- data/app/views/hyrax/homepage/robots.text.erb +17 -0
- data/app/views/hyrax/my/collections/_default_group.html.erb +3 -0
- data/app/views/hyrax/my/collections/_list_collections.html.erb +3 -0
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +2 -2
- data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +2 -2
- data/app/views/hyrax/my/works/_default_group.html.erb +3 -0
- data/app/views/hyrax/my/works/_list_works.html.erb +5 -2
- data/app/views/hyrax/shared/_copy_permalink.html.erb +10 -0
- data/app/views/hyrax/users/_user_info.html.erb +1 -6
- data/app/views/layouts/_head_tag_content.html.erb +2 -0
- data/app/views/layouts/hyrax/dashboard.html.erb +2 -1
- data/app/views/records/edit_fields/_contexts.html.erb +1 -0
- data/app/views/records/edit_fields/_license.html.erb +17 -5
- data/app/views/records/edit_fields/_resource_type.html.erb +16 -2
- data/app/views/records/edit_fields/_rights_statement.html.erb +17 -5
- data/app/views/records/edit_fields/_schema_version.html.erb +1 -0
- data/app/views/records/edit_fields/_transcript_ids.html.erb +18 -0
- data/app/views/records/show_fields/_rights.html.erb +1 -1
- data/app/views/shared/_citations.html.erb +46 -31
- data/app/views/shared/_schema_version.html.erb +38 -0
- data/bin/dev-entrypoint.sh +14 -4
- data/chart/hyrax/Chart.yaml +4 -4
- data/chart/hyrax/templates/ingress.yaml +3 -0
- data/chart/hyrax/values.yaml +10 -8
- data/config/features.rb +27 -0
- data/config/initializers/blacklight_dynamic_sitemap.rb +43 -0
- data/config/initializers/deprecation_patch.rb +27 -0
- data/config/initializers/hydra_works.rb +3 -0
- data/config/initializers/i18n_extensions.rb +197 -0
- data/config/initializers/storage_adapter_initializer.rb +15 -9
- data/config/locales/hyrax.de.yml +172 -54
- data/config/locales/hyrax.en.yml +183 -66
- data/config/locales/hyrax.es.yml +174 -49
- data/config/locales/hyrax.fr.yml +169 -45
- data/config/locales/hyrax.it.yml +172 -48
- data/config/locales/hyrax.pt-BR.yml +172 -54
- data/config/locales/hyrax.zh.yml +145 -21
- data/config/metadata/basic_metadata.yaml +66 -0
- data/config/metadata/batch_edit_metadata.yaml +119 -0
- data/config/metadata/file_set_metadata.yaml +19 -0
- data/config/metadata/redirects.yaml +15 -0
- data/config/metadata_profiles/m3_json_schema.json +487 -0
- data/config/metadata_profiles/m3_profile.yaml +954 -0
- data/config/routes.rb +9 -0
- data/docker-compose-allinson.yml +176 -0
- data/docker-compose-dassie.yml +14 -6
- data/docker-compose-koppie.yml +18 -10
- data/docker-compose-sirenia.yml +20 -10
- data/documentation/copy_permalink.md +29 -0
- data/documentation/developing-your-hyrax-based-app.md +2 -2
- data/documentation/file-ingest-characterization.md +763 -0
- data/documentation/flexible_metadata.md +113 -0
- data/documentation/forms/field_behaviors.md +297 -0
- data/documentation/redirects.md +428 -0
- data/hyrax.gemspec +7 -2
- data/lib/freyja/metadata_adapter.rb +1 -1
- data/lib/freyja/persister.rb +25 -1
- data/lib/generators/hyrax/collection_resource/collection_resource_generator.rb +2 -2
- data/lib/generators/hyrax/collection_resource/templates/collection.rb.erb +5 -1
- data/lib/generators/hyrax/collection_resource/templates/collection_form.rb.erb +5 -1
- data/lib/generators/hyrax/collection_resource/templates/collection_indexer.rb.erb +6 -1
- data/lib/generators/hyrax/iiif_viewer/USAGE +22 -0
- data/lib/generators/hyrax/iiif_viewer/iiif_viewer_generator.rb +49 -0
- data/lib/generators/hyrax/iiif_viewer/templates/_clover.html.erb +7 -0
- data/lib/generators/hyrax/iiif_viewer/templates/clover/clover.css +3328 -0
- data/lib/generators/hyrax/iiif_viewer/templates/clover/clover.html +16 -0
- data/lib/generators/hyrax/iiif_viewer/templates/clover/clover.js +237 -0
- data/lib/generators/hyrax/install_generator.rb +25 -1
- data/lib/generators/hyrax/riiif_generator.rb +1 -1
- data/lib/generators/hyrax/templates/app/views/blacklight_dynamic_sitemap/sitemap/show.xml.builder +22 -0
- data/lib/generators/hyrax/templates/config/clamav.rb +2 -0
- data/lib/generators/hyrax/templates/config/initializers/riiif.rb +4 -80
- data/lib/generators/hyrax/templates/db/migrate/20240606205215_create_hyrax_flexible_schemas.rb.erb +9 -0
- data/lib/generators/hyrax/templates/db/migrate/20240606205216_add_contexts_to_hyrax_flexible_schemas.rb.erb +5 -0
- data/lib/generators/hyrax/templates/db/migrate/20260430000001_create_hyrax_redirect_paths.rb.erb +22 -0
- data/lib/generators/hyrax/templates/db/migrate/20260521003627_add_additional_redirect_info.rb.erb +39 -0
- data/lib/generators/hyrax/templates/package.json +1 -1
- data/lib/generators/hyrax/templates/uv.html +60 -82
- data/lib/generators/hyrax/work/templates/indexer.rb.erb +1 -1
- data/lib/generators/hyrax/work/templates/model.rb.erb +5 -1
- data/lib/generators/hyrax/work_resource/templates/form.rb.erb +5 -2
- data/lib/generators/hyrax/work_resource/templates/indexer.rb.erb +6 -2
- data/lib/generators/hyrax/work_resource/templates/work.rb.erb +5 -2
- data/lib/generators/hyrax/work_resource/work_resource_generator.rb +1 -0
- data/lib/hyrax/active_fedora_dummy_model.rb +6 -0
- data/lib/hyrax/configuration.rb +197 -3
- data/lib/hyrax/deprecation.rb +31 -0
- data/lib/hyrax/engine.rb +2 -0
- data/lib/hyrax/form_fields.rb +17 -5
- data/lib/hyrax/indexer.rb +31 -2
- data/lib/hyrax/resource_sync/resource_list_writer.rb +3 -0
- data/lib/hyrax/schema.rb +15 -4
- data/lib/hyrax/specs/shared_specs/factories/administrative_sets.rb +12 -0
- data/lib/hyrax/specs/shared_specs/factories/hyrax_embargo.rb +1 -1
- data/lib/hyrax/specs/shared_specs/factories/hyrax_file_set.rb +13 -0
- data/lib/hyrax/specs/shared_specs/factories/hyrax_lease.rb +5 -1
- data/lib/hyrax/specs/shared_specs/factories/hyrax_work.rb +14 -0
- data/lib/hyrax/specs/shared_specs/simple_work.rb +41 -0
- data/lib/hyrax/specs/shared_specs.rb +1 -0
- data/lib/hyrax/transactions/collection_create.rb +2 -1
- data/lib/hyrax/transactions/collection_destroy.rb +1 -0
- data/lib/hyrax/transactions/collection_update.rb +2 -1
- data/lib/hyrax/transactions/container.rb +28 -0
- data/lib/hyrax/transactions/steps/apply_permission_template_on_update.rb +65 -0
- data/lib/hyrax/transactions/steps/apply_workflow_on_admin_set_change.rb +97 -0
- data/lib/hyrax/transactions/steps/ensure_admin_set.rb +1 -1
- data/lib/hyrax/transactions/steps/remove_redirect_paths.rb +35 -0
- data/lib/hyrax/transactions/steps/save.rb +10 -0
- data/lib/hyrax/transactions/steps/set_default_admin_set.rb +1 -1
- data/lib/hyrax/transactions/steps/sync_redirect_paths.rb +141 -0
- data/lib/hyrax/transactions/work_create.rb +2 -1
- data/lib/hyrax/transactions/work_destroy.rb +1 -0
- data/lib/hyrax/transactions/work_update.rb +4 -1
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +61 -0
- data/lib/tasks/m3_profile_cleanup.rake +35 -0
- data/template.rb +4 -1
- metadata +313 -19
- data/.dassie/public/robots.txt +0 -1
- data/.koppie/public/robots.txt +0 -1
- data/app/forms/concerns/hyrax/basic_metadata_form_fields_behavior.rb +0 -39
- data/app/views/catalog/_thumbnail_list_collection.html.erb +0 -4
|
@@ -4,8 +4,12 @@ require 'iiif_manifest'
|
|
|
4
4
|
module Hyrax
|
|
5
5
|
module WorksControllerBehavior
|
|
6
6
|
extend ActiveSupport::Concern
|
|
7
|
-
include Blacklight::
|
|
7
|
+
include Blacklight::Configurable
|
|
8
|
+
include Blacklight::SearchContext
|
|
8
9
|
include Blacklight::AccessControls::Catalog
|
|
10
|
+
include Hyrax::FlexibleSchemaBehavior if Hyrax.config.flexible?
|
|
11
|
+
include Hyrax::EnsureMigratedBehavior
|
|
12
|
+
include Hyrax::RedirectToDisplayUrl
|
|
9
13
|
|
|
10
14
|
included do
|
|
11
15
|
with_themed_layout :decide_layout
|
|
@@ -34,6 +38,7 @@ module Hyrax
|
|
|
34
38
|
class_methods do
|
|
35
39
|
def curation_concern_type=(curation_concern_type)
|
|
36
40
|
load_and_authorize_resource class: curation_concern_type, instance_name: :curation_concern, except: [:show, :file_manager, :inspect_work, :manifest]
|
|
41
|
+
before_action :ensure_migrated_object, only: :edit
|
|
37
42
|
|
|
38
43
|
# Load the fedora resource to get the etag.
|
|
39
44
|
# No need to authorize for the file manager, because it does authorization via the presenter.
|
|
@@ -59,6 +64,7 @@ module Hyrax
|
|
|
59
64
|
# TODO: move these lines to the work form builder in Hyrax
|
|
60
65
|
curation_concern.depositor = current_user.user_key
|
|
61
66
|
curation_concern.admin_set_id = params[:admin_set_id] || admin_set_id_for_new
|
|
67
|
+
curation_concern.contexts = Hyrax.query_service.find_by(id: curation_concern.admin_set_id)&.contexts if curation_concern.flexible?
|
|
62
68
|
build_form
|
|
63
69
|
end
|
|
64
70
|
|
|
@@ -134,17 +140,27 @@ module Hyrax
|
|
|
134
140
|
end
|
|
135
141
|
|
|
136
142
|
def manifest
|
|
137
|
-
|
|
143
|
+
locale = params[:locale] || current_user&.preferred_locale || I18n.default_locale
|
|
144
|
+
I18n.with_locale(locale) do
|
|
145
|
+
headers['Access-Control-Allow-Origin'] = '*'
|
|
138
146
|
|
|
139
|
-
|
|
147
|
+
json = iiif_manifest_builder.manifest_for(presenter: iiif_manifest_presenter)
|
|
140
148
|
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
respond_to do |wants|
|
|
150
|
+
wants.any { render json: json }
|
|
151
|
+
end
|
|
143
152
|
end
|
|
144
153
|
end
|
|
145
154
|
|
|
146
155
|
private
|
|
147
156
|
|
|
157
|
+
def ensure_migrated_object
|
|
158
|
+
@curation_concern = ensure_migrated(
|
|
159
|
+
resource: curation_concern,
|
|
160
|
+
transaction_key: 'change_set.update_work'
|
|
161
|
+
)
|
|
162
|
+
end
|
|
163
|
+
|
|
148
164
|
def load_curation_concern
|
|
149
165
|
if Hyrax.config.disable_wings
|
|
150
166
|
Hyrax.query_service.find_by(id: params[:id])
|
|
@@ -155,7 +171,7 @@ module Hyrax
|
|
|
155
171
|
|
|
156
172
|
def iiif_manifest_builder
|
|
157
173
|
self.class.iiif_manifest_builder ||
|
|
158
|
-
(Flipflop.cache_work_iiif_manifest? ? Hyrax::CachingIiifManifestBuilder.new : Hyrax::ManifestBuilderService.new)
|
|
174
|
+
(Flipflop.cache_work_iiif_manifest? ? Hyrax::CachingIiifManifestBuilder.new : Hyrax::ManifestBuilderService.new(iiif_manifest_factory: manifest_factory_for_work))
|
|
159
175
|
end
|
|
160
176
|
|
|
161
177
|
def iiif_manifest_presenter
|
|
@@ -166,7 +182,7 @@ module Hyrax
|
|
|
166
182
|
end
|
|
167
183
|
|
|
168
184
|
def user_collections
|
|
169
|
-
collections_service.
|
|
185
|
+
collections_service.all_search_results(:deposit)
|
|
170
186
|
end
|
|
171
187
|
|
|
172
188
|
def collections_service
|
|
@@ -177,7 +193,8 @@ module Hyrax
|
|
|
177
193
|
Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s
|
|
178
194
|
end
|
|
179
195
|
|
|
180
|
-
def build_form
|
|
196
|
+
def build_form(contexts: [])
|
|
197
|
+
curation_concern.contexts = contexts if contexts.present?
|
|
181
198
|
@form = work_form_service.build(curation_concern, current_ability, self)
|
|
182
199
|
end
|
|
183
200
|
|
|
@@ -189,7 +206,7 @@ module Hyrax
|
|
|
189
206
|
# @return [#errors]
|
|
190
207
|
# rubocop:disable Metrics/MethodLength
|
|
191
208
|
def create_valkyrie_work
|
|
192
|
-
form = build_form
|
|
209
|
+
form = build_form(contexts: params[hash_key_for_curation_concern]['contexts'])
|
|
193
210
|
action = create_valkyrie_work_action.new(form: form,
|
|
194
211
|
transactions: transactions,
|
|
195
212
|
user: current_user,
|
|
@@ -208,9 +225,10 @@ module Hyrax
|
|
|
208
225
|
def update_valkyrie_work
|
|
209
226
|
form = build_form
|
|
210
227
|
return after_update_error(form_err_msg(form)) unless form.validate(params[hash_key_for_curation_concern])
|
|
228
|
+
|
|
211
229
|
result =
|
|
212
230
|
transactions['change_set.update_work']
|
|
213
|
-
.with_step_args('work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params:
|
|
231
|
+
.with_step_args('work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params: file_set_attributes },
|
|
214
232
|
'work_resource.update_work_members' => { work_members_attributes: work_members_attributes },
|
|
215
233
|
'work_resource.save_acl' => { permissions_params: form.input_params["permissions"] })
|
|
216
234
|
.call(form)
|
|
@@ -222,6 +240,10 @@ module Hyrax
|
|
|
222
240
|
params[hash_key_for_curation_concern][:work_members_attributes]&.permit!&.to_h
|
|
223
241
|
end
|
|
224
242
|
|
|
243
|
+
def file_set_attributes
|
|
244
|
+
params[hash_key_for_curation_concern][:file_set]&.map { |fs| fs.permit!&.to_h }
|
|
245
|
+
end
|
|
246
|
+
|
|
225
247
|
def form_err_msg(form)
|
|
226
248
|
form.errors.messages.values.flatten.to_sentence
|
|
227
249
|
end
|
|
@@ -541,5 +563,25 @@ module Hyrax
|
|
|
541
563
|
|
|
542
564
|
AdminSetSelectionPresenter.new(admin_sets: admin_sets)
|
|
543
565
|
end
|
|
566
|
+
|
|
567
|
+
def manifest_factory_for_work
|
|
568
|
+
return ::IIIFManifest::V3::ManifestFactory if av_content? || pdf_content?
|
|
569
|
+
|
|
570
|
+
Hyrax.config.iiif_manifest_factory
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
def av_content?
|
|
574
|
+
return false unless Flipflop.iiif_av?
|
|
575
|
+
|
|
576
|
+
iiif_manifest_presenter.file_set_presenters.any? do |file_set|
|
|
577
|
+
file_set.video? || file_set.audio?
|
|
578
|
+
end
|
|
579
|
+
end
|
|
580
|
+
|
|
581
|
+
def pdf_content?
|
|
582
|
+
return false unless Flipflop.iiif_pdf?
|
|
583
|
+
|
|
584
|
+
iiif_manifest_presenter.file_set_presenters.any?(&:pdf?)
|
|
585
|
+
end
|
|
544
586
|
end
|
|
545
587
|
end
|
|
@@ -126,7 +126,7 @@ module Hyrax
|
|
|
126
126
|
def valkyrie_update
|
|
127
127
|
@admin_set = form.validate(admin_set_params) && transactions['admin_set_resource.update'].call(form).value_or do |_failure|
|
|
128
128
|
setup_form # probably should do some real error handling here
|
|
129
|
-
render :edit
|
|
129
|
+
return render :edit
|
|
130
130
|
end
|
|
131
131
|
redirect_to update_referer, notice: I18n.t('updated_admin_set', scope: 'hyrax.admin.admin_sets.form.permission_update_notices', name: @admin_set.title.first)
|
|
132
132
|
end
|
|
@@ -145,22 +145,30 @@ module Hyrax
|
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
def valkyrie_create
|
|
148
|
-
form.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
.call(form).value_or do |_failure|
|
|
155
|
-
setup_form # probably should do some real error handling here
|
|
156
|
-
render :edit
|
|
157
|
-
end
|
|
158
|
-
@admin_set = admin_set_create_service.call!(admin_set: @admin_set, creating_user: current_user)
|
|
159
|
-
after_create
|
|
148
|
+
form.creator = [current_user.user_key] if form.respond_to?(:creator=) && Array(form.try(:creator)).empty?
|
|
149
|
+
if form.validate(admin_set_params)
|
|
150
|
+
valkyrie_create_detail
|
|
151
|
+
else
|
|
152
|
+
after_create_error(err_msg: form.errors.full_messages.to_sentence)
|
|
153
|
+
end
|
|
160
154
|
rescue RuntimeError => err
|
|
161
155
|
after_create_error(err_msg: err.message)
|
|
162
156
|
end
|
|
163
157
|
|
|
158
|
+
def valkyrie_create_detail
|
|
159
|
+
@admin_set = transactions['change_set.create_admin_set']
|
|
160
|
+
.with_step_args(
|
|
161
|
+
'change_set.set_user_as_creator' => { user: current_user },
|
|
162
|
+
'admin_set_resource.apply_collection_type_permissions' => { user: current_user }
|
|
163
|
+
)
|
|
164
|
+
.call(form).value_or do |_failure|
|
|
165
|
+
setup_form # probably should do some real error handling here
|
|
166
|
+
return render :edit
|
|
167
|
+
end
|
|
168
|
+
@admin_set = admin_set_create_service.call!(admin_set: @admin_set, creating_user: current_user)
|
|
169
|
+
after_create
|
|
170
|
+
end
|
|
171
|
+
|
|
164
172
|
def active_fedora_create
|
|
165
173
|
updated_admin_set = admin_set_create_service.call!(admin_set: admin_set_resource, creating_user: current_user)
|
|
166
174
|
@admin_set = Wings::ActiveFedoraConverter.convert(resource: updated_admin_set)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyrax
|
|
4
|
+
module Admin
|
|
5
|
+
class MetadataProfilesController < ApplicationController
|
|
6
|
+
include Hyrax::ThemedLayoutController
|
|
7
|
+
require 'yaml'
|
|
8
|
+
|
|
9
|
+
with_themed_layout 'dashboard'
|
|
10
|
+
|
|
11
|
+
# GET /allinson_flex_profiles
|
|
12
|
+
def index
|
|
13
|
+
add_breadcrumbs
|
|
14
|
+
@metadata_profiles = Hyrax::FlexibleSchema.page(params[:profile_entries_page])
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# rubocop:disable Metrics/MethodLength
|
|
18
|
+
def import
|
|
19
|
+
uploaded_io = params[:file]
|
|
20
|
+
if uploaded_io.blank?
|
|
21
|
+
redirect_to admin_metadata_profiles_path, alert: 'Please select a file to upload'
|
|
22
|
+
return
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
begin
|
|
26
|
+
@flexible_schema = Hyrax::FlexibleSchema.create(profile: YAML.safe_load_file(uploaded_io.path))
|
|
27
|
+
|
|
28
|
+
if @flexible_schema.persisted?
|
|
29
|
+
warning_messages = @flexible_schema.warnings.full_messages.join(', ')
|
|
30
|
+
flash_options = { notice: 'Flexible Metadata Profile was successfully created.' }
|
|
31
|
+
flash_options[:alert] = warning_messages if @flexible_schema.warnings.any?
|
|
32
|
+
redirect_to admin_metadata_profiles_path, flash: flash_options
|
|
33
|
+
else
|
|
34
|
+
error_message = @flexible_schema.errors.messages.values.flatten.join(', ')
|
|
35
|
+
redirect_to admin_metadata_profiles_path, flash: { error: error_message }
|
|
36
|
+
end
|
|
37
|
+
rescue => e
|
|
38
|
+
redirect_to admin_metadata_profiles_path, flash: { error: e.message }
|
|
39
|
+
nil
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
# rubocop:enable Metrics/MethodLength
|
|
43
|
+
|
|
44
|
+
def export
|
|
45
|
+
@schema = Hyrax::FlexibleSchema.find(params[:metadata_profile_id])
|
|
46
|
+
filename = "metadata-profile-v.#{@schema.version}.yml"
|
|
47
|
+
|
|
48
|
+
profile_hash = @schema.profile.deep_dup
|
|
49
|
+
|
|
50
|
+
profile_hash['profile']['version'] = @schema.version
|
|
51
|
+
profile_hash['profile']['date_modified'] = Time.current.strftime('%Y-%m-%d')
|
|
52
|
+
|
|
53
|
+
yaml_data = profile_hash.to_yaml(indentation: 2)
|
|
54
|
+
send_data yaml_data, filename: filename, type: "application/yaml"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def add_breadcrumbs
|
|
60
|
+
add_breadcrumb t(:'hyrax.controls.home'), main_app.root_path
|
|
61
|
+
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
|
62
|
+
add_breadcrumb t(:'hyrax.dashboard.metadata_profiles'), hyrax.admin_metadata_profiles_path
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -80,6 +80,8 @@ module Hyrax
|
|
|
80
80
|
def create_update_job(klass)
|
|
81
81
|
operation = BatchCreateOperation.create!(user: current_user,
|
|
82
82
|
operation_type: "Batch Create")
|
|
83
|
+
# Make sure we have the correct model name for the resource
|
|
84
|
+
klass = Valkyrie.config.resource_class_resolver.call(klass).to_s
|
|
83
85
|
# ActionController::Parameters are not serializable, so cast to a hash
|
|
84
86
|
BatchCreateJob.perform_later(current_user,
|
|
85
87
|
params[:title].permit!.to_h,
|
|
@@ -4,7 +4,10 @@ module Hyrax
|
|
|
4
4
|
## Shows a list of all collections to the admins
|
|
5
5
|
class CollectionsController < Hyrax::My::CollectionsController
|
|
6
6
|
include Blacklight::AccessControls::Catalog
|
|
7
|
-
include Blacklight::
|
|
7
|
+
include Blacklight::Configurable
|
|
8
|
+
include Blacklight::SearchContext
|
|
9
|
+
include Hyrax::FlexibleSchemaBehavior if Hyrax.config.collection_flexible?
|
|
10
|
+
include Hyrax::EnsureMigratedBehavior
|
|
8
11
|
|
|
9
12
|
configure_blacklight do |config|
|
|
10
13
|
config.search_builder_class = Hyrax::Dashboard::CollectionsSearchBuilder
|
|
@@ -43,6 +46,7 @@ module Hyrax
|
|
|
43
46
|
load_and_authorize_resource except: [:index, :create],
|
|
44
47
|
instance_name: :collection,
|
|
45
48
|
class: Hyrax.config.collection_model
|
|
49
|
+
before_action :ensure_migrated_collection, only: :edit
|
|
46
50
|
|
|
47
51
|
def deny_collection_access(exception)
|
|
48
52
|
if exception.action == :edit
|
|
@@ -70,6 +74,7 @@ module Hyrax
|
|
|
70
74
|
def show
|
|
71
75
|
# @todo: remove this unused assignment in 4.0.0
|
|
72
76
|
@banner_file = presenter.banner_file if collection_type.brandable?
|
|
77
|
+
@admin_sets_for_select = helpers.available_admin_sets_for_creating_works(ability: current_ability)
|
|
73
78
|
|
|
74
79
|
presenter
|
|
75
80
|
query_collection_members
|
|
@@ -80,12 +85,12 @@ module Hyrax
|
|
|
80
85
|
end
|
|
81
86
|
|
|
82
87
|
def after_create
|
|
83
|
-
|
|
88
|
+
Hyrax.deprecator(4).warn("Method `#after_create` should have been removed in Hyrax 4.0 but still exists. It will be removed in Hyrax 6.0.")
|
|
84
89
|
after_create_response # call private method for processing
|
|
85
90
|
end
|
|
86
91
|
|
|
87
92
|
def after_create_error
|
|
88
|
-
|
|
93
|
+
Hyrax.deprecator(4).warn("Method `#after_create_error` should have been removed in Hyrax 4.0 but still exists. It will be removed in Hyrax 6.0.")
|
|
89
94
|
after_create_errors("") # call private method for processing
|
|
90
95
|
end
|
|
91
96
|
|
|
@@ -105,12 +110,12 @@ module Hyrax
|
|
|
105
110
|
end
|
|
106
111
|
|
|
107
112
|
def after_update
|
|
108
|
-
|
|
113
|
+
Hyrax.deprecator(4).warn("Method `#after_update` should have been removed in Hyrax 4.0 but still exists. It will be removed in Hyrax 6.0.")
|
|
109
114
|
after_update_response # call private method for processing
|
|
110
115
|
end
|
|
111
116
|
|
|
112
117
|
def after_update_error
|
|
113
|
-
|
|
118
|
+
Hyrax.deprecator(4).warn("Method `#after_update_error` should have been removed in Hyrax 4.0 but still exists. It will be removed in Hyrax 6.0.")
|
|
114
119
|
after_update_errors(@collection.errors) # call private method for processing
|
|
115
120
|
end
|
|
116
121
|
|
|
@@ -180,6 +185,19 @@ module Hyrax
|
|
|
180
185
|
|
|
181
186
|
private
|
|
182
187
|
|
|
188
|
+
def ensure_migrated_collection
|
|
189
|
+
# We need to know if a migration is going to happen, because if it is,
|
|
190
|
+
# we need to reset the memoized form.
|
|
191
|
+
needs_migration = wings_backed?(@collection)
|
|
192
|
+
@collection = ensure_migrated(
|
|
193
|
+
resource: @collection,
|
|
194
|
+
transaction_key: 'change_set.update_collection'
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
# If a migration happened, the memoized @form is now stale.
|
|
198
|
+
@form = nil if needs_migration
|
|
199
|
+
end
|
|
200
|
+
|
|
183
201
|
def create_active_fedora_collection
|
|
184
202
|
# Coming from the UI, a collection type gid should always be present. Coming from the API, if a collection type gid is not specified,
|
|
185
203
|
# use the default collection type (provides backward compatibility with versions < Hyrax 2.1.0)
|
|
@@ -428,7 +446,7 @@ module Hyrax
|
|
|
428
446
|
# TODO: REMOVE in 3.0 - part of deprecation of permission attributes
|
|
429
447
|
permissions = attributes.delete("permissions_attributes")
|
|
430
448
|
return [] unless permissions
|
|
431
|
-
Deprecation.warn(
|
|
449
|
+
Deprecation.warn("Passing in permissions_attributes parameter with a new collection is deprecated and support will be removed from Hyrax 3.0. " \
|
|
432
450
|
"Use Hyrax::PermissionTemplate instead to grant Manage, Deposit, or View access.")
|
|
433
451
|
participants = []
|
|
434
452
|
permissions.each do |p|
|
|
@@ -604,7 +622,10 @@ module Hyrax
|
|
|
604
622
|
end
|
|
605
623
|
|
|
606
624
|
def after_create_errors(errors) # for valkyrie
|
|
625
|
+
collection_type_id = params[:collection_type_id].presence || default_collection_type.id
|
|
626
|
+
@collection.collection_type_gid = CollectionType.find(collection_type_id).to_global_id
|
|
607
627
|
return after_create_errors_for_active_fedora(errors) if @collection.is_a? ActiveFedora::Base
|
|
628
|
+
|
|
608
629
|
respond_to do |wants|
|
|
609
630
|
wants.html do
|
|
610
631
|
flash[:error] = errors.to_s
|
|
@@ -4,7 +4,8 @@ module Hyrax
|
|
|
4
4
|
##
|
|
5
5
|
# @api public
|
|
6
6
|
class NestCollectionsController < ApplicationController
|
|
7
|
-
include Blacklight::
|
|
7
|
+
include Blacklight::Configurable
|
|
8
|
+
include Blacklight::SearchContext
|
|
8
9
|
|
|
9
10
|
class_attribute :form_class, :new_collection_form_class
|
|
10
11
|
self.form_class = Hyrax::Forms::Dashboard::NestCollectionForm
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Hyrax
|
|
3
3
|
class DashboardController < ApplicationController
|
|
4
|
-
include Blacklight::
|
|
4
|
+
include Blacklight::Configurable
|
|
5
|
+
include Blacklight::SearchContext
|
|
5
6
|
include Hyrax::Breadcrumbs
|
|
6
7
|
with_themed_layout 'dashboard'
|
|
7
8
|
before_action :authenticate_user!
|
|
@@ -3,9 +3,12 @@ module Hyrax
|
|
|
3
3
|
class FileSetsController < ApplicationController
|
|
4
4
|
rescue_from WorkflowAuthorizationException, with: :render_unavailable
|
|
5
5
|
|
|
6
|
-
include Blacklight::
|
|
6
|
+
include Blacklight::Configurable
|
|
7
|
+
include Blacklight::SearchContext
|
|
7
8
|
include Blacklight::AccessControls::Catalog
|
|
8
9
|
include Hyrax::Breadcrumbs
|
|
10
|
+
include Hyrax::FlexibleSchemaBehavior if Hyrax.config.file_set_flexible?
|
|
11
|
+
include Hyrax::EnsureMigratedBehavior
|
|
9
12
|
|
|
10
13
|
before_action :authenticate_user!, except: [:show, :citation, :stats]
|
|
11
14
|
load_and_authorize_resource class: Hyrax.config.file_set_class
|
|
@@ -14,6 +17,7 @@ module Hyrax
|
|
|
14
17
|
# prevent method errors and nil objects later
|
|
15
18
|
before_action :cast_file_set
|
|
16
19
|
before_action :build_breadcrumbs, only: [:show, :edit, :stats]
|
|
20
|
+
before_action :ensure_migrated_file_set, only: :edit
|
|
17
21
|
before_action do
|
|
18
22
|
blacklight_config.track_search_session = false
|
|
19
23
|
end
|
|
@@ -94,6 +98,20 @@ module Hyrax
|
|
|
94
98
|
|
|
95
99
|
private
|
|
96
100
|
|
|
101
|
+
def ensure_migrated_file_set
|
|
102
|
+
# We need to know if a migration is going to happen, because if it is,
|
|
103
|
+
# we need to reset the memoized form.
|
|
104
|
+
needs_migration = wings_backed?(@file_set)
|
|
105
|
+
|
|
106
|
+
@file_set = ensure_migrated(
|
|
107
|
+
resource: @file_set,
|
|
108
|
+
transaction_key: 'change_set.update_file_set'
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
# If a migration happened, the memoized @form is now stale.
|
|
112
|
+
@form = nil if needs_migration
|
|
113
|
+
end
|
|
114
|
+
|
|
97
115
|
##
|
|
98
116
|
# @api public
|
|
99
117
|
def delete(file_set:)
|
|
@@ -17,14 +17,14 @@ module Hyrax
|
|
|
17
17
|
|
|
18
18
|
def index
|
|
19
19
|
# The user's collections for the "add to collection" form
|
|
20
|
-
@user_collections = collections_service.
|
|
20
|
+
@user_collections = collections_service.all_search_results(:deposit)
|
|
21
21
|
|
|
22
22
|
add_breadcrumb t(:'hyrax.controls.home'), root_path
|
|
23
23
|
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
|
24
24
|
add_breadcrumb t(:'hyrax.admin.sidebar.works'), hyrax.my_works_path
|
|
25
25
|
managed_works_count
|
|
26
26
|
@create_work_presenter = create_work_presenter_class.new(current_user)
|
|
27
|
-
@admin_sets_for_select =
|
|
27
|
+
@admin_sets_for_select = helpers.available_admin_sets_for_creating_works(ability: current_ability)
|
|
28
28
|
super
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -48,25 +48,6 @@ module Hyrax
|
|
|
48
48
|
def managed_works_count
|
|
49
49
|
@managed_works_count = Hyrax::Works::ManagedWorksService.managed_works_count(scope: self)
|
|
50
50
|
end
|
|
51
|
-
|
|
52
|
-
def admin_sets_for_select
|
|
53
|
-
source_ids = Hyrax::Collections::PermissionsService.source_ids_for_deposit(ability: current_ability, source_type: 'admin_set')
|
|
54
|
-
|
|
55
|
-
admin_sets_list = Hyrax.query_service.find_many_by_ids(ids: source_ids).map do |source|
|
|
56
|
-
[source.title.first, source.id]
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# Sorts the default admin set to be first, then the rest by title.
|
|
60
|
-
admin_sets_list.sort do |a, b|
|
|
61
|
-
if Hyrax::AdminSetCreateService.default_admin_set?(id: a[1])
|
|
62
|
-
-1
|
|
63
|
-
elsif Hyrax::AdminSetCreateService.default_admin_set?(id: b[1])
|
|
64
|
-
1
|
|
65
|
-
else
|
|
66
|
-
a[0] <=> b[0]
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
51
|
end
|
|
71
52
|
end
|
|
72
53
|
end
|
|
@@ -27,8 +27,10 @@ module Hyrax
|
|
|
27
27
|
# copy visibility
|
|
28
28
|
VisibilityCopyJob.perform_later(curation_concern)
|
|
29
29
|
|
|
30
|
-
#
|
|
31
|
-
|
|
30
|
+
# Copy permissions for AF work
|
|
31
|
+
# Due to performance issues for a Hyrax::Resource in Fedora 6, permissions are copied
|
|
32
|
+
# during visibility copy instead of reloading and iterating again.
|
|
33
|
+
InheritPermissionsJob.perform_later(curation_concern) unless curation_concern.is_a?(Hyrax::Resource)
|
|
32
34
|
redirect_to [main_app, curation_concern], notice: I18n.t("hyrax.upload.change_access_flash_message")
|
|
33
35
|
end
|
|
34
36
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyrax
|
|
4
|
+
# See documentation/redirects.md for the redirects feature.
|
|
5
|
+
#
|
|
6
|
+
# Wired up as a catch-all route in the host application's `config/routes.rb`
|
|
7
|
+
# (see the install generator). Serves any path not claimed by an earlier
|
|
8
|
+
# route when the feature is active.
|
|
9
|
+
class RedirectsController < ApplicationController
|
|
10
|
+
def show
|
|
11
|
+
row = Hyrax::RedirectsLookup.find_row(params[:alias_path])
|
|
12
|
+
raise ActionController::RoutingError, 'Not Found' if row.blank?
|
|
13
|
+
|
|
14
|
+
if row.is_display_url?
|
|
15
|
+
dispatch_in_place(row)
|
|
16
|
+
else
|
|
17
|
+
redirect_to with_locale(row.to_path), status: :moved_permanently
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
# The visited path IS the display URL — render the resource's show
|
|
24
|
+
# page in place at the visited path. Use `recognize_path` to find
|
|
25
|
+
# the underlying curation-concern controller for the permalink, then
|
|
26
|
+
# dispatch the same request to it. Setting
|
|
27
|
+
# `request.env['hyrax.redirects.dispatched']` signals
|
|
28
|
+
# `Hyrax::RedirectToDisplayUrl` to skip its own redirect check on
|
|
29
|
+
# the inner controller's show action — otherwise the inner show
|
|
30
|
+
# would see the visited path, find the same row, and try to redirect
|
|
31
|
+
# back to itself.
|
|
32
|
+
def dispatch_in_place(row)
|
|
33
|
+
info = Rails.application.routes.recognize_path(row.permalink_path)
|
|
34
|
+
info[:locale] = params[:locale] if params[:locale].present?
|
|
35
|
+
controller_class = "#{info[:controller].camelize}Controller".constantize
|
|
36
|
+
request.path_parameters = info
|
|
37
|
+
request.env['hyrax.redirects.dispatched'] = true
|
|
38
|
+
controller_class.dispatch(info[:action], request, response)
|
|
39
|
+
# The inner controller wrote into the shared `response`; mark the outer
|
|
40
|
+
# action as performed so Rails skips its own implicit_render lookup.
|
|
41
|
+
self.response_body = response.body
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Carry the visitor's requested locale (set by Hyrax::Controller#set_locale
|
|
45
|
+
# from `params[:locale]`) across the 301 so the destination page renders in
|
|
46
|
+
# the same language. Appended as `?locale=<value>` so this works whether the
|
|
47
|
+
# host app uses path-prefix or query-string locales. The locale value is
|
|
48
|
+
# URL-encoded via Rack::Utils.build_query so attacker-controlled chars in
|
|
49
|
+
# params[:locale] can't inject extra query params into the Location header.
|
|
50
|
+
def with_locale(path)
|
|
51
|
+
return path if params[:locale].blank?
|
|
52
|
+
separator = path.include?('?') ? '&' : '?'
|
|
53
|
+
"#{path}#{separator}#{Rack::Utils.build_query(locale: params[:locale])}"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
module Hyrax
|
|
3
3
|
class SingleUseLinksViewerController < DownloadsController
|
|
4
|
-
include Blacklight::
|
|
4
|
+
include Blacklight::Configurable
|
|
5
|
+
include Blacklight::SearchContext
|
|
5
6
|
include Blacklight::AccessControls::Catalog
|
|
6
7
|
include ActionDispatch::Routing::PolymorphicRoutes
|
|
7
8
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hyrax
|
|
4
|
+
class TranscriptsController < DownloadsController
|
|
5
|
+
def show
|
|
6
|
+
# Using the extracted text from the index is blocked
|
|
7
|
+
# by https://github.com/samvera/hyrax/issues/7410, so we
|
|
8
|
+
# need to get the original file instead.
|
|
9
|
+
file_metadata = find_file_metadata(file_set: Hyrax.query_service.find_by(id: params.require(:id)))
|
|
10
|
+
file = Hyrax.storage_adapter.find_by(id: file_metadata.file_identifier)
|
|
11
|
+
|
|
12
|
+
prepare_file_headers_valkyrie(metadata: file_metadata, file: file)
|
|
13
|
+
response.headers['Access-Control-Allow-Origin'] = '*'
|
|
14
|
+
send_file file.disk_path, data_options(file_metadata)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def disposition
|
|
20
|
+
'inline'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def data_options(file_metadata)
|
|
24
|
+
{
|
|
25
|
+
type: "#{file_metadata.mime_type}; charset=utf-8",
|
|
26
|
+
filename: file_metadata.original_filename,
|
|
27
|
+
disposition: disposition
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -23,20 +23,29 @@ module Hyrax
|
|
|
23
23
|
def upload_with_chunking
|
|
24
24
|
@upload = Hyrax::UploadedFile.find(params[:id])
|
|
25
25
|
unpersisted_upload = Hyrax::UploadedFile.new(file: params[:files].first, user: current_user)
|
|
26
|
-
|
|
27
|
-
# Check if CONTENT-RANGE header is present
|
|
28
26
|
content_range = request.headers['CONTENT-RANGE']
|
|
29
|
-
return @upload.file = unpersisted_upload.file if content_range.nil?
|
|
30
27
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
if content_range
|
|
29
|
+
handle_chunk(content_range, unpersisted_upload.file)
|
|
30
|
+
else
|
|
31
|
+
@upload.file = unpersisted_upload.file
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def handle_chunk(content_range, chunk)
|
|
36
|
+
file_path = @upload.file.path
|
|
37
|
+
current_size = 0
|
|
38
|
+
File.open(file_path, "r") { |f| current_size = f.size } if file_path && File.exist?(file_path)
|
|
39
|
+
|
|
40
|
+
begin_of_chunk = content_range[/\ (.*?)-/, 1].to_i
|
|
34
41
|
|
|
35
|
-
# Add the following chunk to the incomplete upload
|
|
36
42
|
if @upload.file.present? && begin_of_chunk == current_size
|
|
37
|
-
File.open(
|
|
43
|
+
File.open(file_path, "ab") do |f|
|
|
44
|
+
f.write(chunk.read)
|
|
45
|
+
f.fsync
|
|
46
|
+
end
|
|
38
47
|
else
|
|
39
|
-
@upload.file =
|
|
48
|
+
@upload.file = chunk
|
|
40
49
|
end
|
|
41
50
|
end
|
|
42
51
|
end
|