hyrax 3.1.0 → 3.4.0
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 +8 -11
- data/.dassie/.env +1 -2
- data/.dassie/Gemfile +8 -4
- data/.dassie/app/controllers/catalog_controller.rb +6 -0
- data/.dassie/app/models/user.rb +0 -2
- data/.dassie/config/analytics.yml +12 -5
- data/.dassie/config/environments/development.rb +2 -0
- data/.dassie/config/initializers/hyrax.rb +13 -1
- data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
- data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
- data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
- data/.dassie/db/schema.rb +20 -1
- data/.env +7 -4
- data/.github/workflows/main.yml +17 -0
- data/.github/workflows/release.yml +17 -0
- data/.gitignore +4 -0
- data/.regen +1 -1
- data/.rubocop_fixme.yml +3 -1
- data/CONTAINERS.md +13 -10
- data/Dockerfile +4 -4
- data/README.md +37 -0
- data/app/actors/hyrax/actors/base_actor.rb +1 -1
- data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
- data/app/actors/hyrax/actors/file_actor.rb +6 -4
- data/app/actors/hyrax/actors/file_set_actor.rb +2 -0
- data/app/actors/hyrax/actors/transfer_request_actor.rb +3 -7
- data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
- data/app/assets/javascripts/hyrax/analytics_events.js +75 -0
- data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +1 -3
- data/app/assets/javascripts/hyrax/collapse.js +24 -0
- data/app/assets/javascripts/hyrax/collections.js +1 -2
- data/app/assets/javascripts/hyrax/ga_events.js +2 -8
- data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
- data/app/assets/javascripts/hyrax.js +2 -1
- data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
- data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
- data/app/authorities/qa/authorities/collections.rb +4 -5
- data/app/authorities/qa/authorities/find_works.rb +1 -1
- data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
- data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +13 -5
- data/app/controllers/concerns/hyrax/controller.rb +56 -2
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +83 -59
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +105 -36
- data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
- data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
- data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
- data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +17 -21
- data/app/controllers/hyrax/batch_edits_controller.rb +12 -3
- data/app/controllers/hyrax/batch_uploads_controller.rb +4 -0
- data/app/controllers/hyrax/citations_controller.rb +1 -1
- data/app/controllers/hyrax/collections_controller.rb +6 -1
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +12 -9
- data/app/controllers/hyrax/dashboard/collections_controller.rb +119 -37
- data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
- data/app/controllers/hyrax/dashboard_controller.rb +8 -0
- data/app/controllers/hyrax/my_controller.rb +4 -4
- data/app/controllers/hyrax/stats_controller.rb +3 -1
- data/app/controllers/hyrax/workflow_actions_controller.rb +8 -5
- data/app/forms/hyrax/forms/administrative_set_form.rb +80 -0
- data/app/forms/hyrax/forms/batch_edit_form.rb +1 -1
- data/app/forms/hyrax/forms/collection_form.rb +2 -2
- data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +33 -8
- data/app/forms/hyrax/forms/pcdm_collection_form.rb +68 -0
- data/app/forms/hyrax/forms/permission_template_form.rb +17 -9
- data/app/forms/hyrax/forms/resource_form.rb +24 -15
- data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
- data/app/helpers/hyrax/collections_helper.rb +14 -0
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
- data/app/helpers/hyrax/membership_helper.rb +1 -1
- data/app/helpers/hyrax/trophy_helper.rb +1 -1
- data/app/helpers/hyrax/url_helper.rb +1 -1
- data/app/indexers/hyrax/administrative_set_indexer.rb +12 -6
- data/app/indexers/hyrax/deep_indexing_service.rb +1 -1
- data/app/indexers/hyrax/file_set_indexer.rb +1 -0
- data/app/indexers/hyrax/pcdm_collection_indexer.rb +5 -1
- data/app/indexers/hyrax/thumbnail_indexer.rb +31 -0
- data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +7 -7
- data/app/indexers/hyrax/valkyrie_indexer.rb +4 -2
- data/app/indexers/hyrax/valkyrie_work_indexer.rb +13 -0
- data/app/inputs/controlled_vocabulary_input.rb +2 -0
- data/app/jobs/change_depositor_event_job.rb +47 -0
- data/app/jobs/characterize_job.rb +66 -3
- data/app/jobs/concerns/hyrax/members_permission_job_behavior.rb +1 -1
- data/app/jobs/content_depositor_change_event_job.rb +2 -1
- data/app/jobs/hyrax/propagate_change_depositor_job.rb +32 -0
- data/app/jobs/inherit_permissions_job.rb +1 -1
- data/app/jobs/valkyrie_create_derivatives_job.rb +25 -0
- data/app/jobs/valkyrie_ingest_job.rb +124 -0
- data/app/models/admin_set.rb +18 -7
- data/app/models/collection_branding_info.rb +8 -6
- data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
- data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
- data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
- data/app/models/concerns/hyrax/ability.rb +28 -7
- data/app/models/concerns/hyrax/collection_behavior.rb +2 -2
- data/app/models/concerns/hyrax/file_set/characterization.rb +7 -1
- data/app/models/concerns/hyrax/solr_document/metadata.rb +2 -0
- data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -5
- data/app/models/file_download_stat.rb +4 -4
- data/app/models/hyrax/administrative_set.rb +43 -2
- data/app/models/hyrax/collection_type.rb +2 -2
- data/app/models/hyrax/default_administrative_set.rb +42 -0
- data/app/models/hyrax/file_metadata.rb +5 -1
- data/app/models/hyrax/file_set.rb +42 -1
- data/app/models/hyrax/pcdm_collection.rb +56 -0
- data/app/models/hyrax/permission.rb +1 -1
- data/app/models/hyrax/permission_template.rb +30 -10
- data/app/models/hyrax/statistic.rb +31 -4
- data/app/models/hyrax/work.rb +92 -0
- data/app/models/hyrax/workflow_action_info.rb +16 -0
- data/app/models/proxy_deposit_request.rb +1 -1
- data/app/models/sipity/comment.rb +17 -0
- data/app/models/sipity.rb +11 -2
- data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
- data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
- data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
- data/app/presenters/hyrax/admin_set_presenter.rb +10 -5
- data/app/presenters/hyrax/collection_presenter.rb +3 -3
- data/app/presenters/hyrax/file_set_presenter.rb +2 -0
- data/app/presenters/hyrax/menu_presenter.rb +4 -0
- data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +3 -3
- data/app/presenters/hyrax/work_show_presenter.rb +11 -3
- data/app/presenters/hyrax/work_usage.rb +1 -0
- data/app/search_builders/hyrax/README.md +1 -1
- data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +44 -4
- data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +2 -2
- data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
- data/app/search_builders/hyrax/filter_by_type.rb +1 -2
- data/app/search_builders/hyrax/my/collections_search_builder.rb +12 -5
- data/app/services/hyrax/access_control_list.rb +13 -0
- data/app/services/hyrax/admin_set_create_service.rb +179 -51
- data/app/services/hyrax/analytics/google/events.rb +37 -0
- data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
- data/app/services/hyrax/analytics/google/visits.rb +44 -0
- data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
- data/app/services/hyrax/analytics/google.rb +204 -0
- data/app/services/hyrax/analytics/matomo.rb +193 -0
- data/app/services/hyrax/analytics/results.rb +79 -0
- data/app/services/hyrax/analytics.rb +12 -82
- data/app/services/hyrax/change_content_depositor_service.rb +2 -2
- data/app/services/hyrax/change_depositor_service.rb +70 -0
- data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
- data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
- data/app/services/hyrax/collections/collection_member_service.rb +12 -2
- data/app/services/hyrax/collections/nested_collection_query_service.rb +31 -14
- data/app/services/hyrax/collections/permissions_create_service.rb +81 -79
- data/app/services/hyrax/collections/permissions_service.rb +1 -1
- data/app/services/hyrax/curation_concern.rb +24 -2
- data/app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb +45 -0
- data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +7 -2
- data/app/services/hyrax/custom_queries/navigators/parent_work_navigator.rb +54 -0
- data/app/services/hyrax/default_middleware_stack.rb +14 -0
- data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
- data/app/services/hyrax/file_set_derivatives_service.rb +21 -2
- data/app/services/hyrax/file_set_type_service.rb +2 -5
- data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
- data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +4 -1
- data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
- data/app/services/hyrax/listeners/file_metadata_listener.rb +38 -0
- data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
- data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
- data/app/services/hyrax/listeners/member_cleanup_listener.rb +26 -3
- data/app/services/hyrax/listeners/metadata_index_listener.rb +72 -11
- data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
- data/app/services/hyrax/listeners/proxy_deposit_listener.rb +16 -8
- data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
- data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
- data/app/services/hyrax/listeners.rb +8 -0
- data/app/services/hyrax/location_service.rb +33 -0
- data/app/services/hyrax/multiple_membership_checker.rb +44 -1
- data/app/services/hyrax/permission_manager.rb +4 -4
- data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
- data/app/services/hyrax/restriction_service.rb +4 -0
- data/app/services/hyrax/simple_schema_loader.rb +5 -1
- data/app/services/hyrax/solr_query_service.rb +12 -7
- data/app/services/hyrax/solr_service.rb +1 -1
- data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
- data/app/services/hyrax/statistics/users/over_time.rb +8 -5
- data/app/services/hyrax/statistics/works/over_time.rb +10 -0
- data/app/services/hyrax/thumbnail_path_service.rb +1 -1
- data/app/services/hyrax/work_uploads_handler.rb +2 -9
- data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
- data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
- data/app/services/hyrax/workflow/activate_object.rb +5 -4
- data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
- data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
- data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
- data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
- data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
- data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
- data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
- data/app/validators/hyrax/collection_membership_validator.rb +38 -0
- data/app/views/catalog/_index_header_list_hyrax_pcdm_collection.html.erb +4 -0
- data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/_form_workflow.erb +1 -1
- data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
- data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
- data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
- data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
- data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
- data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
- data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
- data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
- data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
- data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/admin/stats/show.html.erb +1 -1
- data/app/views/hyrax/base/_form.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
- data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
- data/app/views/hyrax/base/show.html.erb +6 -0
- data/app/views/hyrax/collections/show.html.erb +4 -0
- data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
- data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
- data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
- data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
- data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
- data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
- data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form.html.erb +24 -17
- data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +6 -3
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +3 -3
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
- data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
- data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
- data/app/views/hyrax/file_sets/show.html.erb +6 -0
- data/app/views/hyrax/homepage/index.html.erb +1 -1
- data/app/views/hyrax/my/_work_action_menu.html.erb +8 -9
- data/app/views/hyrax/my/collections/_default_group.html.erb +2 -2
- data/app/views/hyrax/my/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
- data/app/views/hyrax/my/collections/index.html.erb +4 -3
- data/app/views/hyrax/my/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/my/works/_list_works.html.erb +1 -2
- data/app/views/hyrax/my/works/index.html.erb +4 -2
- data/app/views/hyrax/stats/_downloads.html.erb +18 -0
- data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
- data/app/views/hyrax/stats/work.html.erb +17 -9
- data/app/views/layouts/_head_tag_content.html.erb +7 -2
- data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
- data/app/views/layouts/hyrax.html.erb +1 -0
- data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
- data/app/views/shared/_matomo.html.erb +15 -0
- data/app/views/shared/_read_only.html.erb +5 -0
- data/chart/hyrax/Chart.yaml +2 -2
- data/chart/hyrax/README.md +22 -1
- data/chart/hyrax/templates/deployment.yaml +6 -0
- data/chart/hyrax/values.yaml +1 -1
- data/config/features.rb +3 -0
- data/config/i18n-tasks.yml +2 -2
- data/config/initializers/1_healthz.rb +1 -0
- data/config/initializers/listeners.rb +5 -5
- data/config/locales/hyrax.de.yml +200 -5
- data/config/locales/hyrax.en.yml +202 -21
- data/config/locales/hyrax.es.yml +204 -9
- data/config/locales/hyrax.fr.yml +196 -1
- data/config/locales/hyrax.it.yml +197 -2
- data/config/locales/hyrax.pt-BR.yml +196 -1
- data/config/locales/hyrax.zh.yml +196 -1
- data/config/metadata/basic_metadata.yaml +2 -0
- data/config/metadata/core_metadata.yaml +1 -1
- data/config/routes.rb +4 -0
- data/db/seeds.rb +1 -1
- data/docker-compose.yml +48 -42
- data/documentation/developing-your-hyrax-based-app.md +2 -2
- data/documentation/legacyREADME.md +1 -1
- data/hyrax.gemspec +4 -2
- data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
- data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +10 -13
- data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
- data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +4 -2
- data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
- data/lib/hyrax/administrative_set_name.rb +18 -0
- data/lib/hyrax/collection_name.rb +8 -2
- data/lib/hyrax/configuration.rb +104 -4
- data/lib/hyrax/controlled_vocabularies/location.rb +9 -2
- data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +42 -0
- data/lib/hyrax/controlled_vocabularies.rb +1 -0
- data/lib/hyrax/engine.rb +7 -6
- data/lib/hyrax/form_fields.rb +1 -0
- data/lib/hyrax/publisher.rb +61 -0
- data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
- data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
- data/lib/hyrax/specs/capybara.rb +1 -1
- data/lib/hyrax/specs/shared_specs/hydra_works.rb +13 -4
- data/lib/hyrax/specs/shared_specs/indexers.rb +120 -0
- data/lib/hyrax/transactions/admin_set_create.rb +23 -0
- data/lib/hyrax/transactions/admin_set_destroy.rb +22 -0
- data/lib/hyrax/transactions/admin_set_update.rb +21 -0
- data/lib/hyrax/transactions/collection_create.rb +25 -0
- data/lib/hyrax/transactions/collection_destroy.rb +22 -0
- data/lib/hyrax/transactions/collection_update.rb +21 -0
- data/lib/hyrax/transactions/container.rb +118 -17
- data/lib/hyrax/transactions/create_work.rb +3 -0
- data/lib/hyrax/transactions/destroy_work.rb +3 -0
- data/lib/hyrax/transactions/steps/add_to_collections.rb +13 -1
- data/lib/hyrax/transactions/steps/apply_collection_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
- data/lib/hyrax/transactions/steps/apply_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/apply_visibility.rb +2 -0
- data/lib/hyrax/transactions/steps/change_depositor.rb +46 -0
- data/lib/hyrax/transactions/steps/check_for_empty_admin_set.rb +36 -0
- data/lib/hyrax/transactions/steps/delete_access_control.rb +32 -0
- data/lib/hyrax/transactions/steps/delete_resource.rb +19 -3
- data/lib/hyrax/transactions/steps/destroy_work.rb +3 -1
- data/lib/hyrax/transactions/steps/ensure_permission_template.rb +2 -0
- data/lib/hyrax/transactions/steps/save.rb +37 -7
- data/lib/hyrax/transactions/steps/save_access_control.rb +2 -2
- data/lib/hyrax/transactions/steps/save_work.rb +3 -0
- data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
- data/lib/hyrax/transactions/steps/set_user_as_creator.rb +41 -0
- data/lib/hyrax/transactions/steps/update_work_members.rb +51 -0
- data/lib/hyrax/transactions/update_work.rb +4 -3
- data/lib/hyrax/transactions/work_create.rb +1 -1
- data/lib/hyrax/transactions/work_destroy.rb +2 -1
- data/lib/hyrax/transactions/work_update.rb +19 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/tasks/default_admin_set.rake +12 -11
- data/lib/tasks/regenerate_derivatives.rake +1 -1
- data/lib/wings/attribute_transformer.rb +5 -1
- data/lib/wings/setup.rb +18 -1
- data/lib/wings/valkyrie/persister.rb +16 -0
- data/lib/wings/valkyrie/query_service.rb +2 -1
- data/lib/wings/valkyrie/storage.rb +7 -1
- data/template.rb +1 -1
- data/vendor/assets/javascripts/morris/morris.min.js +1 -7
- data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
- metadata +121 -17
- data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
data/db/seeds.rb
CHANGED
@@ -10,7 +10,7 @@ errors = Hyrax::Workflow::WorkflowImporter.load_errors
|
|
10
10
|
abort("Failed to process all workflows:\n #{errors.join('\n ')}") unless errors.empty?
|
11
11
|
|
12
12
|
puts "\n== Creating default admin set"
|
13
|
-
admin_set_id =
|
13
|
+
admin_set_id = Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s
|
14
14
|
|
15
15
|
# I have found that when I come back to a development
|
16
16
|
# environment, that I may have an AdminSet in Fedora, but it is
|
data/docker-compose.yml
CHANGED
@@ -8,6 +8,7 @@ services:
|
|
8
8
|
args:
|
9
9
|
- EXTRA_APK_PACKAGES=git less
|
10
10
|
image: ghcr.io/samvera/dassie
|
11
|
+
command: sh -l -c 'bundle && bundle exec puma -v -b tcp://0.0.0.0:3000'
|
11
12
|
stdin_open: true
|
12
13
|
tty: true
|
13
14
|
user: root
|
@@ -27,8 +28,8 @@ services:
|
|
27
28
|
ports:
|
28
29
|
- 3000:3000
|
29
30
|
volumes:
|
30
|
-
- .dassie:/app/samvera/hyrax-webapp
|
31
|
-
- .:/app/samvera/hyrax-engine
|
31
|
+
- .dassie:/app/samvera/hyrax-webapp
|
32
|
+
- .:/app/samvera/hyrax-engine
|
32
33
|
- hyrax-derivatives:/app/samvera/hyrax-webapp/derivatives
|
33
34
|
- hyrax-uploads:/app/samvera/hyrax-webapp/uploads
|
34
35
|
- rails-public:/app/samvera/hyrax-webapp/public
|
@@ -36,36 +37,67 @@ services:
|
|
36
37
|
networks:
|
37
38
|
- hyrax
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
sidekiq:
|
41
|
+
build:
|
42
|
+
context: .
|
43
|
+
target: hyrax-engine-dev-worker
|
44
|
+
image: ghcr.io/samvera/dassie-worker
|
45
|
+
command: sh -l -c 'bundle && bundle exec sidekiq'
|
46
|
+
user: root
|
47
|
+
env_file:
|
48
|
+
- .env
|
49
|
+
- .dassie/.env
|
50
|
+
depends_on:
|
51
|
+
- db_migrate
|
52
|
+
- fcrepo
|
53
|
+
- memcached
|
54
|
+
- postgres
|
55
|
+
- redis
|
56
|
+
- solr
|
43
57
|
volumes:
|
44
|
-
- /
|
45
|
-
|
46
|
-
|
47
|
-
-
|
48
|
-
-
|
58
|
+
- .dassie:/app/samvera/hyrax-webapp
|
59
|
+
- .:/app/samvera/hyrax-engine
|
60
|
+
- hyrax-derivatives:/app/samvera/hyrax-webapp/derivatives
|
61
|
+
- hyrax-uploads:/app/samvera/hyrax-webapp/uploads
|
62
|
+
- sidekiq-public:/app/samvera/hyrax-webapp/public
|
63
|
+
- sidekiq-tmp:/app/samvera/hyrax-webapp/tmp
|
49
64
|
networks:
|
50
65
|
- hyrax
|
51
66
|
|
52
67
|
db_migrate:
|
68
|
+
build:
|
69
|
+
context: .
|
70
|
+
target: hyrax-engine-dev
|
71
|
+
args:
|
72
|
+
- EXTRA_APK_PACKAGES=git less
|
53
73
|
image: ghcr.io/samvera/dassie
|
54
74
|
user: root
|
55
75
|
env_file:
|
56
76
|
- .env
|
57
|
-
|
58
|
-
command: db-migrate-seed.sh
|
77
|
+
command: sh -l -c 'bundle && db-migrate-seed.sh'
|
59
78
|
depends_on:
|
60
79
|
- postgres
|
61
80
|
volumes:
|
62
|
-
- .dassie:/app/samvera/hyrax-webapp
|
63
|
-
- .:/app/samvera/hyrax-engine
|
81
|
+
- .dassie:/app/samvera/hyrax-webapp
|
82
|
+
- .:/app/samvera/hyrax-engine
|
64
83
|
- rails-public:/app/samvera/hyrax-webapp/public
|
65
84
|
- rails-tmp:/app/samvera/hyrax-webapp/tmp
|
66
85
|
networks:
|
67
86
|
- hyrax
|
68
87
|
|
88
|
+
chrome:
|
89
|
+
image: selenium/standalone-chrome:3.141
|
90
|
+
logging:
|
91
|
+
driver: none
|
92
|
+
volumes:
|
93
|
+
- /dev/shm:/dev/shm
|
94
|
+
shm_size: 2G
|
95
|
+
ports:
|
96
|
+
- "4444:4444"
|
97
|
+
- "5959:5900"
|
98
|
+
networks:
|
99
|
+
- hyrax
|
100
|
+
|
69
101
|
postgres:
|
70
102
|
image: postgres:latest
|
71
103
|
restart: always
|
@@ -104,34 +136,8 @@ services:
|
|
104
136
|
networks:
|
105
137
|
- hyrax
|
106
138
|
|
107
|
-
sidekiq:
|
108
|
-
build:
|
109
|
-
context: .
|
110
|
-
target: hyrax-engine-dev-worker
|
111
|
-
image: ghcr.io/samvera/dassie-worker
|
112
|
-
user: root
|
113
|
-
env_file:
|
114
|
-
- .env
|
115
|
-
- .dassie/.env
|
116
|
-
depends_on:
|
117
|
-
- db_migrate
|
118
|
-
- fcrepo
|
119
|
-
- memcached
|
120
|
-
- postgres
|
121
|
-
- redis
|
122
|
-
- solr
|
123
|
-
volumes:
|
124
|
-
- .dassie:/app/samvera/hyrax-webapp:cached
|
125
|
-
- .:/app/samvera/hyrax-engine:cached
|
126
|
-
- hyrax-derivatives:/app/samvera/hyrax-webapp/derivatives
|
127
|
-
- hyrax-uploads:/app/samvera/hyrax-webapp/uploads
|
128
|
-
- sidekiq-public:/app/samvera/hyrax-webapp/public
|
129
|
-
- sidekiq-tmp:/app/samvera/hyrax-webapp/tmp
|
130
|
-
networks:
|
131
|
-
- hyrax
|
132
|
-
|
133
139
|
solr:
|
134
|
-
image: solr:8.
|
140
|
+
image: solr:8.11.1
|
135
141
|
ports:
|
136
142
|
- 8983:8983
|
137
143
|
command:
|
@@ -43,7 +43,7 @@ Prerequisites are required for both creating a Hyrax\-based app and contributing
|
|
43
43
|
|
44
44
|
Hyrax requires the following software to work:
|
45
45
|
|
46
|
-
1. [Solr](http://lucene.apache.org/solr/) version >= 5.x (tested up to 8.
|
46
|
+
1. [Solr](http://lucene.apache.org/solr/) version >= 5.x (tested up to 8.11.1, which includes the log4j library update)
|
47
47
|
1. [Fedora Commons](http://www.fedora-commons.org/) digital repository version >= 4.5.1 (tested up to 4.7.5)
|
48
48
|
1. A SQL RDBMS (MySQL, PostgreSQL), though **note** that SQLite will be used by default if you're looking to get up and running quickly
|
49
49
|
1. [Redis](http://redis.io/), a key-value store
|
@@ -125,7 +125,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
|
|
125
125
|
Generate a new Rails application using the template.
|
126
126
|
|
127
127
|
```
|
128
|
-
rails _5.2.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v3.
|
128
|
+
rails _5.2.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v3.4.0/template.rb
|
129
129
|
```
|
130
130
|
|
131
131
|
Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
|
@@ -50,7 +50,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
|
|
50
50
|
# Getting started
|
51
51
|
|
52
52
|
This document contains instructions specific to setting up an app with __Hyrax
|
53
|
-
v3.
|
53
|
+
v3.4.0__. If you are looking for instructions on installing a different
|
54
54
|
version, be sure to select the appropriate branch or tag from the drop-down
|
55
55
|
menu above.
|
56
56
|
|
data/hyrax.gemspec
CHANGED
@@ -52,8 +52,9 @@ SUMMARY
|
|
52
52
|
spec.add_dependency 'font-awesome-rails', '~> 4.2'
|
53
53
|
spec.add_dependency 'hydra-derivatives', '~> 3.3'
|
54
54
|
spec.add_dependency 'hydra-editor', '~> 5.0', ">= 5.0.4"
|
55
|
+
spec.add_dependency 'hydra-file_characterization', '~> 1.1.2'
|
55
56
|
spec.add_dependency 'hydra-head', '~> 11.0', ">= 11.0.1"
|
56
|
-
spec.add_dependency 'hydra-works', '>= 0.16'
|
57
|
+
spec.add_dependency 'hydra-works', '>= 0.16'
|
57
58
|
spec.add_dependency 'iiif_manifest', '>= 0.3', '< 2.0'
|
58
59
|
spec.add_dependency 'jquery-datatables-rails', '~> 3.4'
|
59
60
|
spec.add_dependency 'jquery-ui-rails', '~> 6.0'
|
@@ -82,7 +83,7 @@ SUMMARY
|
|
82
83
|
spec.add_dependency 'select2-rails', '~> 3.5'
|
83
84
|
spec.add_dependency 'signet'
|
84
85
|
spec.add_dependency 'tinymce-rails'
|
85
|
-
spec.add_dependency 'valkyrie', '>= 2.1.1'
|
86
|
+
spec.add_dependency 'valkyrie', '~> 2', '>= 2.1.1'
|
86
87
|
|
87
88
|
spec.add_development_dependency "capybara", '~> 3.29'
|
88
89
|
spec.add_development_dependency 'capybara-screenshot', '~> 1.0'
|
@@ -95,6 +96,7 @@ SUMMARY
|
|
95
96
|
spec.add_development_dependency "jasmine-core", '~> 2.3', '< 2.99'
|
96
97
|
spec.add_development_dependency 'mida', '~> 0.3'
|
97
98
|
spec.add_development_dependency 'okcomputer'
|
99
|
+
spec.add_development_dependency 'pg', '~> 1.2'
|
98
100
|
spec.add_development_dependency 'rspec-activemodel-mocks', '~> 1.0'
|
99
101
|
spec.add_development_dependency 'rspec-its', '~> 1.1'
|
100
102
|
spec.add_development_dependency 'rspec-rails', '~> 3.1'
|
@@ -5,6 +5,8 @@ class CatalogController < ApplicationController
|
|
5
5
|
|
6
6
|
# This filter applies the hydra access controls
|
7
7
|
before_action :enforce_show_permissions, only: :show
|
8
|
+
# Allow all search options when in read-only mode
|
9
|
+
skip_before_action :check_read_only
|
8
10
|
|
9
11
|
def self.uploaded_field
|
10
12
|
"system_create_dtsi"
|
@@ -22,7 +24,7 @@ class CatalogController < ApplicationController
|
|
22
24
|
config.view.slideshow.partials = [:index]
|
23
25
|
|
24
26
|
# Because too many times on Samvera tech people raise a problem regarding a failed query to SOLR.
|
25
|
-
# Often, it's because they
|
27
|
+
# Often, it's because they inadvertently exceeded the character limit of a GET request.
|
26
28
|
config.http_method = :post
|
27
29
|
|
28
30
|
## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
|
@@ -1,9 +1,15 @@
|
|
1
1
|
#
|
2
|
-
#
|
2
|
+
# You can manually fill in these values or use the ENV variables.
|
3
3
|
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
analytics:
|
5
|
+
google:
|
6
|
+
analytics_id: <%= ENV['GOOGLE_ANALYTICS_ID'] %>
|
7
|
+
app_name: <%= ENV['GOOGLE_OAUTH_APP_NAME'] %>
|
8
|
+
app_version: <%= ENV['GOOGLE_OAUTH_APP_VERSION'] %>
|
9
|
+
privkey_path: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_PATH'] %>
|
10
|
+
privkey_secret: <%= ENV['GOOGLE_OAUTH_PRIVATE_KEY_SECRET'] %>
|
11
|
+
client_email: <%= ENV['GOOGLE_OAUTH_CLIENT_EMAIL'] %>
|
12
|
+
matomo:
|
13
|
+
base_url: <%= ENV['MATOMO_BASE_URL'] %>
|
14
|
+
site_id: <%= ENV['MATOMO_SITE_ID'] %>
|
15
|
+
auth_token: <%= ENV['MATOMO_AUTH_TOKEN'] %>
|
@@ -41,19 +41,6 @@ Hyrax.config do |config|
|
|
41
41
|
# maxFileSize: 500.megabytes
|
42
42
|
# }
|
43
43
|
|
44
|
-
# Enable displaying usage statistics in the UI
|
45
|
-
# Defaults to false
|
46
|
-
# Requires a Google Analytics id and OAuth2 keyfile. See README for more info
|
47
|
-
# config.analytics = false
|
48
|
-
|
49
|
-
# Google Analytics tracking ID to gather usage statistics
|
50
|
-
# config.google_analytics_id = 'UA-99999999-1'
|
51
|
-
|
52
|
-
# Date you wish to start collecting Google Analytic statistics for
|
53
|
-
# Leaving it blank will set the start date to when ever the file was uploaded by
|
54
|
-
# NOTE: if you have always sent analytics to GA for downloads and page views leave this commented out
|
55
|
-
# config.analytic_start_date = DateTime.new(2014, 9, 10)
|
56
|
-
|
57
44
|
# Enables a link to the citations page for a work
|
58
45
|
# Default is false
|
59
46
|
# config.citations = false
|
@@ -238,6 +225,16 @@ Hyrax.config do |config|
|
|
238
225
|
# "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/#{Noid::Rails.treeify(id)}"
|
239
226
|
# end
|
240
227
|
|
228
|
+
# Identify the model class name that will be used for Collections in your app
|
229
|
+
# (i.e. ::Collection for ActiveFedora, Hyrax::PcdmCollection for Valkyrie)
|
230
|
+
# config.collection_model = '::Collection'
|
231
|
+
# config.collection_model = 'Hyrax::PcdmCollection'
|
232
|
+
|
233
|
+
# Identify the model class name that will be used for Admin Sets in your app
|
234
|
+
# (i.e. AdminSet for ActiveFedora, Hyrax::AdministrativeSet for Valkyrie)
|
235
|
+
# config.admin_set_model = 'AdminSet'
|
236
|
+
# config.admin_set_model = 'Hyrax::AdministrativeSet'
|
237
|
+
|
241
238
|
# When your application is ready to use the valkyrie index instead of the one
|
242
239
|
# maintained by active fedora, you will need to set this to true. You will
|
243
240
|
# also need to update your Blacklight configuration.
|
@@ -12,7 +12,7 @@ RSpec.feature 'Create a <%= class_name %>', js: false do
|
|
12
12
|
let(:user) do
|
13
13
|
User.new(user_attributes) { |u| u.save(validate: false) }
|
14
14
|
end
|
15
|
-
let(:admin_set_id) {
|
15
|
+
let(:admin_set_id) { Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
|
16
16
|
let(:permission_template) { Hyrax::PermissionTemplate.find_or_create_by!(source_id: admin_set_id) }
|
17
17
|
let(:workflow) { Sipity::Workflow.create!(active: true, name: 'test-workflow', permission_template: permission_template) }
|
18
18
|
|
@@ -31,11 +31,13 @@ RSpec.feature 'Create a <%= class_name %>', js: false do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
scenario do
|
34
|
+
pending 'Changes may be required for this test to pass. See TODO in test.'
|
35
|
+
|
34
36
|
visit '/dashboard'
|
35
37
|
click_link "Works"
|
36
38
|
click_link "Add new work"
|
37
39
|
|
38
|
-
# If you generate more than one work uncomment these lines
|
40
|
+
# TODO: If you generate more than one work uncomment these lines
|
39
41
|
# choose "payload_concern", option: "<%= class_name %>"
|
40
42
|
# click_button "Create work"
|
41
43
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hyrax
|
4
|
+
##
|
5
|
+
# A custom name for Valkyrie AdministrativeSet objects. Route keys are mapped to `admin_set`
|
6
|
+
# not be the same as the model name.
|
7
|
+
class AdministrativeSetName < Name
|
8
|
+
def initialize(klass, namespace = nil, name = nil)
|
9
|
+
super
|
10
|
+
@human = 'AdminSet'
|
11
|
+
@i18n_key = :admin_set
|
12
|
+
@param_key = 'admin_set'
|
13
|
+
@plural = 'admin_sets'
|
14
|
+
@route_key = 'admin_sets'
|
15
|
+
@singular_route_key = 'admin_set'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -8,8 +8,14 @@ module Hyrax
|
|
8
8
|
def initialize(klass, namespace = nil, name = nil)
|
9
9
|
super
|
10
10
|
|
11
|
-
@
|
12
|
-
@
|
11
|
+
@human = 'Collection'
|
12
|
+
@i18n_key = :collection
|
13
|
+
@param_key = 'collection'
|
14
|
+
@plural = 'collections'
|
15
|
+
@route_key = 'collections'
|
16
|
+
@singular_route_key = 'collection'
|
17
|
+
@collection = 'collections'
|
18
|
+
@element = 'collection'
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
data/lib/hyrax/configuration.rb
CHANGED
@@ -112,16 +112,46 @@ module Hyrax
|
|
112
112
|
ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_ANALYTICS', false))
|
113
113
|
end
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
# Currently supports 'google' or 'matomo'
|
116
|
+
# google is default for backward compatability
|
117
|
+
attr_writer :analytics_provider
|
118
|
+
def analytics_provider
|
119
|
+
@analytics_provider ||=
|
120
|
+
ENV.fetch('HYRAX_ANALYTICS_PROVIDER', 'google')
|
121
|
+
end
|
122
|
+
|
123
|
+
##
|
124
|
+
# @!attribute [w] analytics_start_date
|
125
|
+
# @note this can be set using the +ANALITICS_START_DATE+ environment variable (format is YYYY-MM-DD)
|
126
|
+
# @return [String] date you wish to start collecting analytics for. used to compute the
|
127
|
+
# "all-time" metrics.
|
128
|
+
# This is used to compute the "all-time" metrics
|
129
|
+
# Set this in your .env file (format is YYYY-MM-DD)
|
130
|
+
attr_writer :analytics_start_date
|
131
|
+
def analytics_start_date
|
132
|
+
@analytics_start_date ||=
|
133
|
+
ENV.fetch('ANALYTICS_START_DATE', Time.zone.today - 1.year)
|
118
134
|
end
|
119
|
-
alias google_analytics_id? google_analytics_id
|
120
135
|
|
121
136
|
# Defaulting analytic start date to whenever the file was uploaded by leaving it blank
|
122
137
|
attr_writer :analytic_start_date
|
123
138
|
attr_reader :analytic_start_date
|
124
139
|
|
140
|
+
##
|
141
|
+
# @deprecated use analytics_id from config/analytics.yml instead
|
142
|
+
def google_analytics_id=(value)
|
143
|
+
Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.")
|
144
|
+
Hyrax::Analytics.config.analytics_id = value
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# @deprecated use analytics_id from config/analytics.yml instead
|
149
|
+
def google_analytics_id
|
150
|
+
Deprecation.warn("google_analytics_id is deprecated; use analytics_id from config/analytics.yml instead.")
|
151
|
+
Hyrax::Analytics.config.analytics_id
|
152
|
+
end
|
153
|
+
alias google_analytics_id? google_analytics_id
|
154
|
+
|
125
155
|
# @!endgroup
|
126
156
|
# @!group Groups
|
127
157
|
|
@@ -419,6 +449,7 @@ module Hyrax
|
|
419
449
|
##
|
420
450
|
# @return [Boolean] whether to use experimental valkyrie storage features
|
421
451
|
def use_valkyrie?
|
452
|
+
return true if disable_wings # always return true if wings is disabled
|
422
453
|
ActiveModel::Type::Boolean.new.cast(ENV.fetch('HYRAX_VALKYRIE', false))
|
423
454
|
end
|
424
455
|
# @!endgroup
|
@@ -454,6 +485,26 @@ module Hyrax
|
|
454
485
|
# Override characterization runner
|
455
486
|
attr_accessor :characterization_runner
|
456
487
|
|
488
|
+
##
|
489
|
+
# @!attribute [rw] characterization_service
|
490
|
+
# @return [#run] the service to use for charactaerization for Valkyrie
|
491
|
+
# objects
|
492
|
+
# @ see Hyrax::Characterization::ValkyrieCharacterizationService
|
493
|
+
attr_writer :characterization_service
|
494
|
+
def characterization_service
|
495
|
+
@characterization_service ||=
|
496
|
+
Hyrax::Characterization::ValkyrieCharacterizationService
|
497
|
+
end
|
498
|
+
|
499
|
+
##
|
500
|
+
# @!attribute [w] characterization_proxy
|
501
|
+
# Which FileSet file to use for mime type resolution
|
502
|
+
# @ see Hyrax::FileSetTypeService
|
503
|
+
attr_writer :characterization_proxy
|
504
|
+
def characterization_proxy
|
505
|
+
@characterization_proxy ||= :original_file
|
506
|
+
end
|
507
|
+
|
457
508
|
# Attributes for the lock manager which ensures a single process/thread is mutating a ore:Aggregation at once.
|
458
509
|
# @!attribute [w] lock_retry_count
|
459
510
|
# How many times to retry to acquire the lock before raising UnableToAcquireLockError
|
@@ -666,6 +717,55 @@ module Hyrax
|
|
666
717
|
@collection_type_index_field ||= 'collection_type_gid_ssim'
|
667
718
|
end
|
668
719
|
|
720
|
+
attr_writer :collection_model
|
721
|
+
##
|
722
|
+
# @return [#constantize] a string representation of the collection
|
723
|
+
# model
|
724
|
+
def collection_model
|
725
|
+
@collection_model ||= '::Collection'
|
726
|
+
end
|
727
|
+
|
728
|
+
##
|
729
|
+
# @return [Class] the configured collection model class
|
730
|
+
def collection_class
|
731
|
+
collection_model.safe_constantize
|
732
|
+
end
|
733
|
+
|
734
|
+
attr_writer :admin_set_model
|
735
|
+
##
|
736
|
+
# @return [#constantize] a string representation of the admin set
|
737
|
+
# model
|
738
|
+
def admin_set_model
|
739
|
+
@admin_set_model ||= 'AdminSet'
|
740
|
+
end
|
741
|
+
|
742
|
+
##
|
743
|
+
# @return [Class] the configured admin set model class
|
744
|
+
def admin_set_class
|
745
|
+
admin_set_model.constantize
|
746
|
+
end
|
747
|
+
|
748
|
+
##
|
749
|
+
# @return [String] the default admin set id
|
750
|
+
def default_admin_set_id
|
751
|
+
default_admin_set.id.to_s
|
752
|
+
end
|
753
|
+
|
754
|
+
##
|
755
|
+
# @return [Hyrax::AdministrativeSet] the default admin set
|
756
|
+
# @see Hyrax::AdminSetCreateService.find_or_create_default_admin_set
|
757
|
+
def default_admin_set
|
758
|
+
@default_admin_set ||= Hyrax::AdminSetCreateService.find_or_create_default_admin_set
|
759
|
+
end
|
760
|
+
|
761
|
+
##
|
762
|
+
# If the default admin set is changed, call reset. The next time one of the default
|
763
|
+
# admin set configs is checked, the default_admin_set variable will be updated.
|
764
|
+
# @see Hyrax::DefaultAdministrativeSet.update
|
765
|
+
def reset_default_admin_set
|
766
|
+
@default_admin_set = nil
|
767
|
+
end
|
768
|
+
|
669
769
|
attr_writer :id_field
|
670
770
|
def id_field
|
671
771
|
@id_field || index_field_mapper.id_field
|
@@ -4,10 +4,17 @@ module Hyrax
|
|
4
4
|
class Location < ActiveTriples::Resource
|
5
5
|
configure rdf_label: ::RDF::Vocab::GEONAMES.name
|
6
6
|
|
7
|
+
include ResourceLabelCaching
|
8
|
+
|
7
9
|
# Return a tuple of url & label
|
8
10
|
def solrize
|
9
|
-
|
10
|
-
[rdf_subject.to_s
|
11
|
+
label = full_label || rdf_label.first.to_s
|
12
|
+
return [rdf_subject.to_s] if label.blank? || label == rdf_subject.to_s
|
13
|
+
[rdf_subject.to_s, { label: "#{label}$#{rdf_subject}" }]
|
14
|
+
end
|
15
|
+
|
16
|
+
def full_label
|
17
|
+
Hyrax::LocationService.new.full_label(rdf_subject.to_s)
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Hyrax
|
3
|
+
module ControlledVocabularies
|
4
|
+
##
|
5
|
+
# adds caching to the {#rdf_label} method.
|
6
|
+
#
|
7
|
+
# for systems that check the {#rdf_label}and use {#fetch} to get upstream
|
8
|
+
# data if it is not present, this can be used to avoid making round trips
|
9
|
+
# to an authoritative web source.
|
10
|
+
#
|
11
|
+
# @see Hyrax::DeepIndexingService
|
12
|
+
module ResourceLabelCaching
|
13
|
+
CACHE_KEY_PREFIX = "hy_label-v1-"
|
14
|
+
|
15
|
+
##
|
16
|
+
# @note uses the Rails cache to avoid repeated lookups.
|
17
|
+
# @see ActiveTriples::Resource#rdf_label
|
18
|
+
def rdf_label
|
19
|
+
# only cache if this rdf source is represented by a URI;
|
20
|
+
# i.e. don't cache for blank nodes
|
21
|
+
return super unless uri?
|
22
|
+
|
23
|
+
Rails.cache.fetch(cache_key) { super }
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# @note adds behavior to clear the cache whenever a manual fetch of data
|
28
|
+
# is performed.
|
29
|
+
# @see ActiveTriples::Resource#fetch
|
30
|
+
def fetch(*)
|
31
|
+
Rails.cache.delete(cache_key)
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def cache_key
|
38
|
+
"#{CACHE_KEY_PREFIX}#{to_uri.canonicalize.pname}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/hyrax/engine.rb
CHANGED
@@ -3,22 +3,23 @@ module Hyrax
|
|
3
3
|
class Engine < ::Rails::Engine
|
4
4
|
isolate_namespace Hyrax
|
5
5
|
|
6
|
+
require 'almond-rails'
|
6
7
|
require 'awesome_nested_set'
|
7
8
|
require 'breadcrumbs_on_rails'
|
9
|
+
require 'clipboard/rails'
|
8
10
|
require 'draper'
|
9
|
-
require 'dry/struct'
|
10
11
|
require 'dry/equalizer'
|
11
12
|
require 'dry/events'
|
13
|
+
require 'dry/struct'
|
12
14
|
require 'dry/validation'
|
13
|
-
require '
|
15
|
+
require 'flipflop'
|
14
16
|
require 'flot-rails'
|
15
|
-
require '
|
17
|
+
require 'hydra-file_characterization'
|
16
18
|
require 'jquery-datatables-rails'
|
17
|
-
require '
|
19
|
+
require 'jquery-ui-rails'
|
20
|
+
require 'legato'
|
18
21
|
require 'qa'
|
19
|
-
require 'clipboard/rails'
|
20
22
|
require 'tinymce-rails'
|
21
|
-
require 'legato'
|
22
23
|
require 'valkyrie'
|
23
24
|
|
24
25
|
require 'hydra/derivatives'
|
data/lib/hyrax/form_fields.rb
CHANGED
@@ -49,6 +49,7 @@ module Hyrax
|
|
49
49
|
|
50
50
|
form_field_definitions.each do |field_name, options|
|
51
51
|
descendant.property field_name.to_sym, options.merge(display: true, default: [])
|
52
|
+
descendant.validates field_name.to_sym, presence: true if options.fetch(:required, false)
|
52
53
|
end
|
53
54
|
end
|
54
55
|
end
|