hyrax 4.0.0 → 5.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +124 -232
- data/.dassie/.env +8 -2
- data/.dassie/Gemfile +27 -42
- data/.dassie/Gemfile.dassie +2 -0
- data/.dassie/app/assets/config/manifest.js +2 -0
- data/.dassie/app/assets/stylesheets/hyrax.scss +1 -0
- data/.dassie/config/environments/test.rb +1 -0
- data/.dassie/config/initializers/hyrax.rb +3 -1
- data/.dassie/config/initializers/riiif.rb +11 -7
- data/.dassie/config/metadata/collection_resource.yaml +3 -0
- data/.dassie/config/metadata/monograph.yaml +8 -0
- data/.dassie/config/metadata/sample_metadata.yaml +1 -0
- data/.dassie/config/redis.yml +2 -0
- data/.dassie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
- data/.dassie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
- data/.dassie/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.hyrax.rb +8 -0
- data/.dassie/db/migrate/20230821153635_add_fields_to_counter_metric.rb +8 -0
- data/.dassie/db/schema.rb +22 -3
- data/.dockerignore +7 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +10 -7
- data/.github/release.yml +5 -2
- data/.gitignore +1 -1
- data/.koppie/.env +13 -4
- data/.koppie/Gemfile +10 -12
- data/.koppie/Gemfile.koppie +2 -0
- data/.koppie/Rakefile +0 -2
- data/.koppie/app/models/ability.rb +1 -5
- data/.koppie/app/models/user.rb +0 -2
- data/.koppie/config/application.rb +2 -1
- data/.koppie/config/arkivo.yml +6 -0
- data/.koppie/config/blacklight.yml +2 -2
- data/.koppie/config/environments/test.rb +1 -0
- data/.koppie/config/features.yml +2 -0
- data/.koppie/config/initializers/1_valkyrie.rb +29 -6
- data/.koppie/config/initializers/arkivo_constraint.rb +12 -0
- data/.koppie/config/initializers/hyrax.rb +10 -4
- data/.koppie/config/initializers/riiif.rb +11 -7
- data/.koppie/config/metadata/collection_resource.yaml +49 -0
- data/.koppie/config/metadata/generic_work.yaml +2 -0
- data/.koppie/config/metadata/monograph.yaml +10 -0
- data/.koppie/config/role_map.yml +3 -25
- data/.koppie/config/routes.rb +1 -2
- data/.koppie/config/solr.yml +1 -1
- data/.koppie/config/valkyrie_index.yml +4 -10
- data/.koppie/config/zotero.yml +6 -0
- data/.koppie/db/migrate/20230725222727_create_hyrax_counter_metrics.hyrax.rb +14 -0
- data/.koppie/db/migrate/20230803165135_change_work_id_to_string.rb +5 -0
- data/.koppie/db/schema.rb +12 -1
- data/.koppie/yarn.lock +23 -23
- data/.regen +1 -1
- data/CONTAINERS.md +1 -3
- data/Dockerfile +17 -13
- data/Gemfile +4 -21
- data/Gemfile.dassie +2 -0
- data/Gemfile.koppie +2 -0
- data/README.md +0 -1
- data/Rakefile +0 -11
- data/app/actors/hyrax/actors/base_actor.rb +4 -3
- data/app/actors/hyrax/actors/embargo_actor.rb +3 -3
- data/app/actors/hyrax/actors/lease_actor.rb +5 -2
- data/app/assets/javascripts/hyrax/batch_select_all.js +1 -1
- data/app/assets/javascripts/hyrax/file_manager/member.es6 +1 -1
- data/app/assets/javascripts/hyrax/file_manager/sorting.es6 +3 -2
- data/app/assets/stylesheets/hyrax/_file-listing.scss +0 -2
- data/app/assets/stylesheets/hyrax/_work-show.scss +19 -3
- data/app/assets/stylesheets/hyrax/sidebar.scss +23 -0
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +8 -2
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +7 -1
- data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +79 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +64 -14
- data/app/controllers/hyrax/admin/workflows_controller.rb +48 -3
- data/app/controllers/hyrax/api/items_controller.rb +2 -3
- data/app/controllers/hyrax/batch_edits_controller.rb +39 -10
- data/app/controllers/hyrax/batch_uploads_controller.rb +5 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
- data/app/controllers/hyrax/downloads_controller.rb +8 -1
- data/app/controllers/hyrax/file_sets_controller.rb +50 -6
- data/app/controllers/hyrax/my/collections_controller.rb +2 -0
- data/app/controllers/hyrax/single_use_links_viewer_controller.rb +16 -2
- data/app/forms/concerns/hyrax/basic_metadata_form_fields_behavior.rb +38 -0
- data/app/forms/hyrax/forms/collection_form.rb +0 -15
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +0 -34
- data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
- data/app/forms/hyrax/forms/file_set_form.rb +2 -2
- data/app/forms/hyrax/forms/pcdm_object_form.rb +21 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +2 -7
- data/app/forms/hyrax/forms/resource_batch_edit_form.rb +118 -0
- data/app/forms/hyrax/forms/resource_form.rb +21 -34
- data/app/forms/hyrax/forms/work_embargo_form.rb +1 -0
- data/app/forms/hyrax/forms/work_form.rb +1 -1
- data/app/forms/hyrax/forms/work_lease_form.rb +1 -0
- data/app/helpers/hyrax/dashboard_helper_behavior.rb +30 -9
- data/app/helpers/hyrax/membership_helper.rb +13 -1
- data/app/helpers/hyrax/work_form_helper.rb +0 -107
- data/app/indexers/hyrax/file_set_indexer.rb +6 -0
- data/app/indexers/hyrax/location_indexer.rb +29 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +36 -5
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +9 -2
- data/app/inputs/controlled_vocabulary_input.rb +1 -1
- data/app/jobs/characterize_job.rb +1 -1
- data/app/jobs/create_work_job.rb +36 -4
- data/app/jobs/valkyrie_characterization_job.rb +9 -0
- data/app/jobs/valkyrie_create_derivatives_job.rb +8 -7
- data/app/jobs/valkyrie_ingest_job.rb +1 -4
- data/app/models/admin_set.rb +1 -31
- data/app/models/collection_branding_info.rb +2 -9
- data/app/models/concerns/hyrax/ability.rb +2 -1
- data/app/models/concerns/hyrax/collection_behavior.rb +4 -12
- data/app/models/concerns/hyrax/file_set/derivatives.rb +3 -2
- data/app/models/concerns/hyrax/riiif_file.rb +30 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +20 -3
- data/app/models/hyrax/collection_type.rb +5 -14
- data/app/models/hyrax/counter_metric.rb +7 -0
- data/app/models/hyrax/file_metadata.rb +9 -9
- data/app/models/hyrax/file_set.rb +76 -15
- data/app/models/hyrax/orcid_validator.rb +0 -6
- data/app/models/hyrax/resource.rb +30 -2
- data/app/models/hyrax/work.rb +2 -5
- data/app/presenters/hyrax/collection_presenter.rb +0 -17
- data/app/presenters/hyrax/embargo_presenter.rb +4 -0
- data/app/presenters/hyrax/file_set_presenter.rb +6 -0
- data/app/presenters/hyrax/iiif_manifest_presenter.rb +3 -7
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +6 -4
- data/app/presenters/hyrax/presenter_renderer.rb +0 -7
- data/app/presenters/hyrax/version_list_presenter.rb +19 -10
- data/app/presenters/hyrax/version_presenter.rb +19 -4
- data/app/presenters/hyrax/work_show_presenter.rb +6 -11
- data/app/search_builders/hyrax/file_set_search_builder.rb +1 -1
- data/app/search_builders/hyrax/valkyrie_abstract_type_relation.rb +37 -0
- data/app/search_builders/hyrax/valkyrie_work_relation.rb +9 -0
- data/app/services/hyrax/admin_set_create_service.rb +0 -17
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +16 -9
- data/app/services/hyrax/collections/collection_member_service.rb +1 -1
- data/app/services/hyrax/custom_queries/find_by_date_range.rb +55 -0
- data/app/services/hyrax/custom_queries/find_count_by.rb +62 -0
- data/app/services/hyrax/custom_queries/find_file_metadata.rb +1 -1
- data/app/services/hyrax/custom_queries/find_models_by_access.rb +59 -0
- data/app/services/hyrax/derivative_bucketed_storage.rb +25 -0
- data/app/services/hyrax/derivative_path.rb +14 -4
- data/app/services/hyrax/embargo_manager.rb +106 -13
- data/app/services/hyrax/embargo_service.rb +12 -10
- data/app/services/hyrax/file_set_derivatives_service.rb +14 -13
- data/app/services/hyrax/fixity_check_failure_service.rb +1 -1
- data/app/services/hyrax/identifier/dispatcher.rb +9 -2
- data/app/services/hyrax/lease_manager.rb +88 -8
- data/app/services/hyrax/listeners/file_metadata_listener.rb +16 -8
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +2 -28
- data/app/services/hyrax/listeners/metadata_index_listener.rb +11 -0
- data/app/services/hyrax/listeners/workflow_listener.rb +8 -11
- data/app/services/hyrax/lock_manager.rb +1 -2
- data/app/services/hyrax/persist_directly_contained_output_file_service.rb +24 -2
- data/app/services/hyrax/riiif_file_resolver.rb +50 -0
- data/app/services/hyrax/simple_schema_loader.rb +31 -0
- data/app/services/hyrax/solr_query_service.rb +7 -6
- data/app/services/hyrax/statistics/depositors/summary.rb +1 -1
- data/app/services/hyrax/statistics/over_time.rb +1 -1
- data/app/services/hyrax/statistics/users/over_time.rb +3 -1
- data/app/services/hyrax/statistics/valkyrie_query_service.rb +49 -0
- data/app/services/hyrax/statistics/works/count.rb +1 -1
- data/app/services/hyrax/thumbnail_path_service.rb +5 -0
- data/app/services/hyrax/valkyrie_persist_derivatives.rb +16 -11
- data/app/services/hyrax/valkyrie_upload.rb +16 -28
- data/app/services/hyrax/versioning_service.rb +30 -15
- data/app/services/hyrax/visibility_intention.rb +1 -4
- data/app/services/hyrax/visibility_propagator.rb +1 -1
- data/app/services/hyrax/work_uploads_handler.rb +1 -1
- data/app/services/hyrax/workflow/actionable_objects.rb +28 -3
- data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +1 -1
- data/app/services/hyrax/workflow/grant_read_to_depositor.rb +1 -1
- data/app/services/hyrax/workflow/permission_query.rb +23 -2
- data/app/validators/hyrax/collection_membership_validator.rb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/admin/workflows/_tabs.html.erb +9 -0
- data/app/views/hyrax/admin/workflows/index.html.erb +53 -76
- data/app/views/hyrax/base/_file_manager_members.html.erb +2 -2
- data/app/views/hyrax/base/_file_manager_resource_form.html.erb +1 -1
- data/app/views/hyrax/base/_form.html.erb +0 -10
- data/app/views/hyrax/base/_form_permission_embargo.html.erb +1 -1
- data/app/views/hyrax/base/_form_permission_lease.html.erb +1 -1
- data/app/views/hyrax/base/_form_visibility_component.html.erb +4 -4
- data/app/views/hyrax/base/_items.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +1 -1
- data/app/views/hyrax/base/_workflow_actions.html.erb +25 -23
- data/app/views/hyrax/base/file_manager.html.erb +1 -1
- data/app/views/hyrax/base/show.json.jbuilder +4 -3
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +3 -3
- data/app/views/hyrax/file_sets/_versioning.html.erb +5 -5
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +4 -4
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +2 -2
- data/app/views/hyrax/file_sets/show.html.erb +5 -3
- data/app/views/hyrax/homepage/_explore_collections.html.erb +1 -1
- data/app/views/hyrax/my/_search_form.html.erb +1 -1
- data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
- data/app/views/hyrax/users/_vitals.html.erb +1 -1
- data/bin/dev-entrypoint.sh +13 -0
- data/chart/hyrax/Chart.yaml +18 -14
- data/chart/hyrax/README.md +34 -21
- data/chart/hyrax/templates/_helpers.tpl +34 -1
- data/chart/hyrax/templates/configmap-env.yaml +12 -2
- data/chart/hyrax/templates/secrets.yaml +1 -1
- data/chart/hyrax/values.yaml +39 -14
- data/config/initializers/file_length_patch.rb +10 -0
- data/config/initializers/listeners.rb +4 -10
- data/config/initializers/storage_adapter_initializer.rb +1 -1
- data/config/locales/hyrax.en.yml +8 -0
- data/config/metadata/basic_metadata.yaml +52 -0
- data/config/metadata/core_metadata.yaml +4 -0
- data/config/metadata/file_set_metadata.yaml +20 -1
- data/config/metadata/hyrax_internal_metadata.yaml +57 -0
- data/docker-compose-koppie.yml +36 -22
- data/docker-compose-sirenia.yml +202 -0
- data/docker-compose.yml +42 -26
- data/documentation/developing-your-hyrax-based-app.md +6 -14
- data/documentation/legacyREADME.md +3 -1
- data/hyrax.gemspec +12 -13
- data/karma.conf.js +9 -10
- data/lib/generators/hyrax/collection_resource/templates/collection_metadata.yaml +2 -0
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +1 -1
- data/lib/generators/hyrax/templates/config/initializers/riiif.rb +11 -7
- data/lib/generators/hyrax/templates/db/migrate/20230725222727_create_hyrax_counter_metrics.rb.erb +14 -0
- data/lib/generators/hyrax/templates/db/migrate/20230803165135_change_work_id_to_string.rb.erb +5 -0
- data/lib/generators/hyrax/templates/db/migrate/20230808102105_add_indices_to_hyrax_counter_metrics.rb.erb +8 -0
- data/lib/generators/hyrax/templates/db/migrate/20230821153635_add_fields_to_counter_metric.rb.erb +8 -0
- data/lib/generators/hyrax/templates/db/seeds.rb +1 -1
- data/lib/generators/hyrax/work_resource/templates/form.rb.erb +1 -1
- data/lib/generators/hyrax/work_resource/templates/metadata.yaml +2 -0
- data/lib/hyrax/active_fedora_dummy_model.rb +6 -1
- data/lib/hyrax/configuration.rb +147 -43
- data/lib/hyrax/controlled_vocabularies/location.rb +7 -1
- data/lib/hyrax/engine.rb +2 -1
- data/lib/hyrax/form_fields.rb +6 -0
- data/lib/hyrax/publisher.rb +23 -3
- data/lib/hyrax/redis_event_store.rb +7 -8
- data/lib/hyrax/resource_name.rb +4 -0
- data/lib/hyrax/specs/capybara.rb +25 -37
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +34 -7
- data/lib/hyrax/specs/shared_specs/indexers.rb +24 -6
- data/lib/hyrax/transactions/collection_destroy.rb +3 -2
- data/lib/hyrax/transactions/container.rb +47 -0
- data/lib/hyrax/transactions/file_metadata_destroy.rb +20 -0
- data/lib/hyrax/transactions/file_set_destroy.rb +3 -1
- data/lib/hyrax/transactions/file_set_update.rb +21 -0
- data/lib/hyrax/transactions/steps/add_file_sets.rb +6 -0
- data/lib/hyrax/transactions/steps/add_to_parent.rb +1 -1
- data/lib/hyrax/transactions/steps/apply_permission_template.rb +40 -0
- data/lib/hyrax/transactions/steps/delete_all_file_metadata.rb +46 -0
- data/lib/hyrax/transactions/steps/delete_all_file_sets.rb +46 -0
- data/lib/hyrax/transactions/steps/file_metadata_delete.rb +40 -0
- data/lib/hyrax/transactions/steps/remove_from_membership.rb +45 -0
- data/lib/hyrax/transactions/steps/save.rb +21 -0
- data/lib/hyrax/transactions/work_create.rb +1 -0
- data/lib/hyrax/transactions/work_destroy.rb +3 -2
- data/lib/hyrax/version.rb +1 -1
- data/lib/hyrax.rb +1 -0
- data/lib/tasks/collection_type_global_id.rake +9 -4
- data/lib/tasks/embargo_lease.rake +1 -0
- data/lib/valkyrie/indexing/solr/indexing_adapter.rb +2 -0
- data/lib/wings/active_fedora_converter/default_work.rb +7 -2
- data/lib/wings/active_fedora_converter/file_metadata_node.rb +1 -1
- data/lib/wings/active_fedora_converter.rb +53 -11
- data/lib/wings/attribute_transformer.rb +24 -17
- data/lib/wings/model_transformer.rb +23 -12
- data/lib/wings/orm_converter.rb +23 -18
- data/lib/wings/setup.rb +23 -3
- data/lib/wings/valkyrie/persister.rb +4 -2
- data/lib/wings/valkyrie/storage.rb +8 -90
- data/lib/wings.rb +5 -0
- data/package.json +3 -1
- data/tasks/hyrax_dev.rake +2 -33
- data/template.rb +1 -1
- metadata +104 -81
- data/.engine_cart.yml +0 -3
- data/app/forms/hyrax/forms/file_manager_form.rb +0 -35
- data/app/services/hyrax/collections/migration_service.rb +0 -113
- data/app/views/hyrax/base/_form_collections_error.html.erb +0 -1
- data/app/views/hyrax/base/_form_in_works_error.html.erb +0 -3
- data/app/views/hyrax/base/_form_ordered_members_error.html.erb +0 -3
- data/app/views/hyrax/base/_form_visibility_error.html.erb +0 -19
- data/app/views/hyrax/users/_user_util_links_extra.html.erb +0 -0
- data/lib/hyrax/specs/shared_specs/valkyrie_storage_versions.rb +0 -9
@@ -14,9 +14,9 @@ module Hyrax
|
|
14
14
|
def destroy
|
15
15
|
case work
|
16
16
|
when Valkyrie::Resource
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
Hyrax::EmbargoManager.deactivate_embargo_for(resource: work) &&
|
18
|
+
Hyrax.persister.save(resource: work.embargo) &&
|
19
|
+
Hyrax::AccessControlList(work).save
|
20
20
|
else
|
21
21
|
work.embargo_visibility! # If the embargo has lapsed, update the current visibility.
|
22
22
|
work.deactivate_embargo!
|
@@ -15,8 +15,11 @@ module Hyrax
|
|
15
15
|
case work
|
16
16
|
when Valkyrie::Resource
|
17
17
|
lease_manager = Hyrax::LeaseManager.new(resource: work)
|
18
|
-
|
19
|
-
|
18
|
+
return if lease_manager.lease.lease_expiration_date.blank?
|
19
|
+
|
20
|
+
lease_manager.deactivate!
|
21
|
+
work.lease = Hyrax.persister.save(resource: lease_manager.lease)
|
22
|
+
Hyrax::AccessControlList(work).save
|
20
23
|
else
|
21
24
|
work.lease_visibility! # If the lease has lapsed, update the current visibility.
|
22
25
|
work.deactivate_lease!
|
@@ -41,7 +41,7 @@
|
|
41
41
|
var checked = $("#check_all")[0]['checked'];
|
42
42
|
|
43
43
|
// check each individual box
|
44
|
-
$("input[type='checkbox'].batch_document_selector").each(function(index, value) {
|
44
|
+
$("input[type='checkbox'].batch_document_selector:not(.disabled)").each(function(index, value) {
|
45
45
|
value['checked'] = checked;
|
46
46
|
});
|
47
47
|
toggleButtons();
|
@@ -10,7 +10,7 @@ export class InputTracker {
|
|
10
10
|
this.notifier = notifier
|
11
11
|
this.element.data("initial-value", this.element.val())
|
12
12
|
this.element.data("tracker", this)
|
13
|
-
this.element.
|
13
|
+
this.element.on("change", this.value_changed)
|
14
14
|
}
|
15
15
|
|
16
16
|
reset() {
|
@@ -4,6 +4,7 @@ export default class SortManager {
|
|
4
4
|
this.sorting_info = {}
|
5
5
|
this.initialize_sort()
|
6
6
|
this.element.data("current-order", this.order)
|
7
|
+
this.sort_property = this.element.data("sort-property")
|
7
8
|
this.save_manager = save_manager
|
8
9
|
this.initialize_alpha_sort_button()
|
9
10
|
}
|
@@ -38,9 +39,9 @@ export default class SortManager {
|
|
38
39
|
params() {
|
39
40
|
let params = {}
|
40
41
|
params[this.singular_class_name] = {
|
41
|
-
"version": this.version
|
42
|
-
"ordered_member_ids": this.order
|
42
|
+
"version": this.version
|
43
43
|
}
|
44
|
+
params[this.singular_class_name][this.sort_property] = this.order
|
44
45
|
params["_method"] = "PATCH"
|
45
46
|
return params
|
46
47
|
}
|
@@ -116,6 +116,21 @@ ul.tabular {
|
|
116
116
|
background: #fff;
|
117
117
|
border-color: #e0e0e0;
|
118
118
|
|
119
|
+
& > .btn {
|
120
|
+
padding: 0;
|
121
|
+
border: 0;
|
122
|
+
}
|
123
|
+
|
124
|
+
.btn-primary {
|
125
|
+
margin-bottom: 1rem;
|
126
|
+
}
|
127
|
+
|
128
|
+
.workflow-comments {
|
129
|
+
label {
|
130
|
+
font-weight: bold;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
119
134
|
.card-header {
|
120
135
|
background-color: #e6ab5f;
|
121
136
|
color: #ffffff;
|
@@ -128,8 +143,9 @@ ul.tabular {
|
|
128
143
|
.card-body {
|
129
144
|
background-color: #f2f1eb;
|
130
145
|
}
|
131
|
-
}
|
132
146
|
|
133
|
-
.workflow-actions {
|
134
|
-
|
147
|
+
.workflow-actions {
|
148
|
+
background-color: #f8f8f8;
|
149
|
+
padding: 1rem;
|
150
|
+
}
|
135
151
|
}
|
@@ -56,6 +56,29 @@ $gutter-width: $grid-gutter-width/2;
|
|
56
56
|
}
|
57
57
|
}
|
58
58
|
|
59
|
+
&:not(.maximized) {
|
60
|
+
.sidebar-action-text,
|
61
|
+
a span + span,
|
62
|
+
h5 {
|
63
|
+
display: none;
|
64
|
+
}
|
65
|
+
|
66
|
+
.nav li {
|
67
|
+
text-align: center;
|
68
|
+
a {
|
69
|
+
padding-left: 0;
|
70
|
+
padding-right: 0;
|
71
|
+
}
|
72
|
+
.fa {
|
73
|
+
margin-right: 0;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
.nav-item {
|
78
|
+
width: $drawer-small;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
59
82
|
.sidebar-toggle {
|
60
83
|
cursor: pointer;
|
61
84
|
background-color: $body-background-color;
|
@@ -15,7 +15,7 @@ module Hyrax
|
|
15
15
|
# Removes a single embargo
|
16
16
|
def destroy
|
17
17
|
Hyrax::Actors::EmbargoActor.new(curation_concern).destroy
|
18
|
-
flash[:notice] = embargo_history(curation_concern)
|
18
|
+
flash[:notice] = embargo_history(curation_concern).last
|
19
19
|
if curation_concern.work? && work_has_file_set_members?(curation_concern)
|
20
20
|
redirect_to confirm_permission_path
|
21
21
|
else
|
@@ -31,7 +31,13 @@ module Hyrax
|
|
31
31
|
filter_docs_with_edit_access!
|
32
32
|
copy_visibility = []
|
33
33
|
copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] } if params[:embargoes]
|
34
|
-
|
34
|
+
|
35
|
+
resources = if Hyrax.config.use_valkyrie?
|
36
|
+
Hyrax.query_service.find_many_by_ids(ids: batch)
|
37
|
+
else
|
38
|
+
Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
|
39
|
+
end
|
40
|
+
|
35
41
|
resources.each do |resource|
|
36
42
|
if Hyrax.config.use_valkyrie?
|
37
43
|
EmbargoManager.new(resource: resource).release!
|
@@ -29,7 +29,13 @@ module Hyrax
|
|
29
29
|
filter_docs_with_edit_access!
|
30
30
|
copy_visibility = []
|
31
31
|
copy_visibility = params[:leases].values.map { |h| h[:copy_visibility] } if params[:leases]
|
32
|
-
|
32
|
+
|
33
|
+
resources = if Hyrax.config.use_valkyrie?
|
34
|
+
Hyrax.query_service.find_many_by_ids(ids: batch)
|
35
|
+
else
|
36
|
+
Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
|
37
|
+
end
|
38
|
+
|
33
39
|
resources.each do |resource|
|
34
40
|
if Hyrax.config.use_valkyrie?
|
35
41
|
LeaseManager.new(resource: resource).release!
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
module ValkyrieDownloadsControllerBehavior
|
4
|
+
def show_valkyrie
|
5
|
+
file_set_id = params.require(:id)
|
6
|
+
file_set = Hyrax.query_service.find_by(id: file_set_id)
|
7
|
+
send_file_contents_valkyrie(file_set)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def send_file_contents_valkyrie(file_set)
|
13
|
+
response.headers["Accept-Ranges"] = "bytes"
|
14
|
+
self.status = 200
|
15
|
+
use = params.fetch(:file, :original_file).to_sym
|
16
|
+
mime_type = params[:mime_type]
|
17
|
+
file_metadata = find_file_metadata(file_set: file_set, use: use, mime_type: mime_type)
|
18
|
+
return unless stale?(last_modified: file_metadata.updated_at, template: false)
|
19
|
+
|
20
|
+
file = Valkyrie::StorageAdapter.find_by(id: file_metadata.file_identifier)
|
21
|
+
prepare_file_headers_valkyrie(metadata: file_metadata, file: file)
|
22
|
+
|
23
|
+
# Warning - using the range header will load the range selection in to memory
|
24
|
+
# this can cause memory bloat
|
25
|
+
if request.headers['Range']
|
26
|
+
file.rewind
|
27
|
+
send_data send_range_valkyrie(file: file), data_options(file_metadata)
|
28
|
+
else
|
29
|
+
send_file file.disk_path, data_options(file_metadata).except(:status)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def data_options(file_metadata)
|
34
|
+
{
|
35
|
+
type: file_metadata.mime_type,
|
36
|
+
filename: file_metadata.original_filename,
|
37
|
+
disposition: "inline",
|
38
|
+
status: status
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def send_range_valkyrie(file:)
|
43
|
+
_, range = request.headers['Range'].split('bytes=')
|
44
|
+
from, to = range.split('-').map(&:to_i)
|
45
|
+
to = file.size - 1 unless to
|
46
|
+
length = to - from + 1
|
47
|
+
response.headers['Content-Range'] = "bytes #{from}-#{to}/#{file.size}"
|
48
|
+
response.headers['Content-Length'] = length.to_s
|
49
|
+
self.status = 206
|
50
|
+
file.read from # Seek to start of requested range
|
51
|
+
file.read length
|
52
|
+
end
|
53
|
+
|
54
|
+
def prepare_file_headers_valkyrie(metadata:, file:, inline: false)
|
55
|
+
inline_display = ActiveRecord::Type::Boolean.new.cast(params.fetch(:inline, inline))
|
56
|
+
response.headers["Content-Disposition"] = "#{inline_display ? 'inline' : 'attachment'}; filename=#{metadata.original_filename}"
|
57
|
+
response.headers["Content-Type"] = metadata.mime_type
|
58
|
+
response.headers["Content-Length"] ||= (file.try(:size) || metadata.size.first).to_s
|
59
|
+
# Prevent Rack::ETag from calculating a digest over body
|
60
|
+
response.headers["Last-Modified"] = metadata.updated_at.utc.strftime("%a, %d %b %Y %T GMT")
|
61
|
+
self.content_type = metadata.mime_type
|
62
|
+
end
|
63
|
+
|
64
|
+
def find_file_metadata(file_set:, use: :original_file, mime_type: nil)
|
65
|
+
if mime_type.nil?
|
66
|
+
use = :thumbnail_file if use == :thumbnail
|
67
|
+
use = Hyrax::FileMetadata::Use.uri_for(use: use)
|
68
|
+
results = Hyrax.custom_queries.find_many_file_metadata_by_use(resource: file_set, use: use)
|
69
|
+
else
|
70
|
+
files = Hyrax.custom_queries.find_files(file_set: file_set)
|
71
|
+
results = [files.find { |f| f.mime_type == mime_type }]
|
72
|
+
end
|
73
|
+
|
74
|
+
results.first || raise(Hyrax::ObjectNotFoundError)
|
75
|
+
rescue ArgumentError
|
76
|
+
raise(Hyrax::ObjectNotFoundError)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -79,14 +79,11 @@ module Hyrax
|
|
79
79
|
wants.html { presenter && parent_presenter }
|
80
80
|
wants.json do
|
81
81
|
# load @curation_concern manually because it's skipped for html
|
82
|
-
@curation_concern =
|
82
|
+
@curation_concern = load_curation_concern
|
83
83
|
curation_concern # This is here for authorization checks (we could add authorize! but let's use the same method for CanCanCan)
|
84
84
|
render :show, status: :ok
|
85
85
|
end
|
86
86
|
additional_response_formats(wants)
|
87
|
-
wants.ttl { render body: presenter.export_as_ttl, mime_type: Mime[:ttl] }
|
88
|
-
wants.jsonld { render body: presenter.export_as_jsonld, mime_type: Mime[:jsonld] }
|
89
|
-
wants.nt { render body: presenter.export_as_nt, mime_type: Mime[:nt] }
|
90
87
|
end
|
91
88
|
end
|
92
89
|
# rubocop:enable Metrics/AbcSize
|
@@ -114,9 +111,9 @@ module Hyrax
|
|
114
111
|
Hyrax.config.callback.run(:after_destroy, curation_concern.id, current_user, warn: false)
|
115
112
|
else
|
116
113
|
transactions['work_resource.destroy']
|
117
|
-
.with_step_args('work_resource.delete' => { user: current_user }
|
118
|
-
|
119
|
-
.value!
|
114
|
+
.with_step_args('work_resource.delete' => { user: current_user },
|
115
|
+
'work_resource.delete_all_file_sets' => { user: current_user })
|
116
|
+
.call(curation_concern).value!
|
120
117
|
|
121
118
|
title = Array(curation_concern.title).first
|
122
119
|
end
|
@@ -125,7 +122,7 @@ module Hyrax
|
|
125
122
|
end
|
126
123
|
|
127
124
|
def file_manager
|
128
|
-
@form =
|
125
|
+
@form = presenter
|
129
126
|
end
|
130
127
|
|
131
128
|
def inspect_work
|
@@ -139,13 +136,20 @@ module Hyrax
|
|
139
136
|
json = iiif_manifest_builder.manifest_for(presenter: iiif_manifest_presenter)
|
140
137
|
|
141
138
|
respond_to do |wants|
|
142
|
-
wants.
|
143
|
-
wants.html { render json: json }
|
139
|
+
wants.any { render json: json }
|
144
140
|
end
|
145
141
|
end
|
146
142
|
|
147
143
|
private
|
148
144
|
|
145
|
+
def load_curation_concern
|
146
|
+
if Hyrax.config.disable_wings
|
147
|
+
Hyrax.query_service.find_by(id: params[:id])
|
148
|
+
else
|
149
|
+
Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: params[:id])
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
149
153
|
def iiif_manifest_builder
|
150
154
|
self.class.iiif_manifest_builder ||
|
151
155
|
(Flipflop.cache_work_iiif_manifest? ? Hyrax::CachingIiifManifestBuilder.new : Hyrax::ManifestBuilderService.new)
|
@@ -180,15 +184,18 @@ module Hyrax
|
|
180
184
|
|
181
185
|
##
|
182
186
|
# @return [#errors]
|
187
|
+
# rubocop:disable Metrics/MethodLength
|
183
188
|
def create_valkyrie_work
|
184
189
|
form = build_form
|
185
|
-
|
190
|
+
# fallback to an empty hash to avoid: # NoMethodError: undefined method `has_key?` for nil:NilClass
|
191
|
+
original_input_params_for_form = params[hash_key_for_curation_concern] ? params[hash_key_for_curation_concern] : {}
|
192
|
+
return after_create_error(form_err_msg(form), original_input_params_for_form) unless form.validate(original_input_params_for_form)
|
186
193
|
|
187
194
|
result =
|
188
195
|
transactions['change_set.create_work']
|
189
196
|
.with_step_args(
|
190
197
|
'work_resource.add_to_parent' => { parent_id: params[:parent_id], user: current_user },
|
191
|
-
'work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params:
|
198
|
+
'work_resource.add_file_sets' => { uploaded_files: uploaded_files, file_set_params: original_input_params_for_form[:file_set] },
|
192
199
|
'change_set.set_user_as_depositor' => { user: current_user },
|
193
200
|
'work_resource.change_depositor' => { user: ::User.find_by_user_key(form.on_behalf_of) },
|
194
201
|
'work_resource.save_acl' => { permissions_params: form.input_params["permissions"] }
|
@@ -197,6 +204,7 @@ module Hyrax
|
|
197
204
|
@curation_concern = result.value_or { return after_create_error(transaction_err_msg(result)) }
|
198
205
|
after_create_response
|
199
206
|
end
|
207
|
+
# rubocop:enable Metrics/MethodLength
|
200
208
|
|
201
209
|
def update_valkyrie_work
|
202
210
|
form = build_form
|
@@ -370,10 +378,15 @@ module Hyrax
|
|
370
378
|
end
|
371
379
|
end
|
372
380
|
|
381
|
+
def format_error_messages(errors)
|
382
|
+
# the error may already be a string
|
383
|
+
errors.respond_to?(:messages) ? errors.messages.values.flatten.join("\n") : errors
|
384
|
+
end
|
385
|
+
|
373
386
|
def after_create_error(errors, original_input_params_for_form = nil)
|
374
387
|
respond_to do |wants|
|
375
388
|
wants.html do
|
376
|
-
flash[:error] = errors
|
389
|
+
flash[:error] = format_error_messages(errors)
|
377
390
|
rebuild_form(original_input_params_for_form) if original_input_params_for_form.present?
|
378
391
|
render 'new', status: :unprocessable_entity
|
379
392
|
end
|
@@ -402,7 +415,7 @@ module Hyrax
|
|
402
415
|
def after_update_error(errors)
|
403
416
|
respond_to do |wants|
|
404
417
|
wants.html do
|
405
|
-
flash[:error] = errors
|
418
|
+
flash[:error] = format_error_messages(errors)
|
406
419
|
build_form unless @form.is_a? Hyrax::ChangeSet
|
407
420
|
render 'edit', status: :unprocessable_entity
|
408
421
|
end
|
@@ -418,6 +431,13 @@ module Hyrax
|
|
418
431
|
end
|
419
432
|
|
420
433
|
def additional_response_formats(format)
|
434
|
+
respond_to_endnote(format)
|
435
|
+
respond_to_ttl(format)
|
436
|
+
respond_to_jsonld(format)
|
437
|
+
respond_to_nt(format)
|
438
|
+
end
|
439
|
+
|
440
|
+
def respond_to_endnote(format)
|
421
441
|
format.endnote do
|
422
442
|
send_data(presenter.solr_document.export_as_endnote,
|
423
443
|
type: "application/x-endnote-refer",
|
@@ -425,6 +445,36 @@ module Hyrax
|
|
425
445
|
end
|
426
446
|
end
|
427
447
|
|
448
|
+
def respond_to_ttl(format)
|
449
|
+
format.ttl do
|
450
|
+
if presenter.valkyrie_presenter?
|
451
|
+
render plain: "Error: Not Implemented", status: :not_implemented
|
452
|
+
else
|
453
|
+
render body: presenter.export_as_ttl, mime_type: Mime[:ttl]
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
def respond_to_jsonld(format)
|
459
|
+
format.jsonld do
|
460
|
+
if presenter.valkyrie_presenter?
|
461
|
+
render plain: "Error: Not Implemented", status: :not_implemented
|
462
|
+
else
|
463
|
+
render body: presenter.export_as_jsonld, mime_type: Mime[:jsonld]
|
464
|
+
end
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
468
|
+
def respond_to_nt(format)
|
469
|
+
format.nt do
|
470
|
+
if presenter.valkyrie_presenter?
|
471
|
+
render plain: "Error: Not Implemented", status: :not_implemented
|
472
|
+
else
|
473
|
+
render body: presenter.export_as_nt, mime_type: Mime[:nt]
|
474
|
+
end
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
428
478
|
def save_permissions
|
429
479
|
@saved_permissions =
|
430
480
|
case curation_concern
|
@@ -15,9 +15,8 @@ module Hyrax
|
|
15
15
|
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
16
16
|
add_breadcrumb t(:'hyrax.admin.sidebar.tasks'), '#'
|
17
17
|
add_breadcrumb t(:'hyrax.admin.sidebar.workflow_review'), request.path
|
18
|
-
|
19
|
-
@
|
20
|
-
@published_list = actionable_objects.select(&:published?)
|
18
|
+
assign_action_objects_params
|
19
|
+
@response = WorkflowResponse.new(actionable_objects.to_a, actionable_objects.total_count, current_page, per_page, under_review?)
|
21
20
|
end
|
22
21
|
|
23
22
|
private
|
@@ -30,5 +29,51 @@ module Hyrax
|
|
30
29
|
@actionable_objects ||=
|
31
30
|
Hyrax::Workflow::ActionableObjects.new(user: current_user)
|
32
31
|
end
|
32
|
+
|
33
|
+
def current_page
|
34
|
+
@page ||= params.fetch('page', 1).to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
def per_page
|
38
|
+
@per_page ||= params.fetch('per_page', 10).to_i
|
39
|
+
end
|
40
|
+
|
41
|
+
def assign_action_objects_params
|
42
|
+
actionable_objects.page = current_page
|
43
|
+
actionable_objects.per_page = per_page
|
44
|
+
actionable_objects.workflow_state_filter = (under_review? ? '!' : '') + deposited_workflow_state_name
|
45
|
+
end
|
46
|
+
|
47
|
+
def under_review?
|
48
|
+
@under_review = params['state'] != 'published'
|
49
|
+
end
|
50
|
+
|
51
|
+
class WorkflowResponse
|
52
|
+
attr_reader :total_count
|
53
|
+
attr_reader :current_page
|
54
|
+
attr_reader :per_page
|
55
|
+
attr_reader :docs
|
56
|
+
attr_reader :under_review
|
57
|
+
|
58
|
+
def initialize(docs, total_count, page, per_page, under_review)
|
59
|
+
@docs = docs
|
60
|
+
@total_count = total_count
|
61
|
+
@per_page = per_page.to_i
|
62
|
+
@current_page = page.to_i
|
63
|
+
@under_review = under_review
|
64
|
+
end
|
65
|
+
|
66
|
+
def total_pages
|
67
|
+
(total_count.to_f / per_page).ceil
|
68
|
+
end
|
69
|
+
|
70
|
+
def limit_value
|
71
|
+
docs.length
|
72
|
+
end
|
73
|
+
|
74
|
+
def viewing_under_review?
|
75
|
+
under_review
|
76
|
+
end
|
77
|
+
end
|
33
78
|
end
|
34
79
|
end
|
@@ -33,12 +33,11 @@ module Hyrax
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def my_load_and_authorize_resource
|
36
|
-
@work = Hyrax
|
37
|
-
|
36
|
+
@work = Hyrax.query_service.find_by(id: params[:id])
|
38
37
|
return render plain: "#{user} lacks access to #{@work}", status: :unauthorized unless user.can? :edit, @work
|
39
38
|
|
40
39
|
return render plain: "Forbidden: #{@work} not deposited via Arkivo", status: :forbidden if @work.arkivo_checksum.nil?
|
41
|
-
rescue ActiveFedora::ObjectNotFoundError
|
40
|
+
rescue ActiveFedora::ObjectNotFoundError, Valkyrie::Persistence::ObjectNotFoundError
|
42
41
|
render plain: "id '#{params[:id]}' not found", status: :not_found
|
43
42
|
end
|
44
43
|
|
@@ -41,9 +41,9 @@ module Hyrax
|
|
41
41
|
batch.each do |doc_id|
|
42
42
|
resource = Hyrax.query_service.find_by(id: Valkyrie::ID.new(doc_id))
|
43
43
|
transactions['collection_resource.destroy']
|
44
|
-
.with_step_args('collection_resource.delete' => { user: current_user }
|
45
|
-
|
46
|
-
.value!
|
44
|
+
.with_step_args('collection_resource.delete' => { user: current_user },
|
45
|
+
'collection_resource.remove_from_membership' => { user: current_user })
|
46
|
+
.call(resource).value!
|
47
47
|
end
|
48
48
|
flash[:notice] = "Batch delete complete"
|
49
49
|
after_destroy_collection
|
@@ -52,7 +52,7 @@ module Hyrax
|
|
52
52
|
def update_document(obj)
|
53
53
|
interpret_visiblity_params(obj)
|
54
54
|
obj.attributes = work_params(admin_set_id: obj.admin_set_id).except(*visibility_params)
|
55
|
-
obj.date_modified =
|
55
|
+
obj.date_modified = TimeService.time_in_utc
|
56
56
|
|
57
57
|
InheritPermissionsJob.perform_now(obj)
|
58
58
|
VisibilityCopyJob.perform_now(obj)
|
@@ -60,11 +60,30 @@ module Hyrax
|
|
60
60
|
obj.save
|
61
61
|
end
|
62
62
|
|
63
|
+
def valkyrie_update_document(obj)
|
64
|
+
form = form_class.new(obj, current_ability, nil)
|
65
|
+
return unless form.validate(params[form_class.model_class.model_name.param_key])
|
66
|
+
|
67
|
+
cleanup_form_fields form
|
68
|
+
|
69
|
+
result = transactions['change_set.update_work']
|
70
|
+
.with_step_args('work_resource.save_acl' => { permissions_params: form.input_params["permissions"] })
|
71
|
+
.call(form)
|
72
|
+
obj = result.value!
|
73
|
+
|
74
|
+
InheritPermissionsJob.perform_now(obj)
|
75
|
+
VisibilityCopyJob.perform_now(obj)
|
76
|
+
end
|
77
|
+
|
63
78
|
def update
|
64
79
|
case params["update_type"]
|
65
80
|
when "update"
|
66
81
|
batch.each do |doc_id|
|
67
|
-
|
82
|
+
if Hyrax.config.use_valkyrie?
|
83
|
+
valkyrie_update_document(Hyrax.query_service.find_by(id: doc_id))
|
84
|
+
else
|
85
|
+
update_document(Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: doc_id, use_valkyrie: false))
|
86
|
+
end
|
68
87
|
end
|
69
88
|
flash[:notice] = "Batch update complete"
|
70
89
|
after_update
|
@@ -89,15 +108,15 @@ module Hyrax
|
|
89
108
|
batch.each do |id|
|
90
109
|
resource = Hyrax.query_service.find_by(id: Valkyrie::ID.new(id))
|
91
110
|
transactions['work_resource.destroy']
|
92
|
-
.with_step_args('work_resource.delete' => { user: current_user }
|
93
|
-
|
94
|
-
.value!
|
111
|
+
.with_step_args('work_resource.delete' => { user: current_user },
|
112
|
+
'work_resource.delete_all_file_sets' => { user: current_user })
|
113
|
+
.call(resource).value!
|
95
114
|
end
|
96
115
|
after_update
|
97
116
|
end
|
98
117
|
|
99
118
|
def form_class
|
100
|
-
Forms::BatchEditForm
|
119
|
+
Hyrax.config.use_valkyrie? ? Forms::ResourceBatchEditForm : Forms::BatchEditForm
|
101
120
|
end
|
102
121
|
|
103
122
|
def terms
|
@@ -105,7 +124,7 @@ module Hyrax
|
|
105
124
|
end
|
106
125
|
|
107
126
|
def work_params(extra_params = {})
|
108
|
-
work_params = params[form_class.model_name.param_key] || ActionController::Parameters.new
|
127
|
+
work_params = params[form_class.model_class.model_name.param_key] || ActionController::Parameters.new
|
109
128
|
form_class.model_attributes(work_params.merge(extra_params))
|
110
129
|
end
|
111
130
|
|
@@ -135,5 +154,15 @@ module Hyrax
|
|
135
154
|
redirect_to hyrax.dashboard_path
|
136
155
|
end
|
137
156
|
end
|
157
|
+
|
158
|
+
# Clean up form fields
|
159
|
+
# @param form Hyrax::Froms::ResourceBatchEditForm
|
160
|
+
def cleanup_form_fields(form)
|
161
|
+
form.lease = nil if form.lease && form.lease.fields['lease_expiration_date'].nil?
|
162
|
+
form.embargo = nil if form.embargo && form.embargo.fields['embargo_release_date'].nil?
|
163
|
+
form.fields.keys.each do |k|
|
164
|
+
form.fields[k] = nil if form.fields[k].is_a?(Array) && form.fields[k].blank?
|
165
|
+
end
|
166
|
+
end
|
138
167
|
end
|
139
168
|
end
|
@@ -5,7 +5,11 @@ module Hyrax
|
|
5
5
|
include Hyrax::WorksControllerBehavior
|
6
6
|
|
7
7
|
# Gives the class of the form.
|
8
|
-
class BatchUploadFormService
|
8
|
+
class BatchUploadFormService
|
9
|
+
def self.build(resource, current_ability, *extra)
|
10
|
+
form_class.new(resource, current_ability, *extra)
|
11
|
+
end
|
12
|
+
|
9
13
|
def self.form_class(_ = nil)
|
10
14
|
::Hyrax::Forms::BatchUploadForm
|
11
15
|
end
|
@@ -245,7 +245,10 @@ module Hyrax
|
|
245
245
|
end
|
246
246
|
|
247
247
|
def valkyrie_destroy
|
248
|
-
if transactions['collection_resource.destroy']
|
248
|
+
if transactions['collection_resource.destroy']
|
249
|
+
.with_step_args('collection_resource.delete' => { user: current_user },
|
250
|
+
'collection_resource.remove_from_membership' => { user: current_user })
|
251
|
+
.call(@collection).success?
|
249
252
|
after_destroy(params[:id])
|
250
253
|
else
|
251
254
|
after_destroy_error(params[:id])
|
@@ -3,6 +3,7 @@ module Hyrax
|
|
3
3
|
class DownloadsController < ApplicationController
|
4
4
|
include Hydra::Controller::DownloadBehavior
|
5
5
|
include Hyrax::LocalFileDownloadsControllerBehavior
|
6
|
+
include Hyrax::ValkyrieDownloadsControllerBehavior
|
6
7
|
include Hyrax::WorkflowsHelper # Provides #workflow_restriction?
|
7
8
|
|
8
9
|
def self.default_content_path
|
@@ -12,6 +13,8 @@ module Hyrax
|
|
12
13
|
# Render the 404 page if the file doesn't exist.
|
13
14
|
# Otherwise renders the file.
|
14
15
|
def show
|
16
|
+
return show_valkyrie if Hyrax.config.use_valkyrie?
|
17
|
+
|
15
18
|
case file
|
16
19
|
when ActiveFedora::File
|
17
20
|
# For original files that are stored in fedora
|
@@ -39,7 +42,11 @@ module Hyrax
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def file_set_parent(file_set_id)
|
42
|
-
file_set =
|
45
|
+
file_set = if defined?(Wings) && Hyrax.metadata_adapter.is_a?(Wings::Valkyrie::MetadataAdapter)
|
46
|
+
Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: file_set_id, use_valkyrie: Hyrax.config.use_valkyrie?)
|
47
|
+
else
|
48
|
+
Hyrax.query_service.find_by(id: file_set_id)
|
49
|
+
end
|
43
50
|
@parent ||=
|
44
51
|
case file_set
|
45
52
|
when Hyrax::Resource
|