hyrax 5.0.5 → 5.1.0.pre.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.dassie/Gemfile +11 -12
  3. data/.dassie/bin/rails +0 -5
  4. data/.dassie/bin/rake +0 -5
  5. data/.dassie/config/application.rb +2 -1
  6. data/.dassie/config/environments/development.rb +1 -1
  7. data/.dassie/config/environments/production.rb +4 -2
  8. data/.dassie/config/environments/test.rb +1 -1
  9. data/.dassie/config/initializers/riiif.rb +20 -18
  10. data/.dassie/db/schema.rb +109 -110
  11. data/.github/workflows/lint-build-test.yml +1 -1
  12. data/.koppie/Gemfile +10 -11
  13. data/.koppie/bin/rails +0 -5
  14. data/.koppie/bin/rake +0 -5
  15. data/.koppie/config/application.rb +2 -1
  16. data/.koppie/config/environments/development.rb +1 -1
  17. data/.koppie/config/environments/production.rb +4 -2
  18. data/.koppie/config/environments/test.rb +1 -1
  19. data/.koppie/config/initializers/hyrax.rb +20 -17
  20. data/.koppie/config/initializers/riiif.rb +21 -18
  21. data/Dockerfile +7 -6
  22. data/Gemfile +0 -1
  23. data/app/actors/hyrax/actors/add_to_work_actor.rb +1 -1
  24. data/app/actors/hyrax/actors/apply_order_actor.rb +1 -1
  25. data/app/assets/stylesheets/hyrax/_tinymce.scss +6 -0
  26. data/app/controllers/concerns/hyrax/valkyrie_downloads_controller_behavior.rb +0 -1
  27. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -0
  28. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +4 -4
  29. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +4 -4
  30. data/app/controllers/hyrax/api/zotero_controller.rb +1 -1
  31. data/app/jobs/migrate_files_to_valkyrie_job.rb +21 -33
  32. data/app/models/admin_set.rb +2 -2
  33. data/app/models/concerns/hyrax/permissions/writable.rb +1 -2
  34. data/app/models/concerns/hyrax/solr_document_behavior.rb +2 -5
  35. data/app/models/concerns/hyrax/valkyrie_lazy_migration.rb +1 -0
  36. data/app/models/hyrax/collection_type.rb +4 -4
  37. data/app/models/hyrax/file_metadata.rb +7 -22
  38. data/app/models/single_use_link.rb +1 -1
  39. data/app/services/hyrax/analytics/ga4/base.rb +1 -1
  40. data/app/services/hyrax/analytics/ga4.rb +1 -5
  41. data/app/services/hyrax/listeners.rb +1 -0
  42. data/app/services/hyrax/statistics/term_query.rb +1 -1
  43. data/app/services/hyrax/workflow.rb +8 -0
  44. data/app/services/migrate_resource_service.rb +1 -1
  45. data/app/validators/hyrax/has_one_title_validator.rb +1 -1
  46. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +7 -3
  47. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +6 -3
  48. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +3 -2
  49. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +6 -1
  50. data/chart/hyrax/Chart.yaml +1 -1
  51. data/config/initializers/1_healthz.rb +2 -1
  52. data/config/initializers/ar_test_fixture_monkey_patch.rb +8 -0
  53. data/config/initializers/arel_rails_7_2_monkey_patch.rb +6 -0
  54. data/config/initializers/indexing_adapter_initializer.rb +0 -4
  55. data/config/initializers/listeners.rb +4 -2
  56. data/config/initializers/new_framework_defaults_7_2.rb +8 -0
  57. data/config/metadata/core_metadata.yaml +0 -1
  58. data/docker-compose-dassie.yml +4 -4
  59. data/docker-compose-sirenia.yml +1 -1
  60. data/documentation/developing-your-hyrax-based-app.md +6 -6
  61. data/hyrax.gemspec +8 -8
  62. data/lib/freyja/persister.rb +4 -11
  63. data/lib/generators/hyrax/config_generator.rb +0 -5
  64. data/lib/generators/hyrax/install_generator.rb +1 -1
  65. data/lib/generators/hyrax/templates/config/initializers/riiif.rb +21 -19
  66. data/lib/hyrax/configuration.rb +8 -22
  67. data/lib/hyrax/controlled_vocabulary/importer/language.rb +1 -1
  68. data/lib/hyrax/engine.rb +15 -10
  69. data/lib/hyrax/transactions/steps/add_file_sets.rb +1 -2
  70. data/lib/hyrax/version.rb +1 -1
  71. data/lib/hyrax.rb +4 -1
  72. data/template.rb +6 -1
  73. metadata +40 -43
  74. data/.dassie/bin/spring +0 -17
  75. data/.dassie/config/initializers/mini_magick.rb +0 -6
  76. data/.dassie/config/spring.rb +0 -6
  77. data/.koppie/bin/spring +0 -17
  78. data/.koppie/config/initializers/mini_magick.rb +0 -6
  79. data/.koppie/config/spring.rb +0 -6
  80. data/app/jobs/concerns/hyrax/queued_job_behavior.rb +0 -22
  81. data/app/jobs/hyrax/queued_delete_job.rb +0 -11
  82. data/app/jobs/hyrax/queued_indexing_job.rb +0 -11
  83. data/app/jobs/migrate_sipity_entity_job.rb +0 -21
  84. data/config/initializers/reform_rails_6_1_monkey_patch.rb +0 -27
  85. data/lib/generators/hyrax/templates/config/initializers/mini_magick.rb +0 -6
  86. data/lib/valkyrie/indexing/redis_queue/indexing_adapter.rb +0 -142
@@ -26,8 +26,10 @@ Rails.application.configure do
26
26
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
27
27
 
28
28
  # Compress JavaScripts and CSS.
29
- config.assets.js_compressor = Uglifier.new(:harmony => true)
30
- # config.assets.css_compressor = :sass
29
+ config.assets.configure do |env|
30
+ env.js_compressor = :uglifier
31
+ # env.css_compressor = :sass
32
+ end
31
33
 
32
34
  # Do not fallback to assets pipeline if a precompiled asset is missed.
33
35
  config.assets.compile = false
@@ -43,7 +43,7 @@ Rails.application.configure do
43
43
  config.active_support.deprecation = :stderr
44
44
 
45
45
  # Raises error for missing translations
46
- # config.action_view.raise_on_missing_translations = true
46
+ # config.i18n.raise_on_missing_translations = true
47
47
 
48
48
  config.log_level = :warn
49
49
  end
@@ -317,23 +317,26 @@ Qa::Authorities::Local.register_subauthority('subjects', 'Qa::Authorities::Local
317
317
  Qa::Authorities::Local.register_subauthority('languages', 'Qa::Authorities::Local::TableBasedAuthority')
318
318
  Qa::Authorities::Local.register_subauthority('genres', 'Qa::Authorities::Local::TableBasedAuthority')
319
319
 
320
- custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers,
321
- Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator,
322
- Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator,
323
- Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator,
324
- Hyrax::CustomQueries::Navigators::ChildWorksNavigator,
325
- Hyrax::CustomQueries::Navigators::ParentWorkNavigator,
326
- Hyrax::CustomQueries::Navigators::FindFiles,
327
- Hyrax::CustomQueries::FindAccessControl,
328
- Hyrax::CustomQueries::FindCollectionsByType,
329
- Hyrax::CustomQueries::FindFileMetadata,
330
- Hyrax::CustomQueries::FindIdsByModel,
331
- Hyrax::CustomQueries::FindManyByAlternateIds,
332
- Hyrax::CustomQueries::FindModelsByAccess,
333
- Hyrax::CustomQueries::FindCountBy,
334
- Hyrax::CustomQueries::FindByDateRange]
335
- custom_queries.each do |handler|
336
- Hyrax.query_service.custom_queries.register_query_handler(handler)
320
+ Rails.application.reloader.to_prepare do
321
+ custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers,
322
+ Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator,
323
+ Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator,
324
+ Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator,
325
+ Hyrax::CustomQueries::Navigators::ChildWorksNavigator,
326
+ Hyrax::CustomQueries::Navigators::ParentWorkNavigator,
327
+ Hyrax::CustomQueries::Navigators::FindFiles,
328
+ Hyrax::CustomQueries::FindAccessControl,
329
+ Hyrax::CustomQueries::FindCollectionsByType,
330
+ Hyrax::CustomQueries::FindFileMetadata,
331
+ Hyrax::CustomQueries::FindIdsByModel,
332
+ Hyrax::CustomQueries::FindManyByAlternateIds,
333
+ Hyrax::CustomQueries::FindModelsByAccess,
334
+ Hyrax::CustomQueries::FindCountBy,
335
+ Hyrax::CustomQueries::FindByDateRange]
336
+ custom_queries.each do |handler|
337
+ Hyrax.query_service.custom_queries.register_query_handler(handler)
338
+ end
337
339
  end
338
340
 
341
+
339
342
  ActiveFedora.init(solr_config_path: Rails.root.join('config', 'solr.yml'))
@@ -35,32 +35,35 @@ end
35
35
  module Hyrax
36
36
  # Adds file locking to Riiif::File
37
37
  # @see RiiifFileResolver
38
- class RiiifFile < Riiif::File
39
- include ActiveSupport::Benchmarkable
40
-
41
- attr_reader :id
42
- def initialize(input_path, tempfile = nil, id:)
43
- super(input_path, tempfile)
44
- raise(ArgumentError, "must specify id") if id.blank?
45
- @id = id
46
- end
38
+ Rails.application.reloader.to_prepare do
39
+ class RiiifFile < Riiif::File
40
+ include ActiveSupport::Benchmarkable
41
+
42
+ attr_reader :id
43
+ def initialize(input_path, tempfile = nil, id:)
44
+ super(input_path, tempfile)
45
+ raise(ArgumentError, "must specify id") if id.blank?
46
+ @id = id
47
+ end
47
48
 
48
- # Wrap extract in a read lock and benchmark it
49
- def extract(transformation, image_info = nil)
50
- Riiif::Image.file_resolver.file_locks[id].with_read_lock do
51
- benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do
52
- super
49
+ # Wrap extract in a read lock and benchmark it
50
+ def extract(transformation, image_info = nil)
51
+ Riiif::Image.file_resolver.file_locks[id].with_read_lock do
52
+ benchmark "RiiifFile extracted #{path} with #{transformation.to_params}", level: :debug do
53
+ super
54
+ end
53
55
  end
54
56
  end
55
- end
56
57
 
57
- private
58
+ private
58
59
 
59
- def logger
60
- Hyrax.logger
60
+ def logger
61
+ Hyrax.logger
62
+ end
61
63
  end
62
64
  end
63
65
 
66
+
64
67
  class RiiifFileResolver
65
68
  include ActiveSupport::Benchmarkable
66
69
 
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- ARG ALPINE_VERSION=3.19
2
- ARG RUBY_VERSION=3.2.6
1
+ ARG ALPINE_VERSION=3.21
2
+ ARG RUBY_VERSION=3.3.6
3
3
 
4
4
  FROM ruby:$RUBY_VERSION-alpine$ALPINE_VERSION AS hyrax-base
5
5
 
@@ -7,6 +7,9 @@ ARG DATABASE_APK_PACKAGE="postgresql-dev"
7
7
  ARG EXTRA_APK_PACKAGES="git"
8
8
  ARG RUBYGEMS_VERSION=""
9
9
 
10
+ RUN addgroup -S --gid 101 app && \
11
+ adduser -S -G app -u 1001 -s /bin/sh -h /app app
12
+
10
13
  RUN apk --no-cache upgrade && \
11
14
  apk --no-cache add acl \
12
15
  build-base \
@@ -32,8 +35,6 @@ RUN apk --no-cache upgrade && \
32
35
  RUN setfacl -d -m o::rwx /usr/local/bundle && \
33
36
  gem update --silent --system $RUBYGEMS_VERSION
34
37
 
35
- RUN addgroup -S --gid 101 app && \
36
- adduser -S -G app -u 1001 -s /bin/sh -h /app app
37
38
  USER app
38
39
 
39
40
  RUN mkdir -p /app/samvera/hyrax-webapp
@@ -56,7 +57,7 @@ ARG BUNDLE_WITHOUT="development test"
56
57
 
57
58
  ONBUILD COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
58
59
  ONBUILD RUN bundle install --jobs "$(nproc)"
59
- ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
60
+ ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DATABASE_URL='nulldb://nulldb' bundle exec rake assets:precompile
60
61
 
61
62
 
62
63
  FROM hyrax-base AS hyrax-worker-base
@@ -88,7 +89,7 @@ ARG BUNDLE_WITHOUT="development test"
88
89
 
89
90
  ONBUILD COPY --chown=1001:101 $APP_PATH /app/samvera/hyrax-webapp
90
91
  ONBUILD RUN bundle install --jobs "$(nproc)"
91
- ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile
92
+ ONBUILD RUN RAILS_ENV=production SECRET_KEY_BASE=`bin/rake secret` DATABASE_URL='nulldb://nulldb' bundle exec rake assets:precompile
92
93
 
93
94
 
94
95
  FROM hyrax-worker-base AS hyrax-engine-dev
data/Gemfile CHANGED
@@ -21,5 +21,4 @@ group :development, :test do
21
21
  gem 'ruby-prof', require: false
22
22
  gem 'semaphore_test_boosters'
23
23
  gem "simplecov", require: false
24
- gem 'timecop'
25
24
  end
@@ -69,7 +69,7 @@ module Hyrax
69
69
  end
70
70
 
71
71
  def add_permissions_error(work)
72
- work.errors[:in_works_ids] << "Works can only be related to each other if user has ability to edit both."
72
+ work.errors.add(:in_works_ids, "Works can only be related to each other if user has ability to edit both.")
73
73
  end
74
74
  end
75
75
  end
@@ -41,7 +41,7 @@ module Hyrax
41
41
  env.curation_concern.ordered_members << work
42
42
  env.curation_concern.save!
43
43
  else
44
- env.curation_concern.errors[:ordered_member_ids] << "Works can only be related to each other if user has ability to edit both."
44
+ env.curation_concern.errors.add(:ordered_member_ids, "Works can only be related to each other if user has ability to edit both.")
45
45
  end
46
46
  end
47
47
  end
@@ -12,3 +12,9 @@
12
12
  .home_marketing_text #content_block_external_key {
13
13
  color: black;
14
14
  }
15
+
16
+ // Prevents text from being clipped in Tiny MCE bottom status bar and drop-down style menu (Issue #6789)
17
+ .tox .tox-statusbar { overflow: visible !important; }
18
+ .tox .tox-tbtn--bespoke .tox-tbtn__select-label { overflow: visible !important; }
19
+ .tox .tox-tbtn { overflow: visible !important; }
20
+ .tox-tinymce { overflow: visible !important; }
@@ -102,7 +102,6 @@ module Hyrax
102
102
  def find_file_metadata(file_set:, use: :original_file, mime_type: nil)
103
103
  if mime_type.nil?
104
104
  use = :thumbnail_file if use == :thumbnail
105
- use = :original_file unless Hyrax::FileMetadata::Use.keys.include?(use)
106
105
  use = Hyrax::FileMetadata::Use.uri_for(use: use)
107
106
  results = Hyrax.custom_queries.find_many_file_metadata_by_use(resource: file_set, use: use)
108
107
  else
@@ -360,6 +360,7 @@ module Hyrax
360
360
  # that they have not removed from the upload widget.
361
361
  uploaded_files = params.fetch(:uploaded_files, [])
362
362
  selected_files = params.fetch(:selected_files, {}).values
363
+ .map { |f| f.permit(:expires, :file_name, :url, {}) }
363
364
  browse_everything_urls = uploaded_files &
364
365
  selected_files.map { |f| f[:url] }
365
366
 
@@ -14,9 +14,9 @@ module Hyrax
14
14
  @works_count = @accessible_works.count
15
15
  @top_works = paginate(top_works_list, rows: 10)
16
16
  @top_file_set_downloads = paginate(top_files_list, rows: 10)
17
- # rubocop:disable Style/ParallelAssignment
18
- @pageviews, @downloads = Hyrax::Analytics.daily_events('work-view'), Hyrax::Analytics.daily_events('file-set-download') if current_user.ability.admin?
19
- # rubocop:enable Style/ParallelAssignment
17
+
18
+ @pageviews = Hyrax::Analytics.daily_events('work-view'), @downloads = Hyrax::Analytics.daily_events('file-set-download') if current_user.ability.admin?
19
+
20
20
  respond_to do |format|
21
21
  format.html
22
22
  format.csv { export_data }
@@ -34,7 +34,7 @@ module Hyrax
34
34
  end
35
35
  end
36
36
 
37
- private
37
+ private
38
38
 
39
39
  def accessible_works
40
40
  models = Hyrax::ModelRegistry.work_rdf_representations.map { |m| "\"#{m}\"" }
@@ -21,14 +21,14 @@ module Hyrax
21
21
 
22
22
  def after_destroy_error
23
23
  if source.admin_set?
24
- @permission_template_access.errors[:base] <<
25
- t('hyrax.admin.admin_sets.form.permission_destroy_errors.participants')
24
+ @permission_template_access.errors.add(:base,
25
+ t('hyrax.admin.admin_sets.form.permission_destroy_errors.participants'))
26
26
  redirect_to hyrax.edit_admin_admin_set_path(source_id,
27
27
  anchor: 'participants'),
28
28
  alert: @permission_template_access.errors.full_messages.to_sentence
29
29
  else
30
- @permission_template_access.errors[:base] <<
31
- t('hyrax.dashboard.collections.form.permission_update_errors.sharing')
30
+ @permission_template_access.errors.add(:base,
31
+ t('hyrax.dashboard.collections.form.permission_update_errors.sharing'))
32
32
  redirect_to hyrax.edit_dashboard_collection_path(source_id,
33
33
  anchor: 'sharing'),
34
34
  alert: @permission_template_access.errors.full_messages.to_sentence
@@ -14,7 +14,7 @@ module Hyrax
14
14
  session[:request_token] = request_token
15
15
  current_user.zotero_token = request_token
16
16
  current_user.save
17
- redirect_to request_token.authorize_url(identity: '1', oauth_callback: callback_url)
17
+ redirect_to request_token.authorize_url(identity: '1', oauth_callback: callback_url), allow_other_host: true
18
18
  rescue OAuth::Unauthorized
19
19
  redirect_to root_url, alert: 'Invalid Zotero client key pair'
20
20
  end
@@ -2,11 +2,6 @@
2
2
  # Responsible for conditionally enqueuing the file and thumbnail migration
3
3
  # logic of an ActiveFedora object.
4
4
  class MigrateFilesToValkyrieJob < Hyrax::ApplicationJob
5
- # Define a logger for this job
6
- def logger
7
- FileUtils.mkdir_p(Hyrax.config.working_path)
8
- @logger ||= Logger.new(Hyrax.config.working_path.join('migrate_files_to_valkyrie_job.log'))
9
- end
10
5
  ##
11
6
  #
12
7
  # @param resource [Hyrax::FileSet]
@@ -38,7 +33,6 @@ class MigrateFilesToValkyrieJob < Hyrax::ApplicationJob
38
33
  # @todo should we trigger a job if the member is a child work?
39
34
  paths = Hyrax::DerivativePath.derivatives_for_reference(resource)
40
35
  paths.each do |path|
41
- next unless File.size?(path) # skip blank files
42
36
  container = container_for(path)
43
37
  mime_type = Marcel::MimeType.for(extension: File.extname(path))
44
38
  directives = { url: path, container: container, mime_type: mime_type }
@@ -56,33 +50,27 @@ class MigrateFilesToValkyrieJob < Hyrax::ApplicationJob
56
50
 
57
51
  files = Hyrax.custom_queries.find_many_file_metadata_by_ids(ids: resource.file_ids)
58
52
  files.each do |file|
59
- begin
60
- # If it doesn't start with fedora, we've likely already migrated it.
61
- next unless /^fedora:/.match?(file.file_identifier.to_s)
62
- resource.file_ids.delete(file.id)
53
+ # If it doesn't start with fedora, we've likely already migrated it.
54
+ next unless /^fedora:/.match?(file.file_identifier.to_s)
55
+ resource.file_ids.delete(file.id)
63
56
 
64
- Tempfile.create do |tempfile|
65
- tempfile.binmode
66
- tempfile.write(URI.open(file.file_identifier.to_s.gsub("fedora:", "http:")).read)
67
- tempfile.rewind
57
+ Tempfile.create do |tempfile|
58
+ tempfile.binmode
59
+ tempfile.write(URI.open(file.file_identifier.to_s.gsub("fedora:", "http:")).read)
60
+ tempfile.rewind
68
61
 
69
- # valkyrie_file = Hyrax.storage_adapter.upload(resource: resource, file: tempfile, original_filename: file.original_filename)
70
- valkyrie_file = Hyrax::ValkyrieUpload.file(
71
- filename: resource.label,
72
- file_set: resource,
73
- io: tempfile,
74
- use: file.pcdm_use.select {|use| Hyrax::FileMetadata::Use.use_list.include?(use)},
75
- user: User.find_or_initialize_by(User.user_key_field => resource.depositor),
76
- mime_type: file.mime_type,
77
- skip_derivatives: true
78
- )
79
- valkyrie_file = copy_attributes(valkyrie_file:, original_file: file)
80
- Hyrax.persister.save(resource: valkyrie_file)
81
- end
82
- rescue StandardError => e
83
- # Log errors specific to file migration
84
- logger.error("Error migrating file #{file.id} for resource #{resource.id}: #{e.message}")
85
- logger.error(e.backtrace.join("\n"))
62
+ # valkyrie_file = Hyrax.storage_adapter.upload(resource: resource, file: tempfile, original_filename: file.original_filename)
63
+ valkyrie_file = Hyrax::ValkyrieUpload.file(
64
+ filename: resource.label,
65
+ file_set: resource,
66
+ io: tempfile,
67
+ use: file.pcdm_use.select {|use| Hyrax::FileMetadata::Use.use_list.include?(use)},
68
+ user: User.find_or_initialize_by(User.user_key_field => resource.depositor),
69
+ mime_type: file.mime_type,
70
+ skip_derivatives: true
71
+ )
72
+ valkyrie_file = copy_attributes(valkyrie_file:, original_file: file)
73
+ Hyrax.persister.save(resource: valkyrie_file)
86
74
  end
87
75
  end
88
76
  # reindex the file set after migrating files to include characterization info
@@ -105,9 +93,9 @@ class MigrateFilesToValkyrieJob < Hyrax::ApplicationJob
105
93
  #
106
94
  # @param filename [String] the name of the derivative file: i.e. 'x-thumbnail.jpg'
107
95
  # @return [String]
108
- def container_for(path)
96
+ def container_for(filename)
109
97
  # we want the portion between the '-' and the '.'
110
- file_blob = File.basename(path, '.*').split('-').last
98
+ file_blob = File.basename(filename, '.*').split('-').last
111
99
 
112
100
  case file_blob
113
101
  when 'thumbnail'
@@ -105,13 +105,13 @@ class AdminSet < ActiveFedora::Base
105
105
 
106
106
  def check_if_empty
107
107
  return true if members.empty?
108
- errors[:base] << I18n.t('hyrax.admin.admin_sets.delete.error_not_empty')
108
+ errors.add(:base, I18n.t('hyrax.admin.admin_sets.delete.error_not_empty'))
109
109
  throw :abort
110
110
  end
111
111
 
112
112
  def check_if_not_default_set
113
113
  return true unless Hyrax::AdminSetCreateService.default_admin_set?(id: id)
114
- errors[:base] << I18n.t('hyrax.admin.admin_sets.delete.error_default_set')
114
+ errors.add(:base, I18n.t('hyrax.admin.admin_sets.delete.error_default_set'))
115
115
  throw :abort
116
116
  end
117
117
  end
@@ -23,8 +23,7 @@ module Hyrax
23
23
  valid = true
24
24
  paranoid_edit_permissions.each do |validation|
25
25
  next unless validation[:condition].call(self)
26
- errors[validation[:key]] ||= []
27
- errors[validation[:key]] << validation[:message]
26
+ errors.add(validation[:key], validation[:message])
28
27
  valid = false
29
28
  end
30
29
  valid
@@ -82,12 +82,9 @@ module Hyrax
82
82
 
83
83
  # Method to return the model
84
84
  def hydra_model(classifier: nil)
85
- # finds the model from the solr document
86
85
  model = first('has_model_ssim')&.safe_constantize
87
- # this returns nil if it isn't a valid model
88
- resource_model = (first('has_model_ssim')&.+ 'Resource')&.safe_constantize if Hyrax.config.valkyrie_transition?
89
- # if valkyrie_transition is enabled, we generally want to use the resource model if it exists
90
- resource_model || model || model_classifier(classifier).classifier(self).best_model
86
+ model = (first('has_model_ssim')&.+ 'Resource')&.safe_constantize if Hyrax.config.valkyrie_transition?
87
+ model || model_classifier(classifier).classifier(self).best_model
91
88
  end
92
89
 
93
90
  def depositor(default = '')
@@ -22,6 +22,7 @@ module Hyrax
22
22
  instance_variables.each do |ivar|
23
23
  next if ivar == :@name
24
24
  next if ivar == :@klass
25
+ next if ivar == :@uncountable
25
26
  instance_variable_set(ivar, legacy_model.model_name.send(ivar[1..-1]))
26
27
  end
27
28
  end
@@ -163,26 +163,26 @@ module Hyrax
163
163
 
164
164
  def ensure_no_collections
165
165
  return true unless collections?
166
- errors[:base] << I18n.t('hyrax.admin.collection_types.errors.not_empty')
166
+ errors.add(:base, I18n.t('hyrax.admin.collection_types.errors.not_empty'))
167
167
  throw :abort
168
168
  end
169
169
 
170
170
  def ensure_no_settings_changes_for_admin_set_type
171
171
  return true unless admin_set? && collection_type_settings_changed? && exists_for_machine_id?(ADMIN_SET_MACHINE_ID)
172
- errors[:base] << I18n.t('hyrax.admin.collection_types.errors.no_settings_change_for_admin_sets')
172
+ errors.add(:base, I18n.t('hyrax.admin.collection_types.errors.no_settings_change_for_admin_sets'))
173
173
  throw :abort
174
174
  end
175
175
 
176
176
  def ensure_no_settings_changes_for_user_collection_type
177
177
  return true unless user_collection? && collection_type_settings_changed? && exists_for_machine_id?(USER_COLLECTION_MACHINE_ID)
178
- errors[:base] << I18n.t('hyrax.admin.collection_types.errors.no_settings_change_for_user_collections')
178
+ errors.add(:base, I18n.t('hyrax.admin.collection_types.errors.no_settings_change_for_user_collections'))
179
179
  throw :abort
180
180
  end
181
181
 
182
182
  def ensure_no_settings_changes_if_collections_exist
183
183
  return true unless collections?
184
184
  return true unless collection_type_settings_changed?
185
- errors[:base] << I18n.t('hyrax.admin.collection_types.errors.no_settings_change_if_not_empty')
185
+ errors.add(:base, I18n.t('hyrax.admin.collection_types.errors.no_settings_change_if_not_empty'))
186
186
  throw :abort
187
187
  end
188
188
 
@@ -44,31 +44,16 @@ module Hyrax
44
44
 
45
45
  # @return [Array<RDF::URI>] list of all uses
46
46
  def use_list
47
- [
48
- EXTRACTED_TEXT,
49
- INTERMEDIATE_FILE,
50
- ORIGINAL_FILE,
51
- PRESERVATION_FILE,
52
- SERVICE_FILE,
53
- THUMBNAIL_IMAGE,
54
- TRANSCRIPT
55
- ]
47
+ [ORIGINAL_FILE,
48
+ THUMBNAIL_IMAGE,
49
+ EXTRACTED_TEXT,
50
+ INTERMEDIATE_FILE,
51
+ PRESERVATION_FILE,
52
+ SERVICE_FILE,
53
+ TRANSCRIPT]
56
54
  end
57
55
  module_function :use_list
58
56
 
59
- def keys
60
- [
61
- :extracted_file,
62
- :intermediate_file,
63
- :original_file,
64
- :preservation_file,
65
- :service_file,
66
- :thumbnail_file,
67
- :transcript_file
68
- ]
69
- end
70
- module_function :keys
71
-
72
57
  ##
73
58
  # @param use [RDF::URI, Symbol]
74
59
  #
@@ -31,7 +31,7 @@ class SingleUseLink < ActiveRecord::Base
31
31
  end
32
32
 
33
33
  def cannot_be_destroyed
34
- errors[:base] << "Single Use Link has already been used" if destroyed?
34
+ errors.add(:base, "Single Use Link has already been used") if destroyed?
35
35
  end
36
36
 
37
37
  def set_defaults
@@ -88,7 +88,7 @@ module Hyrax
88
88
  end
89
89
 
90
90
  def unwrap_metric(metric)
91
- metric&.metric_values&.first&.value.to_i
91
+ metric.metric_values.first.value.to_i
92
92
  end
93
93
  end
94
94
  end
@@ -76,11 +76,7 @@ module Hyrax
76
76
  end
77
77
 
78
78
  def account_info
79
- @account_info ||= if account_json_string.is_a? Hash
80
- account_json_string
81
- else
82
- JSON.parse(account_json_string)
83
- end
79
+ @account_info ||= JSON.parse(account_json_string)
84
80
  end
85
81
 
86
82
  KEYS.each do |key|
@@ -20,6 +20,7 @@ module Hyrax
20
20
  autoload :ACLIndexListener
21
21
  autoload :ActiveFedoraACLIndexListener
22
22
  autoload :BatchNotificationListener
23
+ autoload :FileListener
23
24
  autoload :FileMetadataListener
24
25
  autoload :FileSetLifecycleListener
25
26
  autoload :FileSetLifecycleNotificationListener
@@ -59,7 +59,7 @@ module Hyrax
59
59
  end
60
60
 
61
61
  # Allows us to create a Flot charts pie-graph
62
- def as_json(opts)
62
+ def as_json(opts = nil)
63
63
  @data.as_json(opts)
64
64
  end
65
65
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ module Hyrax
3
+ module Workflow
4
+ extend ActiveSupport::Autoload
5
+
6
+ autoload :WorkflowFactory
7
+ end
8
+ end
@@ -8,7 +8,7 @@ class MigrateResourceService
8
8
  end
9
9
 
10
10
  def model
11
- @model ||= Wings::ModelRegistry.lookup(resource.class).to_s
11
+ @model || Wings::ModelRegistry.lookup(resource.class).to_s
12
12
  end
13
13
 
14
14
  def call
@@ -4,7 +4,7 @@ module Hyrax
4
4
  class HasOneTitleValidator < ActiveModel::Validator
5
5
  def validate(record)
6
6
  return unless record.title.reject(&:empty?).empty?
7
- record.errors[:title] << "You must provide a title"
7
+ record.errors.add(:title, "You must provide a title")
8
8
  end
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  <div class="card">
2
-
2
+
3
3
  <div class="card-header">
4
4
  <h4><%= t('.top_collections') %>
5
5
  <div class="btn-group float-right">
@@ -41,11 +41,15 @@
41
41
  </tbody>
42
42
  </table>
43
43
  </div>
44
-
44
+
45
45
  <div class="card-footer">
46
46
  <div class="float-right">
47
- <%= paginate @top_collections, outer_window: 2, theme: 'blacklight' %>
47
+ <%= paginate @top_collections %>
48
48
  </div>
49
49
  </div>
50
50
 
51
51
  </div>
52
+
53
+
54
+
55
+
@@ -14,8 +14,8 @@
14
14
  <tbody>
15
15
  <% @top_file_set_downloads.each do |download| %>
16
16
  <tr>
17
- <td><%= download[1] %></td>
18
- <td><%= download[0] %></td>
17
+ <td><%= download[1] %></td>
18
+ <td><%= download[0] %></td>
19
19
  <td><%= download[2] %></td>
20
20
  </tr>
21
21
  <% end %>
@@ -24,7 +24,10 @@
24
24
  </div>
25
25
  <div class="card-footer">
26
26
  <div class="float-right">
27
- <%= paginate @top_file_set_downloads, outer_window: 2, theme: 'blacklight' %>
27
+ <%= paginate @top_file_set_downloads %>
28
28
  </div>
29
29
  </div>
30
30
  </div>
31
+
32
+
33
+
@@ -24,15 +24,16 @@
24
24
  <td><%= work[0] %></td>
25
25
  <td><%= work[2] %></td>
26
26
  <td><%= work[3] %></td>
27
- </tr>
27
+ </tr>
28
28
  <% end %>
29
29
  </tbody>
30
30
  </table>
31
31
  </div>
32
+
32
33
 
33
34
  <div class="card-footer">
34
35
  <div class="float-right">
35
- <%= paginate @top_works, outer_window: 2, theme: 'blacklight' %>
36
+ <%= paginate @top_works %>
36
37
  </div>
37
38
  </div>
38
39