hyrax 3.1.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +8 -11
  3. data/.dassie/.env +1 -2
  4. data/.dassie/Gemfile +8 -4
  5. data/.dassie/app/controllers/catalog_controller.rb +6 -0
  6. data/.dassie/app/models/user.rb +0 -2
  7. data/.dassie/config/analytics.yml +12 -5
  8. data/.dassie/config/environments/development.rb +2 -0
  9. data/.dassie/config/initializers/hyrax.rb +13 -1
  10. data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
  11. data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
  12. data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
  13. data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
  14. data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
  15. data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
  16. data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
  17. data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
  18. data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
  19. data/.dassie/db/schema.rb +20 -1
  20. data/.env +7 -4
  21. data/.github/workflows/main.yml +17 -0
  22. data/.github/workflows/release.yml +17 -0
  23. data/.gitignore +4 -0
  24. data/.regen +1 -1
  25. data/.rubocop_fixme.yml +3 -1
  26. data/CONTAINERS.md +13 -10
  27. data/Dockerfile +4 -4
  28. data/README.md +37 -0
  29. data/app/actors/hyrax/actors/base_actor.rb +1 -1
  30. data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
  31. data/app/actors/hyrax/actors/file_actor.rb +6 -4
  32. data/app/actors/hyrax/actors/file_set_actor.rb +2 -0
  33. data/app/actors/hyrax/actors/transfer_request_actor.rb +3 -7
  34. data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
  35. data/app/assets/javascripts/hyrax/analytics_events.js +75 -0
  36. data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +1 -3
  37. data/app/assets/javascripts/hyrax/collapse.js +24 -0
  38. data/app/assets/javascripts/hyrax/collections.js +1 -2
  39. data/app/assets/javascripts/hyrax/ga_events.js +2 -8
  40. data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
  41. data/app/assets/javascripts/hyrax.js +2 -1
  42. data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
  43. data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
  44. data/app/authorities/qa/authorities/collections.rb +4 -5
  45. data/app/authorities/qa/authorities/find_works.rb +1 -1
  46. data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
  47. data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
  48. data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +13 -5
  49. data/app/controllers/concerns/hyrax/controller.rb +56 -2
  50. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +83 -59
  51. data/app/controllers/hyrax/admin/admin_sets_controller.rb +105 -36
  52. data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
  53. data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
  54. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
  55. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +17 -21
  56. data/app/controllers/hyrax/batch_edits_controller.rb +12 -3
  57. data/app/controllers/hyrax/batch_uploads_controller.rb +4 -0
  58. data/app/controllers/hyrax/citations_controller.rb +1 -1
  59. data/app/controllers/hyrax/collections_controller.rb +6 -1
  60. data/app/controllers/hyrax/dashboard/collection_members_controller.rb +12 -9
  61. data/app/controllers/hyrax/dashboard/collections_controller.rb +119 -37
  62. data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
  63. data/app/controllers/hyrax/dashboard_controller.rb +8 -0
  64. data/app/controllers/hyrax/my_controller.rb +4 -4
  65. data/app/controllers/hyrax/stats_controller.rb +3 -1
  66. data/app/controllers/hyrax/workflow_actions_controller.rb +8 -5
  67. data/app/forms/hyrax/forms/administrative_set_form.rb +80 -0
  68. data/app/forms/hyrax/forms/batch_edit_form.rb +1 -1
  69. data/app/forms/hyrax/forms/collection_form.rb +2 -2
  70. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +33 -8
  71. data/app/forms/hyrax/forms/pcdm_collection_form.rb +68 -0
  72. data/app/forms/hyrax/forms/permission_template_form.rb +17 -9
  73. data/app/forms/hyrax/forms/resource_form.rb +24 -15
  74. data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
  75. data/app/helpers/hyrax/collections_helper.rb +14 -0
  76. data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
  77. data/app/helpers/hyrax/membership_helper.rb +1 -1
  78. data/app/helpers/hyrax/trophy_helper.rb +1 -1
  79. data/app/helpers/hyrax/url_helper.rb +1 -1
  80. data/app/indexers/hyrax/administrative_set_indexer.rb +12 -6
  81. data/app/indexers/hyrax/deep_indexing_service.rb +1 -1
  82. data/app/indexers/hyrax/file_set_indexer.rb +1 -0
  83. data/app/indexers/hyrax/pcdm_collection_indexer.rb +5 -1
  84. data/app/indexers/hyrax/thumbnail_indexer.rb +31 -0
  85. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +7 -7
  86. data/app/indexers/hyrax/valkyrie_indexer.rb +4 -2
  87. data/app/indexers/hyrax/valkyrie_work_indexer.rb +13 -0
  88. data/app/inputs/controlled_vocabulary_input.rb +2 -0
  89. data/app/jobs/change_depositor_event_job.rb +47 -0
  90. data/app/jobs/characterize_job.rb +66 -3
  91. data/app/jobs/concerns/hyrax/members_permission_job_behavior.rb +1 -1
  92. data/app/jobs/content_depositor_change_event_job.rb +2 -1
  93. data/app/jobs/hyrax/propagate_change_depositor_job.rb +32 -0
  94. data/app/jobs/inherit_permissions_job.rb +1 -1
  95. data/app/jobs/valkyrie_create_derivatives_job.rb +25 -0
  96. data/app/jobs/valkyrie_ingest_job.rb +124 -0
  97. data/app/models/admin_set.rb +18 -7
  98. data/app/models/collection_branding_info.rb +8 -6
  99. data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
  100. data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
  101. data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
  102. data/app/models/concerns/hyrax/ability.rb +28 -7
  103. data/app/models/concerns/hyrax/collection_behavior.rb +2 -2
  104. data/app/models/concerns/hyrax/file_set/characterization.rb +7 -1
  105. data/app/models/concerns/hyrax/solr_document/metadata.rb +2 -0
  106. data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -5
  107. data/app/models/file_download_stat.rb +4 -4
  108. data/app/models/hyrax/administrative_set.rb +43 -2
  109. data/app/models/hyrax/collection_type.rb +2 -2
  110. data/app/models/hyrax/default_administrative_set.rb +42 -0
  111. data/app/models/hyrax/file_metadata.rb +5 -1
  112. data/app/models/hyrax/file_set.rb +42 -1
  113. data/app/models/hyrax/pcdm_collection.rb +56 -0
  114. data/app/models/hyrax/permission.rb +1 -1
  115. data/app/models/hyrax/permission_template.rb +30 -10
  116. data/app/models/hyrax/statistic.rb +31 -4
  117. data/app/models/hyrax/work.rb +92 -0
  118. data/app/models/hyrax/workflow_action_info.rb +16 -0
  119. data/app/models/proxy_deposit_request.rb +1 -1
  120. data/app/models/sipity/comment.rb +17 -0
  121. data/app/models/sipity.rb +11 -2
  122. data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
  123. data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
  124. data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
  125. data/app/presenters/hyrax/admin_set_presenter.rb +10 -5
  126. data/app/presenters/hyrax/collection_presenter.rb +3 -3
  127. data/app/presenters/hyrax/file_set_presenter.rb +2 -0
  128. data/app/presenters/hyrax/menu_presenter.rb +4 -0
  129. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +3 -3
  130. data/app/presenters/hyrax/work_show_presenter.rb +11 -3
  131. data/app/presenters/hyrax/work_usage.rb +1 -0
  132. data/app/search_builders/hyrax/README.md +1 -1
  133. data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
  134. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +2 -2
  135. data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +44 -4
  136. data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +2 -2
  137. data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
  138. data/app/search_builders/hyrax/filter_by_type.rb +1 -2
  139. data/app/search_builders/hyrax/my/collections_search_builder.rb +12 -5
  140. data/app/services/hyrax/access_control_list.rb +13 -0
  141. data/app/services/hyrax/admin_set_create_service.rb +179 -51
  142. data/app/services/hyrax/analytics/google/events.rb +37 -0
  143. data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
  144. data/app/services/hyrax/analytics/google/visits.rb +44 -0
  145. data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
  146. data/app/services/hyrax/analytics/google.rb +204 -0
  147. data/app/services/hyrax/analytics/matomo.rb +193 -0
  148. data/app/services/hyrax/analytics/results.rb +79 -0
  149. data/app/services/hyrax/analytics.rb +12 -82
  150. data/app/services/hyrax/change_content_depositor_service.rb +2 -2
  151. data/app/services/hyrax/change_depositor_service.rb +70 -0
  152. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
  153. data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
  154. data/app/services/hyrax/collections/collection_member_service.rb +12 -2
  155. data/app/services/hyrax/collections/nested_collection_query_service.rb +31 -14
  156. data/app/services/hyrax/collections/permissions_create_service.rb +81 -79
  157. data/app/services/hyrax/collections/permissions_service.rb +1 -1
  158. data/app/services/hyrax/curation_concern.rb +24 -2
  159. data/app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb +45 -0
  160. data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +7 -2
  161. data/app/services/hyrax/custom_queries/navigators/parent_work_navigator.rb +54 -0
  162. data/app/services/hyrax/default_middleware_stack.rb +14 -0
  163. data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
  164. data/app/services/hyrax/file_set_derivatives_service.rb +21 -2
  165. data/app/services/hyrax/file_set_type_service.rb +2 -5
  166. data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
  167. data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +4 -1
  168. data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
  169. data/app/services/hyrax/listeners/file_metadata_listener.rb +38 -0
  170. data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
  171. data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
  172. data/app/services/hyrax/listeners/member_cleanup_listener.rb +26 -3
  173. data/app/services/hyrax/listeners/metadata_index_listener.rb +72 -11
  174. data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
  175. data/app/services/hyrax/listeners/proxy_deposit_listener.rb +16 -8
  176. data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
  177. data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
  178. data/app/services/hyrax/listeners.rb +8 -0
  179. data/app/services/hyrax/location_service.rb +33 -0
  180. data/app/services/hyrax/multiple_membership_checker.rb +44 -1
  181. data/app/services/hyrax/permission_manager.rb +4 -4
  182. data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
  183. data/app/services/hyrax/restriction_service.rb +4 -0
  184. data/app/services/hyrax/simple_schema_loader.rb +5 -1
  185. data/app/services/hyrax/solr_query_service.rb +12 -7
  186. data/app/services/hyrax/solr_service.rb +1 -1
  187. data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
  188. data/app/services/hyrax/statistics/users/over_time.rb +8 -5
  189. data/app/services/hyrax/statistics/works/over_time.rb +10 -0
  190. data/app/services/hyrax/thumbnail_path_service.rb +1 -1
  191. data/app/services/hyrax/work_uploads_handler.rb +2 -9
  192. data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
  193. data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
  194. data/app/services/hyrax/workflow/activate_object.rb +5 -4
  195. data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
  196. data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
  197. data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
  198. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
  199. data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
  200. data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
  201. data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
  202. data/app/validators/hyrax/collection_membership_validator.rb +38 -0
  203. data/app/views/catalog/_index_header_list_hyrax_pcdm_collection.html.erb +4 -0
  204. data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
  205. data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +2 -2
  206. data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +2 -2
  207. data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +2 -2
  208. data/app/views/hyrax/admin/admin_sets/_form_workflow.erb +1 -1
  209. data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
  210. data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
  211. data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
  212. data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
  213. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
  214. data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
  215. data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
  216. data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
  217. data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
  218. data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
  219. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
  220. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
  221. data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
  222. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
  223. data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
  224. data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
  225. data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
  226. data/app/views/hyrax/admin/stats/show.html.erb +1 -1
  227. data/app/views/hyrax/base/_form.html.erb +1 -1
  228. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
  229. data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
  230. data/app/views/hyrax/base/show.html.erb +6 -0
  231. data/app/views/hyrax/collections/show.html.erb +4 -0
  232. data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
  233. data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
  234. data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
  235. data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
  236. data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
  237. data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
  238. data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
  239. data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
  240. data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
  241. data/app/views/hyrax/dashboard/collections/_default_group.html.erb +2 -2
  242. data/app/views/hyrax/dashboard/collections/_form.html.erb +24 -17
  243. data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +6 -3
  244. data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
  245. data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +3 -3
  246. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +2 -2
  247. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
  248. data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
  249. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
  250. data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
  251. data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
  252. data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
  253. data/app/views/hyrax/file_sets/show.html.erb +6 -0
  254. data/app/views/hyrax/homepage/index.html.erb +1 -1
  255. data/app/views/hyrax/my/_work_action_menu.html.erb +8 -9
  256. data/app/views/hyrax/my/collections/_default_group.html.erb +2 -2
  257. data/app/views/hyrax/my/collections/_list_collections.html.erb +2 -2
  258. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
  259. data/app/views/hyrax/my/collections/index.html.erb +4 -3
  260. data/app/views/hyrax/my/works/_default_group.html.erb +1 -1
  261. data/app/views/hyrax/my/works/_list_works.html.erb +1 -2
  262. data/app/views/hyrax/my/works/index.html.erb +4 -2
  263. data/app/views/hyrax/stats/_downloads.html.erb +18 -0
  264. data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
  265. data/app/views/hyrax/stats/work.html.erb +17 -9
  266. data/app/views/layouts/_head_tag_content.html.erb +7 -2
  267. data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
  268. data/app/views/layouts/hyrax.html.erb +1 -0
  269. data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
  270. data/app/views/shared/_matomo.html.erb +15 -0
  271. data/app/views/shared/_read_only.html.erb +5 -0
  272. data/chart/hyrax/Chart.yaml +2 -2
  273. data/chart/hyrax/README.md +22 -1
  274. data/chart/hyrax/templates/deployment.yaml +6 -0
  275. data/chart/hyrax/values.yaml +1 -1
  276. data/config/features.rb +3 -0
  277. data/config/i18n-tasks.yml +2 -2
  278. data/config/initializers/1_healthz.rb +1 -0
  279. data/config/initializers/listeners.rb +5 -5
  280. data/config/locales/hyrax.de.yml +200 -5
  281. data/config/locales/hyrax.en.yml +202 -21
  282. data/config/locales/hyrax.es.yml +204 -9
  283. data/config/locales/hyrax.fr.yml +196 -1
  284. data/config/locales/hyrax.it.yml +197 -2
  285. data/config/locales/hyrax.pt-BR.yml +196 -1
  286. data/config/locales/hyrax.zh.yml +196 -1
  287. data/config/metadata/basic_metadata.yaml +2 -0
  288. data/config/metadata/core_metadata.yaml +1 -1
  289. data/config/routes.rb +4 -0
  290. data/db/seeds.rb +1 -1
  291. data/docker-compose.yml +48 -42
  292. data/documentation/developing-your-hyrax-based-app.md +2 -2
  293. data/documentation/legacyREADME.md +1 -1
  294. data/hyrax.gemspec +4 -2
  295. data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
  296. data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
  297. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +10 -13
  298. data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
  299. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +4 -2
  300. data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
  301. data/lib/hyrax/administrative_set_name.rb +18 -0
  302. data/lib/hyrax/collection_name.rb +8 -2
  303. data/lib/hyrax/configuration.rb +104 -4
  304. data/lib/hyrax/controlled_vocabularies/location.rb +9 -2
  305. data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +42 -0
  306. data/lib/hyrax/controlled_vocabularies.rb +1 -0
  307. data/lib/hyrax/engine.rb +7 -6
  308. data/lib/hyrax/form_fields.rb +1 -0
  309. data/lib/hyrax/publisher.rb +61 -0
  310. data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
  311. data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
  312. data/lib/hyrax/specs/capybara.rb +1 -1
  313. data/lib/hyrax/specs/shared_specs/hydra_works.rb +13 -4
  314. data/lib/hyrax/specs/shared_specs/indexers.rb +120 -0
  315. data/lib/hyrax/transactions/admin_set_create.rb +23 -0
  316. data/lib/hyrax/transactions/admin_set_destroy.rb +22 -0
  317. data/lib/hyrax/transactions/admin_set_update.rb +21 -0
  318. data/lib/hyrax/transactions/collection_create.rb +25 -0
  319. data/lib/hyrax/transactions/collection_destroy.rb +22 -0
  320. data/lib/hyrax/transactions/collection_update.rb +21 -0
  321. data/lib/hyrax/transactions/container.rb +118 -17
  322. data/lib/hyrax/transactions/create_work.rb +3 -0
  323. data/lib/hyrax/transactions/destroy_work.rb +3 -0
  324. data/lib/hyrax/transactions/steps/add_to_collections.rb +13 -1
  325. data/lib/hyrax/transactions/steps/apply_collection_permission_template.rb +2 -0
  326. data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
  327. data/lib/hyrax/transactions/steps/apply_permission_template.rb +2 -0
  328. data/lib/hyrax/transactions/steps/apply_visibility.rb +2 -0
  329. data/lib/hyrax/transactions/steps/change_depositor.rb +46 -0
  330. data/lib/hyrax/transactions/steps/check_for_empty_admin_set.rb +36 -0
  331. data/lib/hyrax/transactions/steps/delete_access_control.rb +32 -0
  332. data/lib/hyrax/transactions/steps/delete_resource.rb +19 -3
  333. data/lib/hyrax/transactions/steps/destroy_work.rb +3 -1
  334. data/lib/hyrax/transactions/steps/ensure_permission_template.rb +2 -0
  335. data/lib/hyrax/transactions/steps/save.rb +37 -7
  336. data/lib/hyrax/transactions/steps/save_access_control.rb +2 -2
  337. data/lib/hyrax/transactions/steps/save_work.rb +3 -0
  338. data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
  339. data/lib/hyrax/transactions/steps/set_user_as_creator.rb +41 -0
  340. data/lib/hyrax/transactions/steps/update_work_members.rb +51 -0
  341. data/lib/hyrax/transactions/update_work.rb +4 -3
  342. data/lib/hyrax/transactions/work_create.rb +1 -1
  343. data/lib/hyrax/transactions/work_destroy.rb +2 -1
  344. data/lib/hyrax/transactions/work_update.rb +19 -0
  345. data/lib/hyrax/version.rb +1 -1
  346. data/lib/tasks/default_admin_set.rake +12 -11
  347. data/lib/tasks/regenerate_derivatives.rake +1 -1
  348. data/lib/wings/attribute_transformer.rb +5 -1
  349. data/lib/wings/setup.rb +18 -1
  350. data/lib/wings/valkyrie/persister.rb +16 -0
  351. data/lib/wings/valkyrie/query_service.rb +2 -1
  352. data/lib/wings/valkyrie/storage.rb +7 -1
  353. data/template.rb +1 -1
  354. data/vendor/assets/javascripts/morris/morris.min.js +1 -7
  355. data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
  356. metadata +121 -17
  357. data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
@@ -27,7 +27,9 @@ module Hyrax
27
27
  configure_facets
28
28
 
29
29
  before_action :authenticate_user!
30
- load_and_authorize_resource only: :show, instance_name: :collection
30
+ load_and_authorize_resource only: :show,
31
+ instance_name: :collection,
32
+ class: Hyrax.config.collection_model
31
33
 
32
34
  # include the render_check_all view helper method
33
35
  helper Hyrax::BatchEditsHelper
@@ -36,9 +38,7 @@ module Hyrax
36
38
 
37
39
  def index
38
40
  @user = current_user
39
- Deprecation.silence(Hyrax::MyController) do
40
- (@response, @document_list) = query_solr
41
- end
41
+ (@response, @document_list) = search_service.search_results
42
42
  prepare_instance_variables_for_batch_control_display
43
43
 
44
44
  respond_to do |format|
@@ -7,7 +7,9 @@ module Hyrax
7
7
  before_action :build_breadcrumbs, only: [:work, :file]
8
8
 
9
9
  def work
10
- @stats = Hyrax::WorkUsage.new(params[:id])
10
+ @document = ::SolrDocument.find(params[:id])
11
+ @pageviews = Hyrax::Analytics.daily_events_for_id(@document.id, 'work-view')
12
+ @downloads = Hyrax::Analytics.daily_events_for_id(@document.id, 'file-set-in-work-download')
11
13
  end
12
14
 
13
15
  def file
@@ -3,6 +3,13 @@ module Hyrax
3
3
  class WorkflowActionsController < ApplicationController
4
4
  DEFAULT_FORM_CLASS = Hyrax::Forms::WorkflowActionForm
5
5
 
6
+ ##
7
+ # @!attribute [r] curation_concern
8
+ # @api private
9
+ # @return [Hyrax::Resource]
10
+ attr_reader :curation_concern
11
+
12
+ load_resource class: Hyrax::Resource, instance_name: :curation_concern
6
13
  before_action :authenticate_user!
7
14
 
8
15
  def update
@@ -11,17 +18,13 @@ module Hyrax
11
18
  else
12
19
  respond_to do |wants|
13
20
  wants.html { render 'hyrax/base/unauthorized', status: :unauthorized }
14
- wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: curation_concern.errors }) }
21
+ wants.json { render_json_response(response_type: :unprocessable_entity, options: { errors: workflow_action_form.errors }) }
15
22
  end
16
23
  end
17
24
  end
18
25
 
19
26
  private
20
27
 
21
- def curation_concern
22
- @curation_concern ||= Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: params[:id], use_valkyrie: false)
23
- end
24
-
25
28
  def workflow_action_form
26
29
  @workflow_action_form ||= DEFAULT_FORM_CLASS.new(
27
30
  current_ability: current_ability,
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hyrax
4
+ module Forms
5
+ ##
6
+ # @api public
7
+ # @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking
8
+ class AdministrativeSetForm < Valkyrie::ChangeSet
9
+ ##
10
+ # @api private
11
+ AdminSetMembersPopulator = lambda do |_options|
12
+ self.member_ids =
13
+ if model.new_record
14
+ []
15
+ else
16
+ Hyrax
17
+ .query_service
18
+ .find_inverse_references_by(property: :admin_set_id, resource: model)
19
+ .map(&:id)
20
+ end
21
+ end
22
+
23
+ property :title, required: true, primary: true
24
+ property :description, primary: true
25
+
26
+ property :human_readable_type, writable: false
27
+ property :date_modified, readable: false
28
+ property :date_uploaded, readable: false
29
+
30
+ property :creator
31
+
32
+ validates :title, presence: true
33
+
34
+ property :member_ids, virtual: true, default: [], prepopulator: AdminSetMembersPopulator
35
+
36
+ class << self
37
+ def model_class
38
+ Hyrax::AdministrativeSet
39
+ end
40
+
41
+ ##
42
+ # @return [Array<Symbol>] list of required field names as symbols
43
+ def required_fields
44
+ definitions
45
+ .select { |_, definition| definition[:required] }
46
+ .keys.map(&:to_sym)
47
+ end
48
+ end
49
+
50
+ ##
51
+ # @return [Array<Symbol>] terms for display 'above-the-fold', or in the most
52
+ # prominent form real estate
53
+ def primary_terms
54
+ _form_field_definitions
55
+ .select { |_, definition| definition[:primary] }
56
+ .keys.map(&:to_sym)
57
+ end
58
+
59
+ ##
60
+ # @return [Array<Symbol>] terms for display 'below-the-fold'
61
+ def secondary_terms
62
+ _form_field_definitions
63
+ .select { |_, definition| definition[:display] && !definition[:primary] }
64
+ .keys.map(&:to_sym)
65
+ end
66
+
67
+ ##
68
+ # @return [Boolean] whether there are terms to display 'below-the-fold'
69
+ def display_additional_fields?
70
+ secondary_terms.any?
71
+ end
72
+
73
+ private
74
+
75
+ def _form_field_definitions
76
+ self.class.definitions
77
+ end
78
+ end
79
+ end
80
+ end
@@ -65,7 +65,7 @@ module Hyrax
65
65
  def initialize_combined_fields
66
66
  # For each of the files in the batch, set the attributes to be the concatenation of all the attributes
67
67
  batch_document_ids.each_with_object({}) do |doc_id, combined_attributes|
68
- work = ActiveFedora::Base.find(doc_id)
68
+ work = Hyrax.query_service.find_by(id: doc_id)
69
69
  terms.each do |field|
70
70
  combined_attributes[field] ||= []
71
71
  combined_attributes[field] = (combined_attributes[field] + work[field].to_a).uniq
@@ -16,7 +16,7 @@ module Hyrax
16
16
  # Required for search builder (FIXME)
17
17
  alias collection model
18
18
 
19
- self.model_class = ::Collection
19
+ self.model_class = Hyrax.config.collection_class
20
20
 
21
21
  self.membership_service_class = Collections::CollectionMemberSearchService
22
22
 
@@ -131,7 +131,7 @@ module Hyrax
131
131
  def available_parent_collections(scope:)
132
132
  return @available_parents if @available_parents.present?
133
133
 
134
- collection = ::Collection.find(id)
134
+ collection = model_class.find(id)
135
135
  colls = Hyrax::Collections::NestedCollectionQueryService.available_parent_collections(child: collection, scope: scope, limit_to_id: nil)
136
136
  @available_parents = colls.map do |col|
137
137
  { "id" => col.id, "title_first" => col.title.first }
@@ -10,18 +10,28 @@ module Hyrax
10
10
  self.default_query_service = Hyrax::Collections::NestedCollectionQueryService
11
11
  self.default_persistence_service = Hyrax::Collections::NestedCollectionPersistenceService
12
12
 
13
+ ##
13
14
  # @param parent [::Collection, NilClass]
14
15
  # @param child [::Collection, NilClass]
16
+ # @param parent_id [String, nil]
17
+ # @param child_id [String, nil]
15
18
  # @param context [#can?,#repository,#blacklight_config]
16
19
  # @param query_service [Hyrax::Collections::NestedCollectionQueryService]
17
20
  # @param persistence_service [Hyrax::Collections::NestedCollectionPersistenceService] responsible for persisting the parent/child relationship
18
- def initialize(parent: nil, child: nil, context:, query_service: default_query_service, persistence_service: default_persistence_service)
19
- self.parent = parent
20
- self.child = child
21
+ # rubocop:disable Metrics/ParameterLists
22
+ def initialize(parent: nil,
23
+ child: nil,
24
+ parent_id: nil,
25
+ child_id: nil,
26
+ context:,
27
+ query_service: default_query_service,
28
+ persistence_service: default_persistence_service)
21
29
  self.context = context
22
30
  self.query_service = query_service
23
31
  self.persistence_service = persistence_service
24
- end
32
+ self.parent = parent || (parent_id.present? && find_parent(parent_id))
33
+ self.child = child || (child_id.present? && find_child(child_id))
34
+ end # rubocop:enable Metrics/ParameterLists
25
35
 
26
36
  attr_accessor :parent, :child
27
37
 
@@ -73,7 +83,7 @@ module Hyrax
73
83
  # rerouting to new_dashboard_collection_path to add the new collection as
74
84
  # a child. Since we don't yet have a child collection, the valid? option can't be used here.
75
85
  def validate_add
76
- if parent.try(:nestable?)
86
+ if nestable?(parent)
77
87
  nesting_within_maximum_depth
78
88
  else
79
89
  errors.add(:parent, :cannot_have_child_nested)
@@ -106,15 +116,30 @@ module Hyrax
106
116
  end
107
117
 
108
118
  def parent_and_child_can_be_nested
109
- if parent.try(:nestable?) && child.try(:nestable?)
119
+ if nestable?(parent) && nestable?(child)
110
120
  return true if query_service.parent_and_child_can_nest?(parent: parent, child: child, scope: context)
111
121
  errors.add(:parent, :cannot_have_child_nested)
112
122
  errors.add(:child, :cannot_nest_in_parent)
113
123
  else
114
- errors.add(:parent, :is_not_nestable) unless parent.try(:nestable?)
115
- errors.add(:child, :is_not_nestable) unless child.try(:nestable?)
124
+ errors.add(:parent, :is_not_nestable) unless nestable?(parent)
125
+ errors.add(:child, :is_not_nestable) unless nestable?(child)
116
126
  end
117
127
  end
128
+
129
+ def find_parent(parent_id)
130
+ Hyrax.query_service.find_by(id: parent_id)
131
+ end
132
+
133
+ def find_child(child_id)
134
+ Hyrax.query_service.find_by(id: child_id)
135
+ end
136
+
137
+ def nestable?(collection)
138
+ return false if collection.blank?
139
+ return collection.nestable? if collection.respond_to? :nestable?
140
+ collection_type = Hyrax::CollectionType.find_by_gid!(collection.collection_type_gid)
141
+ collection_type.nestable?
142
+ end
118
143
  end
119
144
  end
120
145
  end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hyrax
4
+ module Forms
5
+ ##
6
+ # @api public
7
+ # @see https://github.com/samvera/valkyrie/wiki/ChangeSets-and-Dirty-Tracking
8
+ class PcdmCollectionForm < Valkyrie::ChangeSet # rubocop:disable Metrics/ClassLength
9
+ property :title, required: true, primary: true
10
+
11
+ property :human_readable_type, writable: false
12
+ property :date_modified, readable: false
13
+ property :date_uploaded, readable: false
14
+
15
+ property :depositor, required: true
16
+ property :collection_type_gid, required: true
17
+ property :visibility, default: VisibilityIntention::PRIVATE
18
+
19
+ property :member_of_collection_ids, default: [], type: Valkyrie::Types::Array
20
+
21
+ validates :title, presence: true
22
+ validates :collection_type_gid, presence: true
23
+
24
+ class << self
25
+ def model_class
26
+ Hyrax::PcdmCollection
27
+ end
28
+
29
+ ##
30
+ # @return [Array<Symbol>] list of required field names as symbols
31
+ def required_fields
32
+ definitions
33
+ .select { |_, definition| definition[:required] }
34
+ .keys.map(&:to_sym)
35
+ end
36
+ end
37
+
38
+ ##
39
+ # @return [Array<Symbol>] terms for display 'above-the-fold', or in the most
40
+ # prominent form real estate
41
+ def primary_terms
42
+ _form_field_definitions
43
+ .select { |_, definition| definition[:primary] }
44
+ .keys.map(&:to_sym)
45
+ end
46
+
47
+ ##
48
+ # @return [Array<Symbol>] terms for display 'below-the-fold'
49
+ def secondary_terms
50
+ _form_field_definitions
51
+ .select { |_, definition| definition[:display] && !definition[:primary] }
52
+ .keys.map(&:to_sym)
53
+ end
54
+
55
+ ##
56
+ # @return [Boolean] whether there are terms to display 'below-the-fold'
57
+ def display_additional_fields?
58
+ secondary_terms.any?
59
+ end
60
+
61
+ private
62
+
63
+ def _form_field_definitions
64
+ self.class.definitions
65
+ end
66
+ end
67
+ end
68
+ end
@@ -7,16 +7,12 @@ module Hyrax
7
7
  self.model_class = PermissionTemplate
8
8
  self.terms = []
9
9
  delegate :access_grants, :access_grants_attributes=, :release_date, :release_period, :visibility, to: :model
10
- delegate :available_workflows, :active_workflow, :source_model, to: :model
11
-
12
- # @return [#to_s] the primary key of the associated admin_set or collection
13
- # def source_id (because you might come looking for this method)
14
- delegate :id, to: :source_model, prefix: :source
10
+ delegate :available_workflows, :active_workflow, :source, :source_id, to: :model
15
11
 
16
12
  ##
17
- # @deprecated use PermissionTemplate#reset_access_controls instead.
13
+ # @deprecated use PermissionTemplate#reset_access_controls_for instead.
18
14
  def reset_access_controls!
19
- Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls instead.")
15
+ Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls_for instead.")
20
16
  source_model.reset_access_controls!
21
17
  end
22
18
 
@@ -73,8 +69,8 @@ module Hyrax
73
69
  # Copy this access to the permissions of the Admin Set or Collection and to
74
70
  # the WorkflowResponsibilities of the active workflow if this is an Admin Set
75
71
  def update_access(remove_agent: false)
76
- source_model.reset_access_controls!
77
- update_workflow_responsibilities(remove_agent: remove_agent) if source_model.is_a?(AdminSet)
72
+ model.reset_access_controls_for(collection: source)
73
+ update_workflow_responsibilities(remove_agent: remove_agent) if source.is_a?(Hyrax::AdministrativeSet)
78
74
  end
79
75
 
80
76
  # This method is used to revoke access to a Collection or Admin Set and its workflows
@@ -85,6 +81,18 @@ module Hyrax
85
81
  update_access(remove_agent: true)
86
82
  end
87
83
 
84
+ ##
85
+ # A bit of an analogue for a `belongs_to :source_model` as it crosses from Fedora to the DB
86
+ # @return [AdminSet, ::Collection]
87
+ # @raise [Hyrax::ObjectNotFoundError] when neither an AdminSet or Collection is found
88
+ # @note This method will eventually be replaced by #source which returns a Hyrax::Resource
89
+ # object. Many methods are equally able to process both Hyrax::Resource and
90
+ # ActiveFedora::Base. Only call this method if you need the ActiveFedora::Base object.
91
+ # @see #source
92
+ def source_model # rubocop:disable Rails/Delegate
93
+ model.source_model
94
+ end
95
+
88
96
  private
89
97
 
90
98
  # @return [String]
@@ -30,10 +30,10 @@ module Hyrax
30
30
  # @api public
31
31
  #
32
32
  # This form wraps `Hyrax::ChangeSet` in the `HydraEditor::Form` interface.
33
- class ResourceForm < Hyrax::ChangeSet
33
+ class ResourceForm < Hyrax::ChangeSet # rubocop:disable Metrics/ClassLength
34
34
  ##
35
35
  # @api private
36
- InWorksPopulator = lambda do |_options|
36
+ InWorksPrepopulator = lambda do |_options|
37
37
  self.in_works_ids =
38
38
  if persisted?
39
39
  Hyrax.query_service
@@ -52,17 +52,16 @@ module Hyrax
52
52
  # with `etag`-driven, application-side lock checks. for non-wings adapters
53
53
  # we want to move away from application side lock validation and rely
54
54
  # on the adapter/database features instead.
55
- LockKeyPopulator = lambda do |_options|
56
- self.version =
57
- case Hyrax.metadata_adapter
58
- when Wings::Valkyrie::MetadataAdapter
55
+ LockKeyPrepopulator = lambda do |_options|
56
+ if Hyrax.config.disable_wings || !Hyrax.metadata_adapter.is_a?(Wings::Valkyrie::MetadataAdapter)
57
+ Hyrax.logger.info "trying to prepopulate a lock token for " \
58
+ "#{self.class.inspect}, but optimistic locking isn't " \
59
+ "supported for the configured adapter: #{Hyrax.metadata_adapter.class}"
60
+ self.version = ''
61
+ else
62
+ self.version =
59
63
  model.persisted? ? Wings::ActiveFedoraConverter.convert(resource: model).etag : ''
60
- else
61
- Hyrax.logger.info 'trying to prepopulate a lock token for ' \
62
- "#{self.class.inspect}, but optimistic locking isn't " \
63
- "supported for the configured adapter: #{Hyrax.metadata_adapter.class}"
64
- ''
65
- end
64
+ end
66
65
  end
67
66
 
68
67
  class_attribute :model_class
@@ -96,10 +95,16 @@ module Hyrax
96
95
  property :visibility_during_lease, virtual: true, prepopulator: ->(_opts) { self.visibility_during_lease = model.lease&.visibility_during_lease }
97
96
 
98
97
  # pcdm relationships
99
- property :admin_set_id, prepopulator: ->(_opts) { self.admin_set_id = AdminSet::DEFAULT_ID }
100
- property :in_works_ids, virtual: true, prepopulator: InWorksPopulator
98
+ property :admin_set_id, prepopulator: ->(_opts) { self.admin_set_id = Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s }
99
+ property :in_works_ids, virtual: true, prepopulator: InWorksPrepopulator
101
100
  property :member_ids, default: [], type: Valkyrie::Types::Array
102
101
  property :member_of_collection_ids, default: [], type: Valkyrie::Types::Array
102
+ property :member_of_collections_attributes, virtual: true
103
+ validates_with CollectionMembershipValidator
104
+
105
+ property :representative_id, type: Valkyrie::Types::String
106
+ property :thumbnail_id, type: Valkyrie::Types::String
107
+ property :rendering_ids, default: [], type: Valkyrie::Types::Array
103
108
 
104
109
  # provide a lock token for optimistic locking; we name this `version` for
105
110
  # backwards compatibility
@@ -109,7 +114,7 @@ module Hyrax
109
114
  # the model is disabled
110
115
  #
111
116
  # @see https://github.com/samvera/valkyrie/wiki/Optimistic-Locking
112
- property :version, virtual: true, prepopulator: LockKeyPopulator
117
+ property :version, virtual: true, prepopulator: LockKeyPrepopulator
113
118
 
114
119
  # backs the child work search element;
115
120
  # @todo: look for a way for the view template not to depend on this
@@ -128,8 +133,12 @@ module Hyrax
128
133
  "#{resource.class.name}Form".constantize.new(resource)
129
134
  rescue NameError => _err
130
135
  case resource
136
+ when Hyrax::AdministrativeSet
137
+ Hyrax::Forms::AdministrativeSetForm.new(resource)
131
138
  when Hyrax::FileSet
132
139
  Hyrax::Forms::FileSetForm.new(resource)
140
+ when Hyrax::PcdmCollection
141
+ Hyrax::Forms::PcdmCollectionForm.new(resource)
133
142
  else
134
143
  Hyrax::Forms::ResourceForm(resource.class).new(resource)
135
144
  end
@@ -17,6 +17,10 @@ module Hyrax
17
17
  include ActiveModel::Validations
18
18
  extend ActiveModel::Translation
19
19
 
20
+ ##
21
+ # @param current_ability [::Ability]
22
+ # @param work [ActiveFedora::Base, Valkyrie::Resource]
23
+ # @param attributes [Hash{Symbol => String}]
20
24
  def initialize(current_ability:, work:, attributes: {})
21
25
  @current_ability = current_ability
22
26
  @work = work
@@ -191,6 +191,20 @@ module Hyrax
191
191
  CollectionType.find_or_create_default_collection_type.title
192
192
  end
193
193
 
194
+ ##
195
+ # @param collection [Object]
196
+ #
197
+ # @return [PermissionTemplateForm]
198
+ def collection_permission_template_form_for(form:)
199
+ case form
200
+ when Valkyrie::ChangeSet
201
+ template_model = Hyrax::PermissionTemplate.find_or_create_by(source_id: form.id.to_s)
202
+ Hyrax::Forms::PermissionTemplateForm.new(template_model)
203
+ else
204
+ form.permission_template
205
+ end
206
+ end
207
+
194
208
  private
195
209
 
196
210
  # add hidden fields to a form for performing an action on a single document on a collection
@@ -296,6 +296,15 @@ module Hyrax
296
296
  solr_field.first
297
297
  end
298
298
 
299
+ ##
300
+ # @param [Object] an object that might have a thumbnail
301
+ #
302
+ # @return [String] a label for the object's thumbnail
303
+ def thumbnail_label_for(object:)
304
+ object.try(:thumbnail_title).presence ||
305
+ ""
306
+ end
307
+
299
308
  private
300
309
 
301
310
  def user_agent
@@ -41,7 +41,7 @@ module Hyrax
41
41
  Hyrax.custom_queries.find_child_works(resource: resource).map do |member|
42
42
  { id: member.id.to_s,
43
43
  label: member.title.first,
44
- path: url_for(member) }
44
+ path: main_app.url_for([member, { only_path: true }]) }
45
45
  end.to_json
46
46
  end
47
47
  end
@@ -15,7 +15,7 @@ module Hyrax
15
15
  args[:data]['remove-text'] = args[:remove_text]
16
16
 
17
17
  args[:data][:url] = hyrax.trophy_work_path(id)
18
- link_to '#', class: args[:class], data: args[:data] do
18
+ link_to '#', id: 'action-highlight-work', class: args[:class], data: args[:data] do
19
19
  yield(text)
20
20
  end
21
21
  end
@@ -3,7 +3,7 @@ module Hyrax
3
3
  module UrlHelper
4
4
  # generated models get registered as curation concerns and need a
5
5
  # track_model_path to render Blacklight-related views
6
- (['FileSet', 'Collection'] + Hyrax.config.registered_curation_concern_types).each do |concern|
6
+ (['FileSet', 'Collection', 'Hyrax::AdministrativeSet'] + Hyrax.config.registered_curation_concern_types).each do |concern|
7
7
  model = concern.safe_constantize
8
8
  model_name = model.respond_to?(:model_name) && model.model_name
9
9
  next unless model_name
@@ -4,14 +4,20 @@ module Hyrax
4
4
  ##
5
5
  # Indexes Hyrax::AdministrativeSet objects
6
6
  class AdministrativeSetIndexer < Hyrax::ValkyrieIndexer
7
+ include Hyrax::ResourceIndexer
8
+ include Hyrax::PermissionIndexer
9
+ include Hyrax::VisibilityIndexer
10
+ include Hyrax::Indexer(:core_metadata)
11
+
7
12
  def to_solr # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
8
13
  super.tap do |solr_doc|
9
- solr_doc['generic_type_si'] = 'Admin Set'
10
- solr_doc['alternative_title_tesim'] = resource.alternative_title
11
- solr_doc['creator_ssim'] = resource.creator
12
- solr_doc['description_tesim'] = resource.description
13
- solr_doc['title_tesim'] = resource.title
14
- solr_doc['title_sim'] = resource.title
14
+ solr_doc[Hyrax.config.collection_type_index_field.to_sym] = Array(resource.try(:collection_type_gid)&.to_s)
15
+ solr_doc[:alternative_title_tesim] = resource.alternative_title
16
+ solr_doc[:creator_ssim] = [resource.creator]
17
+ solr_doc[:creator_tesim] = [resource.creator]
18
+ solr_doc[:description_tesim] = resource.description
19
+ solr_doc[:generic_type_sim] = ['Admin Set']
20
+ solr_doc[:thumbnail_path_ss] = Hyrax::CollectionThumbnailPathService.call(resource)
15
21
  end
16
22
  end
17
23
  end
@@ -41,7 +41,7 @@ module Hyrax
41
41
 
42
42
  def fetch_with_persistence(resource)
43
43
  old_label = resource.rdf_label.first
44
- return unless old_label == resource.rdf_subject.to_s || old_label.nil?
44
+ return unless old_label == resource.rdf_subject.to_s
45
45
  fetch_value(resource)
46
46
  return if old_label == resource.rdf_label.first || resource.rdf_label.first == resource.rdf_subject.to_s
47
47
  resource.persist! # Stores the fetched values into our marmotta triplestore
@@ -30,6 +30,7 @@ module Hyrax
30
30
  solr_doc['original_checksum_tesim'] = object.original_checksum
31
31
  solr_doc['alpha_channels_ssi'] = object.alpha_channels
32
32
  solr_doc['original_file_id_ssi'] = original_file_id
33
+ solr_doc['generic_type_si'] = 'FileSet'
33
34
  end
34
35
  end
35
36
 
@@ -7,14 +7,18 @@ module Hyrax
7
7
  include Hyrax::ResourceIndexer
8
8
  include Hyrax::PermissionIndexer
9
9
  include Hyrax::VisibilityIndexer
10
+ include Hyrax::ThumbnailIndexer
10
11
  include Hyrax::Indexer(:core_metadata)
11
12
  include Hyrax::Indexer(:basic_metadata)
12
13
 
14
+ self.thumbnail_path_service = CollectionThumbnailPathService
15
+
13
16
  def to_solr
14
17
  super.tap do |index_document|
15
18
  index_document[Hyrax.config.collection_type_index_field.to_sym] = Array(resource.try(:collection_type_gid)&.to_s)
16
19
  index_document[:generic_type_sim] = ['Collection']
17
- index_document[:thumbnail_path_ss] = Hyrax::CollectionThumbnailPathService.call(resource)
20
+ index_document[:depositor_ssim] = [resource.depositor]
21
+ index_document[:depositor_tesim] = [resource.depositor]
18
22
  end
19
23
  end
20
24
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+ module Hyrax
3
+ module ThumbnailIndexer
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ class_attribute :thumbnail_path_service
8
+ self.thumbnail_path_service = ThumbnailPathService
9
+ class_attribute :thumbnail_field
10
+ self.thumbnail_field = :thumbnail_path_ss
11
+ end
12
+
13
+ # Adds thumbnail indexing to the solr document of a valkyrie resource
14
+ def to_solr
15
+ super.tap do |solr_doc|
16
+ index_thumbnails(solr_doc)
17
+ end
18
+ end
19
+
20
+ # Write the thumbnail paths into the solr_document
21
+ # @param [Hash] solr_document the solr document to add the field to
22
+ def index_thumbnails(solr_document)
23
+ solr_document[thumbnail_field] = thumbnail_path.to_s
24
+ end
25
+
26
+ # Returns the value for the thumbnail path to put into the solr document
27
+ def thumbnail_path
28
+ self.class.thumbnail_path_service.call(resource)
29
+ end
30
+ end
31
+ end