hyrax 3.2.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -6
  3. data/.dassie/.env +1 -1
  4. data/.dassie/Gemfile +7 -3
  5. data/.dassie/app/models/user.rb +0 -2
  6. data/.dassie/config/analytics.yml +12 -5
  7. data/.dassie/config/environments/development.rb +2 -0
  8. data/.dassie/config/initializers/hyrax.rb +13 -1
  9. data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
  10. data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
  11. data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
  12. data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
  13. data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
  14. data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
  15. data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
  16. data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
  17. data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
  18. data/.dassie/db/schema.rb +20 -1
  19. data/.dassie/db/seeds.rb +70 -15
  20. data/.env +7 -4
  21. data/.github/release.yml +26 -0
  22. data/.github/workflows/main.yml +17 -0
  23. data/.github/workflows/release.yml +17 -0
  24. data/.gitignore +4 -0
  25. data/.regen +1 -1
  26. data/.rubocop_fixme.yml +3 -1
  27. data/CONTAINERS.md +13 -10
  28. data/Dockerfile +2 -1
  29. data/README.md +37 -0
  30. data/app/actors/hyrax/actors/file_actor.rb +6 -4
  31. data/app/actors/hyrax/actors/transfer_request_actor.rb +3 -7
  32. data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
  33. data/app/assets/javascripts/hyrax/analytics_events.js +75 -0
  34. data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +1 -3
  35. data/app/assets/javascripts/hyrax/collapse.js +24 -0
  36. data/app/assets/javascripts/hyrax/collections.js +1 -2
  37. data/app/assets/javascripts/hyrax/ga_events.js +2 -8
  38. data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
  39. data/app/assets/javascripts/hyrax.js +2 -1
  40. data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
  41. data/app/authorities/qa/authorities/collections.rb +4 -5
  42. data/app/authorities/qa/authorities/find_works.rb +1 -1
  43. data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
  44. data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
  45. data/app/controllers/concerns/hyrax/controller.rb +43 -0
  46. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +83 -59
  47. data/app/controllers/hyrax/admin/admin_sets_controller.rb +105 -19
  48. data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
  49. data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
  50. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
  51. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +12 -19
  52. data/app/controllers/hyrax/batch_edits_controller.rb +12 -3
  53. data/app/controllers/hyrax/batch_uploads_controller.rb +4 -0
  54. data/app/controllers/hyrax/citations_controller.rb +1 -1
  55. data/app/controllers/hyrax/collections_controller.rb +4 -1
  56. data/app/controllers/hyrax/dashboard/collections_controller.rb +34 -16
  57. data/app/controllers/hyrax/dashboard_controller.rb +8 -0
  58. data/app/controllers/hyrax/stats_controller.rb +3 -1
  59. data/app/forms/hyrax/forms/administrative_set_form.rb +19 -1
  60. data/app/forms/hyrax/forms/batch_edit_form.rb +1 -1
  61. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +21 -6
  62. data/app/forms/hyrax/forms/pcdm_collection_form.rb +4 -0
  63. data/app/forms/hyrax/forms/permission_template_form.rb +17 -9
  64. data/app/forms/hyrax/forms/resource_form.rb +9 -5
  65. data/app/helpers/hyrax/collections_helper.rb +14 -0
  66. data/app/helpers/hyrax/membership_helper.rb +1 -1
  67. data/app/helpers/hyrax/trophy_helper.rb +1 -1
  68. data/app/helpers/hyrax/url_helper.rb +1 -1
  69. data/app/indexers/hyrax/administrative_set_indexer.rb +8 -2
  70. data/app/indexers/hyrax/deep_indexing_service.rb +1 -1
  71. data/app/indexers/hyrax/file_set_indexer.rb +1 -0
  72. data/app/indexers/hyrax/pcdm_collection_indexer.rb +3 -1
  73. data/app/indexers/hyrax/thumbnail_indexer.rb +31 -0
  74. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +7 -7
  75. data/app/indexers/hyrax/valkyrie_indexer.rb +4 -2
  76. data/app/indexers/hyrax/valkyrie_work_indexer.rb +13 -0
  77. data/app/inputs/controlled_vocabulary_input.rb +2 -0
  78. data/app/jobs/change_depositor_event_job.rb +47 -0
  79. data/app/jobs/characterize_job.rb +66 -3
  80. data/app/jobs/concerns/hyrax/members_permission_job_behavior.rb +1 -1
  81. data/app/jobs/content_depositor_change_event_job.rb +2 -1
  82. data/app/jobs/hyrax/propagate_change_depositor_job.rb +32 -0
  83. data/app/jobs/inherit_permissions_job.rb +1 -1
  84. data/app/jobs/valkyrie_create_derivatives_job.rb +25 -0
  85. data/app/jobs/valkyrie_ingest_job.rb +124 -0
  86. data/app/models/admin_set.rb +2 -2
  87. data/app/models/collection_branding_info.rb +8 -6
  88. data/app/models/concerns/hyrax/ability.rb +26 -5
  89. data/app/models/concerns/hyrax/collection_behavior.rb +2 -2
  90. data/app/models/concerns/hyrax/file_set/characterization.rb +7 -1
  91. data/app/models/concerns/hyrax/solr_document/metadata.rb +2 -0
  92. data/app/models/concerns/hyrax/solr_document_behavior.rb +9 -3
  93. data/app/models/file_download_stat.rb +4 -4
  94. data/app/models/hyrax/administrative_set.rb +36 -1
  95. data/app/models/hyrax/collection_type.rb +2 -2
  96. data/app/models/hyrax/default_administrative_set.rb +42 -0
  97. data/app/models/hyrax/file_metadata.rb +5 -1
  98. data/app/models/hyrax/file_set.rb +42 -1
  99. data/app/models/hyrax/pcdm_collection.rb +56 -0
  100. data/app/models/hyrax/permission_template.rb +11 -5
  101. data/app/models/hyrax/statistic.rb +31 -4
  102. data/app/models/hyrax/work.rb +91 -0
  103. data/app/models/proxy_deposit_request.rb +1 -1
  104. data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
  105. data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
  106. data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
  107. data/app/presenters/hyrax/admin_set_presenter.rb +2 -2
  108. data/app/presenters/hyrax/file_set_presenter.rb +2 -0
  109. data/app/presenters/hyrax/menu_presenter.rb +4 -0
  110. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +3 -3
  111. data/app/presenters/hyrax/work_show_presenter.rb +9 -2
  112. data/app/presenters/hyrax/work_usage.rb +1 -0
  113. data/app/search_builders/hyrax/README.md +1 -1
  114. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +2 -2
  115. data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +44 -4
  116. data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +2 -2
  117. data/app/search_builders/hyrax/my/collections_search_builder.rb +12 -5
  118. data/app/services/hyrax/access_control_list.rb +13 -0
  119. data/app/services/hyrax/admin_set_create_service.rb +94 -48
  120. data/app/services/hyrax/analytics/google/events.rb +37 -0
  121. data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
  122. data/app/services/hyrax/analytics/google/visits.rb +44 -0
  123. data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
  124. data/app/services/hyrax/analytics/google.rb +204 -0
  125. data/app/services/hyrax/analytics/matomo.rb +193 -0
  126. data/app/services/hyrax/analytics/results.rb +79 -0
  127. data/app/services/hyrax/analytics.rb +12 -82
  128. data/app/services/hyrax/change_content_depositor_service.rb +2 -2
  129. data/app/services/hyrax/change_depositor_service.rb +70 -0
  130. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
  131. data/app/services/hyrax/collections/nested_collection_query_service.rb +32 -15
  132. data/app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb +45 -0
  133. data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +7 -2
  134. data/app/services/hyrax/custom_queries/navigators/parent_work_navigator.rb +54 -0
  135. data/app/services/hyrax/default_middleware_stack.rb +3 -0
  136. data/app/services/hyrax/file_set_derivatives_service.rb +21 -2
  137. data/app/services/hyrax/file_set_type_service.rb +2 -5
  138. data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
  139. data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +3 -1
  140. data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
  141. data/app/services/hyrax/listeners/file_metadata_listener.rb +38 -0
  142. data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
  143. data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
  144. data/app/services/hyrax/listeners/member_cleanup_listener.rb +26 -3
  145. data/app/services/hyrax/listeners/metadata_index_listener.rb +48 -3
  146. data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
  147. data/app/services/hyrax/listeners/proxy_deposit_listener.rb +16 -8
  148. data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
  149. data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
  150. data/app/services/hyrax/listeners.rb +8 -0
  151. data/app/services/hyrax/location_service.rb +33 -0
  152. data/app/services/hyrax/multiple_membership_checker.rb +44 -1
  153. data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
  154. data/app/services/hyrax/restriction_service.rb +4 -0
  155. data/app/services/hyrax/simple_schema_loader.rb +5 -1
  156. data/app/services/hyrax/solr_query_service.rb +12 -7
  157. data/app/services/hyrax/statistics/users/over_time.rb +8 -5
  158. data/app/services/hyrax/statistics/works/over_time.rb +10 -0
  159. data/app/services/hyrax/thumbnail_path_service.rb +1 -1
  160. data/app/services/hyrax/work_uploads_handler.rb +2 -9
  161. data/app/utils/hyrax/data_destroyers/collection_branding_destroyer.rb +29 -0
  162. data/app/utils/hyrax/data_destroyers/collection_types_destroyer.rb +26 -0
  163. data/app/utils/hyrax/data_destroyers/default_admin_set_id_cache_destroyer.rb +26 -0
  164. data/app/utils/hyrax/data_destroyers/featured_works_destroyer.rb +27 -0
  165. data/app/utils/hyrax/data_destroyers/permission_templates_destroyer.rb +30 -0
  166. data/app/utils/hyrax/data_destroyers/repository_metadata_destroyer.rb +42 -0
  167. data/app/utils/hyrax/data_destroyers/stats_destroyer.rb +33 -0
  168. data/app/utils/hyrax/data_maintenance.rb +51 -0
  169. data/app/utils/hyrax/required_data_seeder.rb +21 -0
  170. data/app/utils/hyrax/required_data_seeders/collection_seeder.rb +26 -0
  171. data/app/utils/hyrax/required_data_seeders/collection_type_seeder.rb +36 -0
  172. data/app/utils/hyrax/test_data_seeder.rb +24 -0
  173. data/app/utils/hyrax/test_data_seeders/collection_seeder.rb +91 -0
  174. data/app/utils/hyrax/test_data_seeders/collection_type_seeder.rb +72 -0
  175. data/app/utils/hyrax/test_data_seeders/user_seeder.rb +52 -0
  176. data/app/validators/hyrax/collection_membership_validator.rb +38 -0
  177. data/app/views/catalog/_index_header_list_hyrax_pcdm_collection.html.erb +4 -0
  178. data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +2 -2
  179. data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +2 -2
  180. data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +2 -2
  181. data/app/views/hyrax/admin/admin_sets/_form_workflow.erb +1 -1
  182. data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
  183. data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
  184. data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
  185. data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
  186. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
  187. data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
  188. data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
  189. data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
  190. data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
  191. data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
  192. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
  193. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
  194. data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
  195. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
  196. data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
  197. data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
  198. data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
  199. data/app/views/hyrax/admin/stats/show.html.erb +1 -1
  200. data/app/views/hyrax/base/_form.html.erb +1 -1
  201. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
  202. data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
  203. data/app/views/hyrax/base/show.html.erb +6 -0
  204. data/app/views/hyrax/collections/show.html.erb +4 -0
  205. data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
  206. data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
  207. data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
  208. data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
  209. data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
  210. data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
  211. data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
  212. data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
  213. data/app/views/hyrax/dashboard/collections/_default_group.html.erb +2 -2
  214. data/app/views/hyrax/dashboard/collections/_form.html.erb +23 -16
  215. data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +6 -3
  216. data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
  217. data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +3 -3
  218. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +2 -2
  219. data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
  220. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
  221. data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
  222. data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
  223. data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
  224. data/app/views/hyrax/file_sets/show.html.erb +6 -0
  225. data/app/views/hyrax/my/_facet_pagination.html.erb +12 -9
  226. data/app/views/hyrax/my/_work_action_menu.html.erb +8 -9
  227. data/app/views/hyrax/my/collections/_default_group.html.erb +2 -2
  228. data/app/views/hyrax/my/collections/_list_collections.html.erb +2 -2
  229. data/app/views/hyrax/my/collections/index.html.erb +4 -3
  230. data/app/views/hyrax/my/works/_default_group.html.erb +1 -1
  231. data/app/views/hyrax/my/works/_list_works.html.erb +1 -2
  232. data/app/views/hyrax/my/works/index.html.erb +4 -2
  233. data/app/views/hyrax/stats/_downloads.html.erb +18 -0
  234. data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
  235. data/app/views/hyrax/stats/work.html.erb +17 -9
  236. data/app/views/layouts/_head_tag_content.html.erb +7 -2
  237. data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
  238. data/app/views/shared/_matomo.html.erb +15 -0
  239. data/chart/hyrax/Chart.yaml +2 -2
  240. data/chart/hyrax/README.md +22 -1
  241. data/chart/hyrax/values.yaml +1 -1
  242. data/config/i18n-tasks.yml +2 -2
  243. data/config/initializers/listeners.rb +5 -6
  244. data/config/locales/hyrax.de.yml +200 -5
  245. data/config/locales/hyrax.en.yml +201 -21
  246. data/config/locales/hyrax.es.yml +204 -9
  247. data/config/locales/hyrax.fr.yml +196 -1
  248. data/config/locales/hyrax.it.yml +197 -2
  249. data/config/locales/hyrax.pt-BR.yml +196 -1
  250. data/config/locales/hyrax.zh.yml +196 -1
  251. data/config/metadata/basic_metadata.yaml +2 -0
  252. data/config/metadata/core_metadata.yaml +1 -1
  253. data/config/routes.rb +4 -0
  254. data/docker-compose.yml +48 -42
  255. data/documentation/developing-your-hyrax-based-app.md +2 -2
  256. data/documentation/legacyREADME.md +1 -1
  257. data/hyrax.gemspec +3 -1
  258. data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
  259. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +0 -13
  260. data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
  261. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +3 -1
  262. data/lib/hyrax/administrative_set_name.rb +18 -0
  263. data/lib/hyrax/collection_name.rb +2 -0
  264. data/lib/hyrax/configuration.rb +77 -5
  265. data/lib/hyrax/controlled_vocabularies/location.rb +9 -2
  266. data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +42 -0
  267. data/lib/hyrax/controlled_vocabularies.rb +1 -0
  268. data/lib/hyrax/engine.rb +7 -6
  269. data/lib/hyrax/publisher.rb +49 -0
  270. data/lib/hyrax/schema.rb +16 -13
  271. data/lib/hyrax/specs/capybara.rb +1 -1
  272. data/lib/hyrax/specs/shared_specs/hydra_works.rb +11 -4
  273. data/lib/hyrax/specs/shared_specs/indexers.rb +117 -3
  274. data/lib/hyrax/transactions/admin_set_create.rb +23 -0
  275. data/lib/hyrax/transactions/admin_set_destroy.rb +22 -0
  276. data/lib/hyrax/transactions/admin_set_update.rb +21 -0
  277. data/lib/hyrax/transactions/collection_destroy.rb +22 -0
  278. data/lib/hyrax/transactions/collection_update.rb +3 -2
  279. data/lib/hyrax/transactions/container.rb +97 -22
  280. data/lib/hyrax/transactions/create_work.rb +3 -0
  281. data/lib/hyrax/transactions/destroy_work.rb +3 -0
  282. data/lib/hyrax/transactions/steps/apply_collection_permission_template.rb +2 -0
  283. data/lib/hyrax/transactions/steps/apply_permission_template.rb +2 -0
  284. data/lib/hyrax/transactions/steps/apply_visibility.rb +2 -0
  285. data/lib/hyrax/transactions/steps/change_depositor.rb +46 -0
  286. data/lib/hyrax/transactions/steps/check_for_empty_admin_set.rb +36 -0
  287. data/lib/hyrax/transactions/steps/delete_access_control.rb +32 -0
  288. data/lib/hyrax/transactions/steps/delete_resource.rb +19 -3
  289. data/lib/hyrax/transactions/steps/destroy_work.rb +3 -1
  290. data/lib/hyrax/transactions/steps/ensure_permission_template.rb +2 -0
  291. data/lib/hyrax/transactions/steps/save.rb +24 -6
  292. data/lib/hyrax/transactions/steps/save_access_control.rb +2 -2
  293. data/lib/hyrax/transactions/steps/save_work.rb +3 -0
  294. data/lib/hyrax/transactions/steps/set_user_as_creator.rb +41 -0
  295. data/lib/hyrax/transactions/steps/update_work_members.rb +51 -0
  296. data/lib/hyrax/transactions/update_work.rb +4 -3
  297. data/lib/hyrax/transactions/work_create.rb +1 -1
  298. data/lib/hyrax/transactions/work_destroy.rb +2 -1
  299. data/lib/hyrax/transactions/work_update.rb +19 -0
  300. data/lib/hyrax/version.rb +1 -1
  301. data/lib/tasks/regenerate_derivatives.rake +1 -1
  302. data/lib/wings/attribute_transformer.rb +5 -1
  303. data/lib/wings/setup.rb +18 -1
  304. data/lib/wings/valkyrie/persister.rb +18 -0
  305. data/lib/wings/valkyrie/query_service.rb +2 -1
  306. data/lib/wings/valkyrie/storage.rb +7 -1
  307. data/template.rb +1 -1
  308. data/vendor/assets/javascripts/morris/morris.min.js +1 -7
  309. data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
  310. metadata +124 -11
  311. data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ module Hyrax
3
+ # This class stores the id of the default `Hyrax::AdministrativeSet`. This is
4
+ # used to populate a cache of the default admin set in Hyrax::Configuration.
5
+ #
6
+ # @see Hyrax::Configuration.default_admin_set
7
+ # @see Hyrax::Configuration.default_admin_set_id
8
+ # @see Hyrax::Configuration.reset_default_admin_set
9
+ class DefaultAdministrativeSet < ActiveRecord::Base
10
+ self.table_name = 'hyrax_default_administrative_set'
11
+
12
+ class << self
13
+ # Set the default admin set id in the first record.
14
+ # @param default_admin_set_id [String | Valkyrie::ID] id of the new default admin set
15
+ def update(default_admin_set_id:)
16
+ validate_id(default_admin_set_id)
17
+ Hyrax.config.reset_default_admin_set
18
+
19
+ # saving default_admin_set_id for the first time
20
+ return new(default_admin_set_id: default_admin_set_id.to_s).save if count.zero?
21
+
22
+ # replacing previously saved default_admin_set_id
23
+ existing = first
24
+ existing.default_admin_set_id = default_admin_set_id.to_s
25
+ existing.save
26
+ end
27
+
28
+ def save_supported?
29
+ ActiveRecord::Base.connection.table_exists? table_name
30
+ end
31
+
32
+ private
33
+
34
+ def validate_id(id)
35
+ # The id is validated prior to updating because a bad default admin set
36
+ # will cause lots of problems.
37
+ return true if id.is_a?(String) || id.is_a?(Valkyrie::ID)
38
+ raise ArgumentError, "default_admin_set_id must be a non-blank String or Valkyrie::ID"
39
+ end
40
+ end
41
+ end
42
+ end
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Hyrax
4
4
  class FileMetadata < Valkyrie::Resource
5
+ # Include mime-types for Hydra Derivatives mime-type checking. We may want
6
+ # to move this logic someday.
7
+ include Hydra::Works::MimeTypes
8
+
5
9
  GENERIC_MIME_TYPE = 'application/octet-stream'
6
10
 
7
11
  ##
@@ -42,7 +46,7 @@ module Hyrax
42
46
  attribute :label, ::Valkyrie::Types::Set
43
47
  attribute :original_filename, ::Valkyrie::Types::String
44
48
  attribute :mime_type, ::Valkyrie::Types::String.default(GENERIC_MIME_TYPE)
45
- attribute :type, ::Valkyrie::Types::Set.default([Use::ORIGINAL_FILE].freeze)
49
+ attribute :type, ::Valkyrie::Types::Set.default([Use::ORIGINAL_FILE])
46
50
 
47
51
  # attributes set by fits
48
52
  attribute :format_label, ::Valkyrie::Types::Set
@@ -4,6 +4,30 @@ module Hyrax
4
4
  ##
5
5
  # Valkyrie model for `FileSet` domain objects in the Hydra Works model.
6
6
  #
7
+ # ## Relationships
8
+ #
9
+ # ### File Set and Work
10
+ #
11
+ # * Defined: The relationship is defined by the inverse relationship stored in the
12
+ # work's `:member_ids` attribute.
13
+ # * Tested: The work tests the relationship.
14
+ # * File Set to Work: (1..1) A file set must be in one and only one work.
15
+ #
16
+ # @example Get work for a file set:
17
+ # work = Hyrax.custom_queries.find_parent_work(resource: file_set)
18
+ #
19
+ # * Work to File Set: (0..m) A work can have many file sets.
20
+ # * See Hyrax::Work for code to get and set file sets for the work.
21
+ #
22
+ # ### File Set and File (TBD)
23
+ #
24
+ # @see Hyrax::Work
25
+ # @see Hyrax::CustomQueries::Navigators::ParentWorkNavigator#find_parent_work
26
+ #
27
+ # @todo The description in Hydra::Works Shared Modeling is out of date and uses
28
+ # terminology to describe the relationships that is no longer used in code.
29
+ # Update the model and link to it. This can be a simple relationship diagram
30
+ # with a link to the original Works Shared Modeling for historical perspective.
7
31
  # @see https://wiki.duraspace.org/display/samvera/Hydra%3A%3AWorks+Shared+Modeling
8
32
  class FileSet < Hyrax::Resource
9
33
  include Hyrax::Schema(:core_metadata)
@@ -15,11 +39,28 @@ module Hyrax
15
39
  end
16
40
  end
17
41
 
42
+ class_attribute :characterization_proxy
43
+ self.characterization_proxy = Hyrax.config.characterization_proxy
44
+
18
45
  attribute :file_ids, Valkyrie::Types::Array.of(Valkyrie::Types::ID) # id for FileMetadata resources
46
+ attribute :thumbnail_id, Valkyrie::Types::ID.optional # id for FileMetadata resource
19
47
  attribute :original_file_id, Valkyrie::Types::ID # id for FileMetadata resource
20
- attribute :thumbnail_id, Valkyrie::Types::ID # id for FileMetadata resource
21
48
  attribute :extracted_text_id, Valkyrie::Types::ID # id for FileMetadata resource
22
49
 
50
+ ##
51
+ # @return [Valkyrie::ID]
52
+ def representative_id
53
+ id
54
+ end
55
+
56
+ ##
57
+ # @return [Valkyrie::ID]
58
+ # If one is set then return it, otherwise use self as the ID to allow for
59
+ # derivative generators to find the on-disk path for the thumbnail.
60
+ def thumbnail_id
61
+ self.[](:thumbnail_id) || id
62
+ end
63
+
23
64
  ##
24
65
  # @return [Boolean] true
25
66
  def pcdm_object?
@@ -5,6 +5,40 @@ require_dependency 'hyrax/collection_name'
5
5
  module Hyrax
6
6
  ##
7
7
  # Valkyrie model for Collection domain objects in the Hydra Works model.
8
+ #
9
+ # ## Relationships
10
+ #
11
+ # ### Collection and Collection (TBA)
12
+ #
13
+ # ### Collection and Work
14
+ #
15
+ # * Defined: The relationship is defined by the inverse relationship stored in the
16
+ # work's `:member_of_collection_ids` attribute.
17
+ # * Tested: The work tests the relationship.
18
+ # * Collection to Work: (0..m) A collection can have many works.
19
+ #
20
+ # @example Get works in a collection:
21
+ # works = Hyrax.custom_queries.find_child_works(resource: collection)
22
+ #
23
+ # * Work to Collection: (0..m) A work can be in many collections.
24
+ # * See Hyrax::Work for code to get and set collections for the work.
25
+ #
26
+ # @note Some collection types limit a work to belong to one and only one collection of that type.
27
+ #
28
+ # ### All children
29
+ #
30
+ # * There are additional methods for finding all children without respect to
31
+ # the child's type.
32
+ #
33
+ # @example Get works and child collections in a collection using:
34
+ # members = Hyrax.custom_queries.find_members_of(resource: collection)
35
+ #
36
+ # @see Hyrax::Work
37
+ #
38
+ # @see Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator#find_child_collections
39
+ # @see Hyrax::CustomQueries::Navigators::ChildWorksNavigator#find_child_works
40
+ # @see Hyrax::CustomQueries::Navigators::CollectionMembers#find_members_of
41
+ #
8
42
  class PcdmCollection < Hyrax::Resource
9
43
  include Hyrax::Schema(:core_metadata)
10
44
  include Hyrax::Schema(:basic_metadata)
@@ -32,5 +66,27 @@ module Hyrax
32
66
  def pcdm_object?
33
67
  true
34
68
  end
69
+
70
+ def permission_manager
71
+ @permission_manager ||= Hyrax::PermissionManager.new(resource: self)
72
+ end
73
+
74
+ def visibility=(value)
75
+ visibility_writer.assign_access_for(visibility: value)
76
+ end
77
+
78
+ def visibility
79
+ visibility_reader.read
80
+ end
81
+
82
+ protected
83
+
84
+ def visibility_writer
85
+ Hyrax::VisibilityWriter.new(resource: self)
86
+ end
87
+
88
+ def visibility_reader
89
+ Hyrax::VisibilityReader.new(resource: self)
90
+ end
35
91
  end
36
92
  end
@@ -4,7 +4,7 @@ module Hyrax
4
4
  # Holds policy data about the workflow and permissions applied objects when
5
5
  # they are deposited through an Administrative Set or a Collection. Each
6
6
  # template record has a {#source} (through {#source_id}); the template's
7
- # rules inform the behavior of objects deposited through that {#source_model}.
7
+ # rules inform the behavior of objects deposited through that {#source}.
8
8
  #
9
9
  # The {PermissionTemplate} specifies:
10
10
  #
@@ -81,6 +81,10 @@ module Hyrax
81
81
  # A bit of an analogue for a `belongs_to :source_model` as it crosses from Fedora to the DB
82
82
  # @return [AdminSet, ::Collection]
83
83
  # @raise [Hyrax::ObjectNotFoundError] when neither an AdminSet or Collection is found
84
+ # @note This method will eventually be replaced by #source which returns a Hyrax::Resource
85
+ # object. Many methods are equally able to process both Hyrax::Resource and
86
+ # ActiveFedora::Base. Only call this method if you need the ActiveFedora::Base object.
87
+ # @see #source
84
88
  def source_model
85
89
  ActiveFedora::Base.find(source_id)
86
90
  rescue ActiveFedora::ObjectNotFoundError
@@ -88,11 +92,11 @@ module Hyrax
88
92
  end
89
93
 
90
94
  # A bit of an analogue for a `belongs_to :admin_set` as it crosses from Fedora to the DB
91
- # @deprecated Use #source_model instead
95
+ # @deprecated Use #source instead
92
96
  # @return [AdminSet]
93
97
  # @raise [Hyrax::ObjectNotFoundError] when the we cannot find the AdminSet
94
98
  def admin_set
95
- Deprecation.warn('Use #source_model instead')
99
+ Deprecation.warn("#admin_set is deprecated; use #source instead.")
96
100
  return AdminSet.find(source_id) if AdminSet.exists?(source_id)
97
101
  raise Hyrax::ObjectNotFoundError
98
102
  rescue ActiveFedora::ActiveFedoraError # TODO: remove the rescue when active_fedora issue #1276 is fixed
@@ -100,11 +104,11 @@ module Hyrax
100
104
  end
101
105
 
102
106
  # A bit of an analogue for a `belongs_to :collection` as it crosses from Fedora to the DB
103
- # @deprecated Use #source_model instead
107
+ # @deprecated Use #source instead
104
108
  # @return [Collection]
105
109
  # @raise [Hyrax::ObjectNotFoundError] when the we cannot find the Collection
106
110
  def collection
107
- Deprecation.warn('Use #source_model instead')
111
+ Deprecation.warn("#collection is deprecated; use #source instead.")
108
112
  return ::Collection.find(source_id) if ::Collection.exists?(source_id)
109
113
  raise Hyrax::ObjectNotFoundError
110
114
  rescue ActiveFedora::ActiveFedoraError # TODO: remove the rescue when active_fedora issue #1276 is fixed
@@ -216,10 +220,12 @@ module Hyrax
216
220
  end
217
221
 
218
222
  ##
223
+ # @deprecated Use #reset_access_controls_for instead
219
224
  # @param interpret_visibility [Boolean] whether to retain the existing
220
225
  # visibility when applying permission template ACLs
221
226
  # @return [Boolean]
222
227
  def reset_access_controls(interpret_visibility: false)
228
+ Deprecation.warn("#reset_access_controls is deprecated; use #reset_access_controls_for instead.")
223
229
  reset_access_controls_for(collection: source_model,
224
230
  interpret_visibility: interpret_visibility)
225
231
  end
@@ -34,13 +34,40 @@ module Hyrax
34
34
  Rails.logger.error("Google Analytics profile has not been established. Unable to fetch statistics.")
35
35
  return []
36
36
  end
37
- profile.hyrax__pageview(sort: 'date',
38
- start_date: start_date,
39
- end_date: Date.yesterday,
40
- limit: 10_000)
37
+ profile.hyrax__analytics__google__pageviews(sort: 'date',
38
+ start_date: start_date,
39
+ end_date: Date.yesterday,
40
+ limit: 10_000)
41
41
  .for_path(path)
42
42
  end
43
43
 
44
+ def query_works(query)
45
+ models = Hyrax.config.curation_concerns.map { |m| "\"#{m}\"" }
46
+ ActiveFedora::SolrService.query("has_model_ssim:(#{models.join(' OR ')})", fl: query, rows: 100_000)
47
+ end
48
+
49
+ def work_types
50
+ results = query_works("human_readable_type_tesim")
51
+ results.group_by { |result| result['human_readable_type_tesim'].join('') }.transform_values(&:count)
52
+ end
53
+
54
+ def resource_types
55
+ results = query_works("resource_type_tesim")
56
+ resource_types = []
57
+ results.each do |y|
58
+ if y["resource_type_tesim"].nil? || (y["resource_type_tesim"] == [""])
59
+ resource_types.push("Unknown")
60
+ elsif y["resource_type_tesim"].count > 1
61
+ y["resource_type_tesim"].each do |t|
62
+ resource_types.push(t)
63
+ end
64
+ else
65
+ resource_types.push(y["resource_type_tesim"].join(""))
66
+ end
67
+ end
68
+ resource_types.group_by { |rt| rt }.transform_values(&:count)
69
+ end
70
+
44
71
  private
45
72
 
46
73
  def cached_stats(object, start_date, _method)
@@ -4,6 +4,97 @@ module Hyrax
4
4
  ##
5
5
  # Valkyrie model for `Work` domain objects in the Hydra Works model.
6
6
  #
7
+ # ## Relationships
8
+ #
9
+ # ### Administrative Set and Work
10
+ #
11
+ # * Defined: The relationship is defined by the work's `:admin_set_id` attribute.
12
+ # * Tested: The relationship is tested in shared spec `'a Hyrax::Work'` by testing
13
+ # `#admin_set_id`. Shared specs are defined in /lib/hyrax/specs/shared_specs/hydra_works.rb.
14
+ # * Administrative Set to Work: (1..m) An admin set can have many works.
15
+ # * See Hyrax::AdministrativeSet for code to get works in an admin set.
16
+ # * Work to Administrative Set: (1..1) A work must be in one and only one admin set.
17
+ #
18
+ # @example Set admin set for a work:
19
+ # work.admin_set_id = admin_set.id
20
+ # @example Get admin set a work is in:
21
+ # admin_set = Hyrax.query_service.find_by(id: work.admin_set_id)
22
+ #
23
+ # ### Collection and Work
24
+ #
25
+ # * Defined: The relationship is defined by the work's `:member_of_collection_ids` attribute.
26
+ # * Tested: The relationship is tested in shared spec `'a Hyrax::Work'` by testing
27
+ # `it_behaves_like 'belongs to collections'`. Shared specs are defined in /lib/hyrax/specs/shared_specs/hydra_works.rb.
28
+ # * Collection to Work: (0..m) A collection can have many works.
29
+ # * See Hyrax::PcdmCollection for code to get works in a collection.
30
+ # * Work to Collection: (0..m) A work can be in many collections.
31
+ #
32
+ # @example Add a work to a collection using Hyrax::CollectionMemberService (multiple method options)
33
+ # Hyrax::CollectionMemberService.add_members(collection_id: col.id, members: works, user: current_user)
34
+ # @example Get collections a work is in:
35
+ # collections = Hyrax.custom_queries.find_collections_for(resource: work)
36
+ #
37
+ # @note Some collection types limit a work to belong to one and only one collection of that type.
38
+ #
39
+ # ### Work and Work
40
+ #
41
+ # * Defined: The relationship is defined in the parent work's `:member_ids` attribute.
42
+ # * Tested: The relationship is tested in shared spec `'a Hyrax::Work'` by testing
43
+ # `it_behaves_like 'has_members'`. Shared specs are defined in /lib/hyrax/specs/shared_specs/hydra_works.rb.
44
+ # * Work to child Work: (0..m) A work can have many child works.
45
+ #
46
+ # @example Add a child work to a work:
47
+ # Hyrax::Transactions::Container['work_resource.add_to_parent']
48
+ # .call(child_work, parent_id: parent_work.id, user: current_user)
49
+ # @example Get child works:
50
+ # works = Hyrax.custom_queries.find_child_works(resource: parent_work)
51
+ #
52
+ # * Work to parent Work: (0..1) A work can be in at most one parent work.
53
+ #
54
+ # @example Get parent work:
55
+ # parent_work = Hyrax.custom_queries.find_parent_work(resource: child_work)
56
+ #
57
+ # @note `:member_ids` holds ids of child works and file sets.
58
+ #
59
+ # ### Work and File Set
60
+ #
61
+ # * Defined: The relationship is defined in the parent work's `:member_ids` attribute.
62
+ # * Tested: The relationship is tested in shared spec `'a Hyrax::Work'` by testing
63
+ # `it_behaves_like 'has_members'`. Shared specs are defined in /lib/hyrax/specs/shared_specs/hydra_works.rb.
64
+ # * Work to File Set: (0..m) A work can have many file sets.
65
+ # @example Add a file set to a work (code from Hyrax::WorkUploadsHandler#append_to_work)
66
+ # work.member_ids << file_set.id
67
+ # work.representative_id = file_set.id if work.respond_to?(:representative_id) && work.representative_id.blank?
68
+ # work.thumbnail_id = file_set.id if work.respond_to?(:thumbnail_id) && work.thumbnail_id.blank?
69
+ # Hyrax.persister.save(resource: work)
70
+ # Hyrax.publisher.publish('object.metadata.updated', object: work, user: files.first.user)
71
+ # @example Get file sets:
72
+ # file_sets = Hyrax.custom_queries.find_child_file_sets(resource: work)
73
+ #
74
+ # * File Set to Work: (1..1) A file set must be in one and only one work.
75
+ # * See Hyrax::FileSet for code to get the work a file set is in.
76
+ #
77
+ # @see Hyrax::AdministrativeSet
78
+ # @see Hyrax::PcdmCollection
79
+ # @see Hyrax::FileSet
80
+ #
81
+ # @see Hyrax::CollectionMemberService
82
+ # @see Hyrax::Transactions::Steps::AddToParent
83
+ # @see Hyrax::Transactions::Steps::AddFileSets
84
+ # @see Hyrax::WorksControllerBehavior
85
+ # @see Hyrax::WorkUploadsHandler#append_to_work
86
+ #
87
+ # @see Valkyrie query adapter's #find_by
88
+ # @see Hyrax::CustomQueries::Navigators::CollectionMembers#find_collections_for
89
+ # @see Hyrax::CustomQueries::Navigators::ParentWorkNavigator#find_parent_work
90
+ # @see Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator#find_child_file_sets
91
+ #
92
+ # @see /lib/hyrax/specs/shared_specs/hydra_works.rb
93
+ #
94
+ # @todo The description in Hydra::Works Shared Modeling is out of date and uses
95
+ # terminology to describe the relationships that is no longer used in code.
96
+ # Update the model and link to it. This can be a simple relationship diagram
97
+ # with a link to the original Works Shared Modeling for historical perspective.
7
98
  # @see https://wiki.lyrasis.org/display/samvera/Hydra::Works+Shared+Modeling
8
99
  class Work < Hyrax::Resource
9
100
  include Hyrax::Schema(:core_metadata)
@@ -129,7 +129,7 @@ class ProxyDepositRequest < ActiveRecord::Base
129
129
 
130
130
  # @param [TrueClass,FalseClass] reset (false) if true, reset the access controls. This revokes edit access from the depositor
131
131
  def transfer!(reset = false)
132
- ContentDepositorChangeEventJob.perform_later(work, receiving_user, reset)
132
+ Hyrax::ChangeDepositorService.call(work, receiving_user, reset)
133
133
  fulfill!(status: ACCEPTED)
134
134
  end
135
135
 
@@ -3,20 +3,22 @@ module Hyrax
3
3
  module Admin
4
4
  class DashboardPresenter
5
5
  # @return [Fixnum] the number of currently registered users
6
- def user_count
7
- ::User.where(guest: false).count
6
+ def user_count(start_date, end_date)
7
+ ::User.where(guest: false)
8
+ .where({ created_at: start_date.to_date.beginning_of_day..end_date.to_date.end_of_day })
9
+ .count
8
10
  end
9
11
 
10
12
  def repository_objects
11
13
  @repository_objects ||= Admin::RepositoryObjectPresenter.new
12
14
  end
13
15
 
14
- def repository_growth
15
- @repository_growth ||= Admin::RepositoryGrowthPresenter.new
16
+ def repository_growth(start_date, end_date)
17
+ @repository_growth ||= Admin::RepositoryGrowthPresenter.new(start_date, end_date)
16
18
  end
17
19
 
18
- def user_activity
19
- @user_activity ||= Admin::UserActivityPresenter.new
20
+ def user_activity(start_date, end_date)
21
+ @user_activity ||= Admin::UserActivityPresenter.new(start_date, end_date)
20
22
  end
21
23
  end
22
24
  end
@@ -2,26 +2,31 @@
2
2
  module Hyrax
3
3
  module Admin
4
4
  class RepositoryGrowthPresenter
5
- def initialize
6
- @x_min = 90.days.ago.beginning_of_day
5
+ def initialize(start_date, end_date)
6
+ @x_min = start_date
7
+ @x_max = end_date
7
8
  @date_format = ->(x) { x.strftime('%F') }
8
9
  end
9
10
 
10
11
  def as_json(*)
11
12
  works.to_a.zip(collections.to_a).map do |e|
12
- { y: e.first.first, a: e.first.last, b: e.last.last }
13
+ { y: e.first.first, works: e.first.last, collections: e.last.last }
13
14
  end
14
15
  end
15
16
 
16
17
  private
17
18
 
18
19
  def works
19
- Hyrax::Statistics::Works::OverTime.new(x_min: @x_min,
20
+ Hyrax::Statistics::Works::OverTime.new(delta_x: 1,
21
+ x_min: @x_min,
22
+ x_max: @x_max,
20
23
  x_output: @date_format).points
21
24
  end
22
25
 
23
26
  def collections
24
- Hyrax::Statistics::Collections::OverTime.new(x_min: @x_min,
27
+ Hyrax::Statistics::Collections::OverTime.new(delta_x: 1,
28
+ x_min: @x_min,
29
+ x_max: @x_max,
25
30
  x_output: @date_format).points
26
31
  end
27
32
  end
@@ -2,28 +2,24 @@
2
2
  module Hyrax
3
3
  module Admin
4
4
  class UserActivityPresenter
5
- def initialize
6
- @x_min = 90.days.ago.beginning_of_day
7
- @date_format = ->(x) { x.strftime('%b %-d') }
5
+ def initialize(start_date, end_date)
6
+ @x_min = start_date
7
+ @x_max = end_date
8
+ @date_format = ->(x) { x }
8
9
  end
9
10
 
10
11
  def as_json(*)
11
- new_users.to_a.zip(returning_users.to_a).map do |e|
12
- { y: e.first.first, a: e.first.last, b: e.last.try(:last) }
13
- end
12
+ new_users.to_a
14
13
  end
15
14
 
16
15
  private
17
16
 
18
17
  def new_users
19
- Hyrax::Statistics::Users::OverTime.new(x_min: @x_min,
18
+ Hyrax::Statistics::Users::OverTime.new(delta_x: 1,
19
+ x_min: @x_min,
20
+ x_max: @x_max,
20
21
  x_output: @date_format).points
21
22
  end
22
-
23
- # TODO: using google analytics
24
- def returning_users
25
- []
26
- end
27
23
  end
28
24
  end
29
25
  end
@@ -8,11 +8,11 @@ module Hyrax
8
8
  end
9
9
 
10
10
  def total_items
11
- Hyrax::SolrService.count("{!field f=isPartOf_ssim}#{id}")
11
+ Hyrax::SolrService.count("{!field f=#{Hyrax.config.admin_set_predicate.qname.last}_ssim}#{id}")
12
12
  end
13
13
 
14
14
  def total_viewable_items
15
- field_pairs = { "isPartOf_ssim" => id.to_s }
15
+ field_pairs = { "#{Hyrax.config.admin_set_predicate.qname.last}_ssim" => id.to_s }
16
16
  SolrQueryService.new
17
17
  .with_field_pairs(field_pairs: field_pairs)
18
18
  .accessible_by(ability: current_ability)
@@ -34,6 +34,8 @@ module Hyrax
34
34
  :original_file_id,
35
35
  to: :solr_document
36
36
 
37
+ delegate :member_of_collection_ids, to: :parent
38
+
37
39
  def workflow
38
40
  nil
39
41
  end
@@ -43,6 +43,10 @@ module Hyrax
43
43
  end
44
44
  end
45
45
 
46
+ def analytics_reporting_section?
47
+ %w[work_reports collection_reports].include?(controller_name)
48
+ end
49
+
46
50
  # Draw a collaspable menu section. The passed block should contain <li> items.
47
51
  def collapsable_section(text, id:, icon_class:, open:, &block)
48
52
  CollapsableSectionPresenter.new(view_context: view_context,
@@ -19,7 +19,7 @@ module Hyrax
19
19
  ##
20
20
  # @param [#member_ids] object
21
21
  # @param [::Ability] ability
22
- def initialize(object, ability)
22
+ def initialize(object, ability, _request = nil)
23
23
  @object = object
24
24
  @ability = ability
25
25
  end
@@ -97,7 +97,7 @@ module Hyrax
97
97
  # @return
98
98
  def presenter_for(document:, ability:)
99
99
  case document['has_model_ssim'].first
100
- when Hyrax::FileSet.name
100
+ when Hyrax::FileSet.name, ::FileSet.name # ActiveFedora FileSet within a Valkyrie Resource
101
101
  Hyrax::FileSetPresenter.new(document, ability)
102
102
  else
103
103
  Hyrax::WorkShowPresenter.new(document, ability)
@@ -111,7 +111,7 @@ module Hyrax
111
111
  query += "{!term f=generic_type_si}#{generic_type}" if generic_type
112
112
 
113
113
  Hyrax::SolrService
114
- .post(query, rows: 10_000)
114
+ .post(q: query, rows: 10_000)
115
115
  .fetch('response')
116
116
  .fetch('docs')
117
117
  end
@@ -10,10 +10,11 @@ module Hyrax
10
10
  attr_writer :member_presenter_factory
11
11
  attr_accessor :solr_document, :current_ability, :request
12
12
 
13
- class_attribute :collection_presenter_class
13
+ class_attribute :collection_presenter_class, :presenter_factory_class
14
14
 
15
15
  # modify this attribute to use an alternate presenter class for the collections
16
16
  self.collection_presenter_class = CollectionPresenter
17
+ self.presenter_factory_class = MemberPresenterFactory
17
18
 
18
19
  # Methods used by blacklight helpers
19
20
  delegate :has?, :first, :fetch, :export_formats, :export_as, to: :solr_document
@@ -304,7 +305,13 @@ module Hyrax
304
305
 
305
306
  def member_presenter_factory
306
307
  @member_presenter_factory ||=
307
- MemberPresenterFactory.new(solr_document, current_ability, request)
308
+ if solr_document.hydra_model < Valkyrie::Resource
309
+ PcdmMemberPresenterFactory.new(solr_document, current_ability)
310
+ else
311
+ self.class
312
+ .presenter_factory_class
313
+ .new(solr_document, current_ability, request)
314
+ end
308
315
  end
309
316
 
310
317
  def graph
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hyrax
4
+ # TODO: - Analytics do we still need this?
4
5
  # Follows the model established by {FileUsage}.
5
6
  #
6
7
  # Called by the stats controller, it finds cached work pageview data,
@@ -66,4 +66,4 @@ module Hyrax
66
66
  end
67
67
  ```
68
68
 
69
- There is no point having the other `filter_models` methods apply `:fq`s that we then try to undo or overwrite. In general, directly overwriting the whole `default_processor_chain` or solr parameters like `:fq` is less flexible than appending constraints sufficient for your use case. In particular, you might find that you have overwritten components that implement access controls, thereby making your SearchBuilder less useful and less secure. When in doubt, examine the actual solr queries produced.
69
+ There is no point having the other `filter_models` methods apply `:fq`s that we then try to undo or overwrite. In general, directly overwriting the whole `default_processor_chain` or solr parameters like `:fq` is less flexible than appending constraints sufficient for your use case. In particular, you might find that you have overwritten components that implement access controls, thereby making your SearchBuilder less useful and less secure. When in doubt, examine the actual solr queries produced.
@@ -9,7 +9,7 @@ module Hyrax
9
9
 
10
10
  # This overrides the models in FilterByType
11
11
  def models
12
- [::AdminSet, ::Collection, Hyrax.config.collection_model.safe_constantize].uniq.compact
12
+ [::AdminSet, Hyrax::AdministrativeSet, ::Collection, Hyrax.config.collection_class].uniq.compact
13
13
  end
14
14
 
15
15
  # adds a filter to exclude collections and admin sets created by the
@@ -19,7 +19,7 @@ module Hyrax
19
19
  return if current_ability.admin?
20
20
  clauses = [
21
21
  '-' + ActiveFedora::SolrQueryBuilder.construct_query_for_rel(depositor: current_user_key),
22
- '-' + ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::AdminSet.to_s, creator: current_user_key)
22
+ '-' + ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: Hyrax.config.admin_set_model, creator: current_user_key)
23
23
  ]
24
24
  solr_parameters[:fq] ||= []
25
25
  solr_parameters[:fq] += ["(#{clauses.join(' OR ')})"]