hyrax 4.0.0.beta2 → 4.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +126 -53
  3. data/.dassie/Gemfile +1 -1
  4. data/.dassie/app/controllers/catalog_controller.rb +1 -1
  5. data/.dassie/config/initializers/hyrax.rb +4 -0
  6. data/.github/CONTRIBUTING.md +39 -27
  7. data/.github/SUPPORT.md +2 -3
  8. data/.github/workflows/main.yml +4 -4
  9. data/.github/workflows/release.yml +10 -4
  10. data/.koppie/Gemfile +1 -2
  11. data/.koppie/app/controllers/catalog_controller.rb +1 -1
  12. data/.koppie/config/authorities/licenses.yml +7 -7
  13. data/.koppie/config/initializers/file_services.rb +4 -0
  14. data/.koppie/db/schema.rb +2 -2
  15. data/.koppie/yarn.lock +1 -1
  16. data/.regen +1 -1
  17. data/CONTAINERS.md +5 -5
  18. data/CONTRIBUTING.md +2 -2
  19. data/Dockerfile +21 -9
  20. data/README.md +24 -97
  21. data/app/actors/hyrax/actors/create_with_files_actor.rb +1 -1
  22. data/app/assets/stylesheets/hyrax/_catalog.scss +4 -0
  23. data/app/assets/stylesheets/hyrax/_forms.scss +4 -0
  24. data/app/controllers/concerns/hyrax/controller.rb +3 -24
  25. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -0
  26. data/app/controllers/hyrax/admin/strategies_controller.rb +2 -2
  27. data/app/controllers/hyrax/dashboard/collections_controller.rb +1 -1
  28. data/app/controllers/hyrax/downloads_controller.rb +16 -1
  29. data/app/controllers/hyrax/file_sets_controller.rb +9 -2
  30. data/app/controllers/hyrax/my/works_controller.rb +3 -1
  31. data/app/controllers/hyrax/transfers_controller.rb +4 -1
  32. data/app/controllers/hyrax/workflow_actions_controller.rb +3 -2
  33. data/app/forms/hyrax/forms/administrative_set_form.rb +1 -1
  34. data/app/forms/hyrax/forms/file_set_edit_form.rb +1 -1
  35. data/app/forms/hyrax/forms/file_set_form.rb +8 -35
  36. data/app/forms/hyrax/forms/pcdm_collection_form.rb +2 -2
  37. data/app/forms/hyrax/forms/pcdm_object_form.rb +46 -0
  38. data/app/forms/hyrax/forms/permission.rb +2 -2
  39. data/app/forms/hyrax/forms/resource_form.rb +19 -44
  40. data/app/forms/hyrax/forms/work_embargo_form.rb +3 -3
  41. data/app/forms/hyrax/forms/work_lease_form.rb +3 -3
  42. data/app/helpers/hyrax/content_block_helper_behavior.rb +1 -1
  43. data/app/helpers/hyrax/hyrax_helper_behavior.rb +1 -1
  44. data/app/helpers/hyrax/iiif_helper.rb +1 -1
  45. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +1 -1
  46. data/app/jobs/characterize_job.rb +3 -2
  47. data/app/jobs/valkyrie_create_derivatives_job.rb +0 -2
  48. data/app/models/collection_branding_info.rb +7 -13
  49. data/app/models/concerns/hyrax/ability.rb +1 -1
  50. data/app/models/concerns/hyrax/collection_behavior.rb +0 -47
  51. data/app/models/concerns/hyrax/solr_document/metadata.rb +1 -0
  52. data/app/models/concerns/hyrax/suppressible.rb +0 -8
  53. data/app/models/file_download_stat.rb +4 -4
  54. data/app/models/hyrax/collection_type.rb +0 -16
  55. data/app/models/hyrax/file_metadata.rb +5 -12
  56. data/app/models/hyrax/file_set.rb +1 -9
  57. data/app/models/hyrax/permission_template.rb +1 -1
  58. data/app/models/hyrax/statistic.rb +4 -4
  59. data/app/models/sipity.rb +27 -6
  60. data/app/presenters/hyrax/collection_presenter.rb +1 -1
  61. data/app/presenters/hyrax/iiif_manifest_presenter.rb +15 -5
  62. data/app/presenters/hyrax/presenter_factory.rb +2 -2
  63. data/app/presenters/hyrax/work_show_presenter.rb +1 -1
  64. data/app/presenters/hyrax/workflow_presenter.rb +1 -1
  65. data/app/search_builders/hyrax/collection_search_builder.rb +1 -0
  66. data/app/search_builders/hyrax/filter_suppressed_with_roles.rb +1 -1
  67. data/app/services/hyrax/admin_set_service.rb +1 -1
  68. data/app/services/hyrax/collections/nested_collection_query_service.rb +2 -2
  69. data/app/services/hyrax/database_migrator.rb +1 -1
  70. data/app/services/hyrax/edit_permissions_service.rb +21 -3
  71. data/app/services/hyrax/restriction_service.rb +1 -1
  72. data/app/services/hyrax/solr_query_service.rb +10 -2
  73. data/app/services/hyrax/solr_service.rb +24 -18
  74. data/app/services/hyrax/thumbnail_path_service.rb +10 -2
  75. data/app/services/hyrax/valkyrie_persist_derivatives.rb +26 -15
  76. data/app/services/hyrax/valkyrie_upload.rb +23 -30
  77. data/app/services/hyrax/visibility_propagator.rb +5 -5
  78. data/app/services/hyrax/visibility_reader.rb +1 -1
  79. data/app/services/hyrax/visibility_writer.rb +1 -1
  80. data/app/services/hyrax/workflow/permission_query.rb +5 -5
  81. data/app/services/hyrax/workflow/status_list_service.rb +1 -1
  82. data/app/validators/hyrax/collection_membership_validator.rb +2 -2
  83. data/app/views/hyrax/base/_attribute_rows.html.erb +2 -0
  84. data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +1 -1
  85. data/app/views/hyrax/file_sets/_permission.html.erb +1 -1
  86. data/app/views/hyrax/file_sets/edit.html.erb +1 -1
  87. data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
  88. data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
  89. data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
  90. data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +1 -1
  91. data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +1 -1
  92. data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
  93. data/app/views/hyrax/uploads/_js_templates.html.erb +8 -8
  94. data/app/views/hyrax/uploads/_js_templates_branding.html.erb +2 -2
  95. data/app/views/hyrax/users/_vitals.html.erb +4 -4
  96. data/chart/hyrax/Chart.yaml +7 -7
  97. data/chart/hyrax/README.md +5 -0
  98. data/chart/hyrax/templates/_helpers.tpl +14 -6
  99. data/chart/hyrax/templates/cron-embargo.yaml +1 -1
  100. data/chart/hyrax/templates/cron-lease.yaml +1 -1
  101. data/chart/hyrax/templates/deployment-worker.yaml +2 -2
  102. data/chart/hyrax/templates/extra-list.yaml +8 -0
  103. data/chart/hyrax/templates/secrets.yaml +3 -3
  104. data/chart/hyrax/values.yaml +22 -15
  105. data/config/initializers/kaminari_engine_patch.rb +16 -0
  106. data/config/locales/hyrax.de.yml +7 -7
  107. data/config/locales/hyrax.es.yml +7 -7
  108. data/config/locales/hyrax.fr.yml +8 -8
  109. data/config/locales/hyrax.it.yml +7 -7
  110. data/config/locales/hyrax.pt-BR.yml +7 -7
  111. data/config/locales/hyrax.zh.yml +8 -8
  112. data/config/metadata/file_set_metadata.yaml +130 -0
  113. data/documentation/MAINTENANCE.md +77 -0
  114. data/documentation/developing-your-hyrax-based-app.md +2 -2
  115. data/documentation/legacyREADME.md +3 -3
  116. data/hyrax.gemspec +7 -10
  117. data/lib/generators/hyrax/templates/catalog_controller.rb +1 -1
  118. data/lib/hyrax/configuration.rb +16 -0
  119. data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +1 -1
  120. data/lib/hyrax/engine.rb +2 -1
  121. data/lib/hyrax/transactions/container.rb +0 -2
  122. data/lib/hyrax/transactions/steps/save_collection_banner.rb +1 -1
  123. data/lib/hyrax/transactions/steps/save_collection_logo.rb +1 -1
  124. data/lib/hyrax/transactions/transaction.rb +3 -2
  125. data/lib/hyrax/version.rb +1 -1
  126. data/lib/hyrax.rb +0 -1
  127. data/lib/valkyrie/indexing/solr/indexing_adapter.rb +1 -1
  128. data/lib/wings/active_fedora_converter/file_metadata_node.rb +1 -1
  129. data/lib/wings/valkyrie/storage.rb +4 -1
  130. data/samvera-fall-TM3.svg +376 -0
  131. data/template.rb +1 -1
  132. metadata +43 -85
  133. data/app/conversions/power_converters/polymorphic_type.rb +0 -9
  134. data/app/conversions/power_converters/sipity_action.rb +0 -11
  135. data/app/conversions/power_converters/sipity_action_name.rb +0 -10
  136. data/app/conversions/power_converters/sipity_agent.rb +0 -9
  137. data/app/conversions/power_converters/sipity_entity.rb +0 -14
  138. data/app/conversions/power_converters/sipity_role.rb +0 -10
  139. data/app/conversions/power_converters/sipity_workflow_id.rb +0 -17
  140. data/app/conversions/power_converters/sipity_workflow_state.rb +0 -13
  141. data/app/conversions/power_converters.rb +0 -7
@@ -32,7 +32,7 @@ module Hyrax
32
32
 
33
33
  def user_has_active_workflow_role?(current_work:)
34
34
  Hyrax::Workflow::PermissionQuery.scope_permitted_workflow_actions_available_for_current_state(user: current_ability.current_user, entity: current_work).any?
35
- rescue PowerConverter::ConversionError
35
+ rescue Sipity::ConversionError
36
36
  # The current_work doesn't have a sipity workflow entity
37
37
  false
38
38
  end
@@ -15,7 +15,7 @@ module Hyrax
15
15
 
16
16
  # @param [Symbol] access :deposit, :read or :edit
17
17
  def search_results(access)
18
- response = context.repository.search(builder(access))
18
+ response = context.blacklight_config.repository.search(builder(access))
19
19
  response.documents
20
20
  end
21
21
 
@@ -51,7 +51,7 @@ module Hyrax
51
51
  def self.parent_collections(child:, scope:, page: 1)
52
52
  return [] unless nestable?(collection: child)
53
53
  query_builder = Hyrax::NestedCollectionsParentSearchBuilder.new(scope: scope, child: child, page: page)
54
- scope.repository.search(query_builder.query)
54
+ scope.blacklight_config.repository.search(query_builder.query)
55
55
  end
56
56
 
57
57
  ##
@@ -73,7 +73,7 @@ module Hyrax
73
73
  )
74
74
 
75
75
  query_builder.where(id: limit_to_id.to_s) if limit_to_id
76
- scope.repository.search(query_builder.query)
76
+ scope.blacklight_config.repository.search(query_builder.query)
77
77
  end
78
78
  private_class_method :query_solr
79
79
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'rails/generators/actions'
2
+ require 'rails/generators'
3
3
  require 'rails/generators/active_record'
4
4
 
5
5
  module Hyrax
@@ -20,17 +20,35 @@ module Hyrax
20
20
  # @note
21
21
  # +form object.class = SimpleForm::FormBuilder+
22
22
  # For works (i.e. GenericWork):
23
- # * form object.object = Hyrax::GenericWorkForm
24
- # * form object.object.model = GenericWork
23
+ # * form_object.object = Hyrax::GenericWorkForm
24
+ # * form_object.object.model = GenericWork
25
25
  # * use the work itself
26
26
  # For file_sets:
27
- # * form object.object.class = FileSet
27
+ # * form_object.object.class = FileSet
28
+ # * use work the file_set is in
29
+ # For file set forms:
30
+ # * form_object.object.class = Hyrax::Forms::FileSetForm OR
31
+ # Hyrax::Forms::FileSetEditForm
32
+ # * form_object.object.model = FileSet
28
33
  # * use work the file_set is in
29
34
  # No other object types are supported by this view.
30
35
  def self.build_service_object_from(form:, ability:)
31
36
  if form.object.respond_to?(:model) && form.object.model.work?
37
+ # The provided form object is a work form.
32
38
  new(object: form.object, ability: ability)
39
+ elsif form.object.respond_to?(:model) && form.object.model.file_set?
40
+ # The provided form object is a FileSet form. For Valkyrie forms
41
+ # (+Hyrax::Forms::FileSetForm+), +:in_works_ids+ is prepopulated onto
42
+ # the form object itself. For +Hyrax::Forms::FileSetEditForm+, the
43
+ # +:in_works+ method is present on the wrapped +:model+.
44
+ if form.object.is_a?(Hyrax::Forms::FileSetForm)
45
+ object_id = form.object.in_works_ids.first
46
+ new(object: Hyrax.query_service.find_by(id: object_id), ability: ability)
47
+ else
48
+ new(object: form.object.model.in_works.first, ability: ability)
49
+ end
33
50
  elsif form.object.file_set?
51
+ # The provided form object is a FileSet.
34
52
  new(object: form.object.in_works.first, ability: ability)
35
53
  end
36
54
  end
@@ -18,7 +18,7 @@ module Hyrax
18
18
  end
19
19
 
20
20
  def repository
21
- config.repository
21
+ config.blacklight_config.repository
22
22
  end
23
23
 
24
24
  def config
@@ -26,21 +26,29 @@ module Hyrax
26
26
  end
27
27
 
28
28
  ##
29
+ # execute the query using a GET request
29
30
  # @return [Hash] the results returned from solr for the current query
30
31
  def get
31
32
  solr_service.get(build)
32
33
  end
33
34
 
35
+ ##
36
+ # execute the solr query and return results
37
+ # @return [Hash] the results returned from solr for the current query
38
+ def query_result
39
+ solr_service.query_result(build)
40
+ end
41
+
34
42
  ##
35
43
  # @return [Enumerable<SolrDocument>]
36
44
  def solr_documents
37
- get['response']['docs'].map { |doc| self.class.document_model.new(doc) }
45
+ query_result['response']['docs'].map { |doc| self.class.document_model.new(doc) }
38
46
  end
39
47
 
40
48
  ##
41
49
  # @return [Array<String>] ids of documents matching the current query
42
50
  def get_ids # rubocop:disable Naming/AccessorMethodName
43
- results = get
51
+ results = query_result
44
52
  results['response']['docs'].map { |doc| doc['id'] }
45
53
  end
46
54
 
@@ -38,7 +38,7 @@ module Hyrax
38
38
  end
39
39
 
40
40
  delegate :add, :commit, :count, :delete, :get, :instance, :ping, :post,
41
- :query, :delete_by_query, :search_by_id, :wipe!, to: :new
41
+ :query, :query_result, :delete_by_query, :search_by_id, :wipe!, to: :new
42
42
  end
43
43
 
44
44
  # Wraps rsolr get
@@ -72,21 +72,27 @@ module Hyrax
72
72
  connection.post(solr_path, data: args)
73
73
  end
74
74
 
75
- # Wraps get by default
75
+ # Query solr using the provided or default http method, returning the result as a hash.
76
+ # @return [Hash] raw query result from solr
77
+ def query_result(query, **args)
78
+ Hyrax.logger.warn rows_warning unless args.key?(:rows)
79
+ # Use the provided solr query method, or fall back to the configured default
80
+ method = args.delete(:method) || Hyrax.config.solr_default_method
81
+
82
+ case method
83
+ when :get
84
+ get(query, **args)
85
+ when :post
86
+ post(query, **args)
87
+ else
88
+ raise "Unsupported HTTP method for querying SolrService (#{method.inspect})"
89
+ end
90
+ end
91
+
92
+ # Execute the provided query. Uses the configured http method by default.
76
93
  # @return [Array<SolrHit>] the response docs wrapped in SolrHit objects
77
94
  def query(query, **args)
78
- Hyrax.logger.warn rows_warning unless args.key?(:rows)
79
- method = args.delete(:method) || :get
80
-
81
- result = case method
82
- when :get
83
- get(query, **args)
84
- when :post
85
- post(query, **args)
86
- else
87
- raise "Unsupported HTTP method for querying SolrService (#{method.inspect})"
88
- end
89
- result['response']['docs'].map do |doc|
95
+ query_result(query, **args)['response']['docs'].map do |doc|
90
96
  ::SolrHit.new(doc)
91
97
  end
92
98
  end
@@ -114,16 +120,16 @@ module Hyrax
114
120
  end
115
121
 
116
122
  # Wraps rsolr count
117
- # @return [Hash] the hash straight form rsolr
123
+ # @return [Hash] the hash straight from rsolr
118
124
  def count(query)
119
125
  args = { rows: 0 }
120
- get(query, **args)['response']['numFound'].to_i
126
+ query_result(query, **args)['response']['numFound'].to_i
121
127
  end
122
128
 
123
129
  # Wraps ActiveFedora::Base#search_by_id(id, opts)
124
130
  # @return [Array<SolrHit>] the response docs wrapped in SolrHit objects
125
- def search_by_id(id, opts = {})
126
- result = Hyrax::SolrService.query("id:#{id}", opts.merge(rows: 1))
131
+ def search_by_id(id, **opts)
132
+ result = Hyrax::SolrService.query("id:#{id}", **opts.merge(rows: 1))
127
133
 
128
134
  raise Hyrax::ObjectNotFoundError, "Object '#{id}' not found in solr" if result.empty?
129
135
  result.first
@@ -28,7 +28,8 @@ module Hyrax
28
28
  end
29
29
 
30
30
  def fetch_thumbnail(object)
31
- return object if object.thumbnail_id == object.id
31
+ return object if object.thumbnail_id == object.id ||
32
+ object.try(:file_ids)&.detect { |fid| fid == object.thumbnail_id }
32
33
  Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: object.thumbnail_id)
33
34
  rescue Valkyrie::Persistence::ObjectNotFoundError, Hyrax::ObjectNotFoundError
34
35
  Hyrax.logger.error("Couldn't find thumbnail #{object.thumbnail_id} for #{object.id}")
@@ -53,13 +54,20 @@ module Hyrax
53
54
  # @return true if there a file on disk for this object, otherwise false
54
55
  # @param [FileSet] thumb - the object that is the thumbnail
55
56
  def thumbnail?(thumb)
56
- File.exist?(thumbnail_filepath(thumb))
57
+ File.exist?(thumbnail_filepath(thumb)) ||
58
+ (thumb.is_a?(Hyrax::Resource) && file_in_storage?(thumb))
57
59
  end
58
60
 
59
61
  # @param [FileSet] thumb - the object that is the thumbnail
60
62
  def thumbnail_filepath(thumb)
61
63
  Hyrax::DerivativePath.derivative_path_for_reference(thumb, 'thumbnail')
62
64
  end
65
+
66
+ def file_in_storage?(thumb)
67
+ Hyrax.custom_queries.find_thumbnail(file_set: thumb)
68
+ rescue Valkyrie::StorageAdapter::FileNotFound, Valkyrie::Persistence::ObjectNotFoundError
69
+ false
70
+ end
63
71
  end
64
72
  end
65
73
  end
@@ -16,22 +16,25 @@ module Hyrax
16
16
  # @param [#read] stream the derivative filestream
17
17
  # @param [Hash] directives
18
18
  # @option directives [String] :url a url to the file destination
19
- def self.call(stream, directives)
20
- filepath = URI(directives.fetch(:url)).path
21
- fileset_id = fileset_id_from_path(filepath)
22
- fileset = Hyrax.metadata_adapter.query_service.find_by(id: fileset_id)
19
+ def self.call(stream,
20
+ directives,
21
+ uploader: Hyrax::ValkyrieUpload.new(storage_adapter: Hyrax.config.derivatives_storage_adapter))
22
+ file_set = fileset_for_directives(directives)
23
23
 
24
24
  # Valkyrie storage adapters will typically expect an IO-like object that
25
25
  # responds to #path -- here we only have a StringIO, so some
26
26
  # transformation is in order
27
- tmpfile = Tempfile.new(fileset_id, encoding: 'ascii-8bit')
27
+ tmpfile = Tempfile.new(file_set.id, encoding: 'ascii-8bit')
28
28
  tmpfile.write stream.read
29
29
 
30
- Hyrax.logger.debug "Uploading thumbnail for FileSet #{fileset_id} as #{filepath}"
31
- Hyrax.config.derivatives_storage_adapter.upload(
32
- file: tmpfile,
33
- original_filename: filepath,
34
- resource: fileset
30
+ filename = filename(directives)
31
+ Hyrax.logger.debug "Uploading thumbnail for FileSet #{file_set.id} as #{filename}"
32
+
33
+ uploader.upload(
34
+ io: tmpfile,
35
+ filename: filename,
36
+ file_set: file_set,
37
+ use: Hyrax::FileMetadata::Use::THUMBNAIL
35
38
  )
36
39
  end
37
40
 
@@ -40,11 +43,19 @@ module Hyrax
40
43
  # we want to extract the FileSet id, which in this case would be 9593tv123
41
44
  #
42
45
  # @param [String] path
43
- # @return [String]
44
- def self.fileset_id_from_path(path)
45
- path.sub(Hyrax.config.derivatives_path.to_s, "")
46
- .sub(/-[^\/]+\..*$/, "")
47
- .delete("/")
46
+ # @return [Hyrax::FileSet]
47
+ def self.fileset_for_directives(directives)
48
+ path = URI(directives.fetch(:url)).path
49
+ id = path.sub(Hyrax.config.derivatives_path.to_s, "")
50
+ .delete('/')
51
+ .match(/^(.*)-\w*(\.\w+)*$/) { |m| m[1] }
52
+ raise "Could not extract fileset id from path #{path}" unless id
53
+
54
+ Hyrax.metadata_adapter.query_service.find_by(id: id)
55
+ end
56
+
57
+ def self.filename(directives)
58
+ URI(directives.fetch(:url)).path.split('/').last
48
59
  end
49
60
  end
50
61
  end
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Hyrax::ValkyrieUpload
3
+ class Hyrax::ValkyrieUpload
4
4
  # @param [IO] io
5
5
  # @param [String] filename
6
6
  # @param [Hyrax::FileSet] file_set
7
+ # @param [Valkyrie::StorageAdapter] storage_adapter
7
8
  # @param [RDF::URI] use
8
9
  # @param [User] user
9
10
  #
@@ -19,31 +20,33 @@ module Hyrax::ValkyrieUpload
19
20
  use: Hyrax::FileMetadata::Use::ORIGINAL_FILE,
20
21
  user: nil
21
22
  )
23
+ new(storage_adapter: storage_adapter)
24
+ .upload(filename: filename, file_set: file_set, io: io, use: use, user: user)
25
+ end
22
26
 
23
- streamfile = storage_adapter.upload(
24
- file: io,
25
- original_filename: filename,
26
- resource: file_set,
27
- use: use
28
- )
29
- io.close
27
+ ##
28
+ # @!attribute [r] storage_adapter
29
+ # @return [Valkyrie::StorageAdapter] storage_adapter
30
+ attr_reader :storage_adapter
31
+ ##
32
+ # @param [Valkyrie::StorageAdapter] storage_adapter
33
+ def initialize(storage_adapter: Hyrax.storage_adapter)
34
+ @storage_adapter = storage_adapter
35
+ end
30
36
 
31
- file_metadata = find_or_create_metadata(id: streamfile.id, file: streamfile)
37
+ def upload(filename:, file_set:, io:, use: Hyrax::FileMetadata::Use::ORIGINAL_FILE, user: nil)
38
+ streamfile = storage_adapter.upload(file: io, original_filename: filename, resource: file_set)
39
+ file_metadata = Hyrax::FileMetadata(streamfile)
32
40
  file_metadata.file_set_id = file_set.id
41
+ file_metadata.type += [use]
33
42
 
34
- case use
35
- when Hyrax::FileMetadata::Use::ORIGINAL_FILE
43
+ if use == Hyrax::FileMetadata::Use::ORIGINAL_FILE
36
44
  # Set file set label.
37
45
  reset_title = file_set.title.first == file_set.label
38
46
  # set title to label if that's how it was before this characterization
39
47
  file_set.title = file_metadata.original_filename if reset_title
40
48
  # always set the label to the original_name
41
49
  file_set.label = file_metadata.original_filename
42
- when Hyrax::FileMetadata::Use::THUMBNAIL
43
- # TODO: the parent work's thumbnail_id remains incorrect (it's set to the
44
- # FileSet ID, rather than the ID of this thumbnail FileMetadata; but
45
- # trying to update the parent attributes here doesn't seem to stick
46
- file_set.thumbnail_id = file_metadata.id
47
50
  end
48
51
 
49
52
  saved_metadata = Hyrax.persister.save(resource: file_metadata)
@@ -64,7 +67,7 @@ module Hyrax::ValkyrieUpload
64
67
  # @param [::User] user the user performing the add
65
68
  #
66
69
  # @return [Hyrax::FileSet] updated file set
67
- def self.add_file_to_file_set(file_set:, file_metadata:, user:)
70
+ def add_file_to_file_set(file_set:, file_metadata:, user:)
68
71
  file_set.file_ids << file_metadata.id
69
72
  set_file_use_ids(file_set, file_metadata)
70
73
 
@@ -72,12 +75,14 @@ module Hyrax::ValkyrieUpload
72
75
  Hyrax.publisher.publish('object.membership.updated', object: file_set, user: user)
73
76
  end
74
77
 
78
+ private
79
+
75
80
  # @api private
76
81
  # @param [Hyrax::FileSet] file_set the file set to add to
77
82
  # @param [Hyrax::FileMetadata] file_metadata the metadata object representing
78
83
  # the file to add
79
84
  # @return [void]
80
- def self.set_file_use_ids(file_set, file_metadata)
85
+ def set_file_use_ids(file_set, file_metadata)
81
86
  file_metadata.type.each do |type|
82
87
  case type
83
88
  when Hyrax::FileMetadata::Use::ORIGINAL_FILE
@@ -91,16 +96,4 @@ module Hyrax::ValkyrieUpload
91
96
  end
92
97
  end
93
98
  end
94
-
95
- # @api private
96
- # @param [#to_s] id
97
- # @param [Valkyrie::StorageAdapter::StreamFile] file
98
- def self.find_or_create_metadata(id:, file:)
99
- Hyrax.custom_queries.find_file_metadata_by(id: id)
100
- rescue Valkyrie::Persistence::ObjectNotFoundError => e
101
- Hyrax.logger.warn "Failed to find existing metadata for #{id}:"
102
- Hyrax.logger.warn e.message
103
- Hyrax.logger.warn "Creating Hyrax::FileMetadata now"
104
- Hyrax::FileMetadata.for(file: file)
105
- end
106
99
  end
@@ -15,13 +15,13 @@ module Hyrax
15
15
  when Hyrax::Resource # Valkyrie
16
16
  ResourceVisibilityPropagator.new(source: source)
17
17
  else
18
- NullVisibilityPropogator.new(source: source)
18
+ NullVisibilityPropagator.new(source: source)
19
19
  end
20
20
  end
21
21
 
22
22
  ##
23
- # Provides a null/logging implementation of the visibility propogator.
24
- class NullVisibilityPropogator
23
+ # Provides a null/logging implementation of the visibility propagator.
24
+ class NullVisibilityPropagator
25
25
  ##
26
26
  # @!attribute [rw] source
27
27
  # @return [#visibility]
@@ -36,8 +36,8 @@ module Hyrax
36
36
  ##
37
37
  # @return [void]
38
38
  # @raise [RuntimeError] if we're in development mode
39
- def propogate
40
- message = "Tried to propogate visibility to members of #{source} " \
39
+ def propagate
40
+ message = "Tried to propagate visibility to members of #{source} " \
41
41
  "but didn't know what kind of object it is. Model " \
42
42
  "name #{source.try(:model_name)}. Called from #{caller[0]}."
43
43
 
@@ -41,7 +41,7 @@ module Hyrax
41
41
  end
42
42
 
43
43
  def visibility_map
44
- Hyrax::VisibilityMap.instance
44
+ Hyrax.config.visibility_map
45
45
  end
46
46
  end
47
47
  end
@@ -44,7 +44,7 @@ module Hyrax
44
44
  end
45
45
 
46
46
  def visibility_map
47
- Hyrax::VisibilityMap.instance
47
+ Hyrax.config.visibility_map
48
48
  end
49
49
  end
50
50
  end
@@ -55,7 +55,7 @@ module Hyrax
55
55
  workflow_actions_scope.arel_table[:id].in(
56
56
  workflow_state_actions_scope.arel_table.project(
57
57
  workflow_state_actions_scope.arel_table[:workflow_action_id]
58
- ).where(workflow_state_actions_scope.arel.constraints.reduce)
58
+ ).where(workflow_state_actions_scope.arel.constraints.reduce(:+))
59
59
  )
60
60
  )
61
61
  end
@@ -307,7 +307,7 @@ module Hyrax
307
307
 
308
308
  entity_specific_scope = scope_processing_workflow_roles_for_user_and_entity_specific(user: user, entity: entity)
309
309
  Sipity::WorkflowRole.where(
310
- workflow_scope.arel.constraints.reduce.or(entity_specific_scope.arel.constraints.reduce)
310
+ workflow_scope.arel.constraints.reduce(:+).or(entity_specific_scope.arel.constraints.reduce(:+))
311
311
  )
312
312
  end
313
313
 
@@ -358,7 +358,7 @@ module Hyrax
358
358
  agent_scope.arel_table.project(
359
359
  agent_scope.arel_table[:id]
360
360
  ).where(
361
- agent_scope.arel.constraints.reduce.and(entity_responsibilities[:entity_id].eq(entity.id))
361
+ agent_scope.arel.constraints.reduce(:+).and(entity_responsibilities[:entity_id].eq(entity.id))
362
362
  )
363
363
  )
364
364
  )
@@ -399,7 +399,7 @@ module Hyrax
399
399
  ).where(
400
400
  permissions.arel_table[:workflow_role_id].in(
401
401
  role_scope.arel_table.project(role_scope.arel_table[:id]).where(
402
- role_scope.arel.constraints.reduce
402
+ role_scope.arel.constraints.reduce(:+)
403
403
  )
404
404
  )
405
405
  )
@@ -441,7 +441,7 @@ module Hyrax
441
441
  # @return [ActiveRecord::Relation<Sipity::WorkflowAction>]
442
442
  def scope_workflow_actions_available_for_current_state(entity:)
443
443
  workflow_actions_for_current_state = scope_workflow_actions_for_current_state(entity: entity)
444
- Sipity::WorkflowAction.where(workflow_actions_for_current_state.arel.constraints.reduce)
444
+ Sipity::WorkflowAction.where(workflow_actions_for_current_state.arel.constraints.reduce(:+))
445
445
  end
446
446
  end
447
447
  end
@@ -69,7 +69,7 @@ module Hyrax
69
69
  actionable_roles = roles_for_user
70
70
  Hyrax.logger.debug("Actionable roles for #{@user.user_key} are #{actionable_roles}")
71
71
  return [] if actionable_roles.empty?
72
- WorkRelation.new.search_with_conditions(query(actionable_roles), method: :post)
72
+ WorkRelation.new.search_with_conditions(query(actionable_roles), method: Hyrax.config.solr_default_method)
73
73
  end
74
74
 
75
75
  def query(actionable_roles)
@@ -5,8 +5,8 @@ module Hyrax
5
5
  class CollectionMembershipValidator < ActiveModel::Validator
6
6
  ##
7
7
  # @param multiple_membership_checker
8
- def initialize(multiple_membership_checker: Hyrax::MultipleMembershipChecker, **options)
9
- @multiple_membership_checker = multiple_membership_checker
8
+ def initialize(options = {})
9
+ @multiple_membership_checker = options[:multiple_membership_checker] || Hyrax::MultipleMembershipChecker
10
10
  super(options)
11
11
  end
12
12
 
@@ -1,9 +1,11 @@
1
+ <%= presenter.attribute_to_html(:alternative_title, html_dl: true) %>
1
2
  <%= presenter.attribute_to_html(:abstract, html_dl: true) %>
2
3
  <%= presenter.attribute_to_html(:date_modified, label: t('hyrax.base.show.last_modified'), html_dl: true) %>
3
4
  <%= presenter.attribute_to_html(:creator, render_as: :faceted, html_dl: true) %>
4
5
  <%= presenter.attribute_to_html(:contributor, render_as: :faceted, html_dl: true) %>
5
6
  <%= presenter.attribute_to_html(:subject, render_as: :faceted, html_dl: true) %>
6
7
  <%= presenter.attribute_to_html(:publisher, render_as: :faceted, html_dl: true) %>
8
+ <%= presenter.attribute_to_html(:bibliographic_citation, html_dl: true) %>
7
9
  <%= presenter.attribute_to_html(:language, render_as: :faceted, html_dl: true) %>
8
10
  <%= presenter.attribute_to_html(:identifier, render_as: :linked, search_field: 'identifier_tesim', html_dl: true) %>
9
11
  <%= presenter.attribute_to_html(:keyword, render_as: :faceted, html_dl: true) %>
@@ -14,7 +14,7 @@
14
14
  <p><%= t("hyrax.collection.select_form.select_heading") %></p>
15
15
 
16
16
  <% if @add_works_to_collection.present? %>
17
- <%= text_field_tag 'member_of_collection_label', @add_works_to_collection_label, size: '90', disabled: true %>
17
+ <%= text_field_tag 'member_of_collection_label', @add_works_to_collection_label, disabled: true %>
18
18
  <%= hidden_field_tag 'member_of_collection_ids', @add_works_to_collection %>
19
19
  <% else %>
20
20
  <%= text_field_tag 'member_of_collection_ids', nil,
@@ -1,5 +1,5 @@
1
1
  <div id="permissions_display" class="tab-pane">
2
- <%= simple_form_for [main_app, file_set],
2
+ <%= simple_form_for [main_app, form_object],
3
3
  html: { multipart: true,
4
4
  id: 'permission',
5
5
  data: { param_key: file_set.model_name.param_key },
@@ -33,7 +33,7 @@
33
33
  <h2><%= t('.descriptions') %></h2>
34
34
  <%= render "form" %>
35
35
  </div>
36
- <%= render "permission", file_set: curation_concern %>
36
+ <%= render "permission", file_set: curation_concern, form_object: @form %>
37
37
  <%= render "versioning", file_set: curation_concern %>
38
38
  </div>
39
39
  </div>
@@ -8,7 +8,7 @@
8
8
  </audio>
9
9
  <%= link_to t('hyrax.file_set.show.downloadable_content.audio_link'),
10
10
  hyrax.download_path(file_set),
11
- data: { label: file_set.id },
11
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids },
12
12
  target: :_blank,
13
13
  id: "file_download" %>
14
14
  </div>
@@ -4,7 +4,7 @@
4
4
  <p /><%= link_to t('hyrax.file_set.show.download'),
5
5
  hyrax.download_path(file_set),
6
6
  id: "file_download",
7
- data: { label: file_set.id },
7
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids },
8
8
  target: "_new" %>
9
9
  <% end %>
10
10
  </div>
@@ -7,7 +7,7 @@
7
7
  role: "presentation") %>
8
8
  <%= link_to t('hyrax.file_set.show.downloadable_content.image_link'),
9
9
  hyrax.download_path(file_set),
10
- data: { label: file_set.id },
10
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids },
11
11
  target: :_blank,
12
12
  id: "file_download" %>
13
13
  </div>
@@ -9,7 +9,7 @@
9
9
  hyrax.download_path(file_set),
10
10
  target: :_blank,
11
11
  id: "file_download",
12
- data: { label: file_set.id } %>
12
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids } %>
13
13
  </div>
14
14
  <% else %>
15
15
  <div>
@@ -9,7 +9,7 @@
9
9
  hyrax.download_path(file_set),
10
10
  target: :_blank,
11
11
  id: "file_download",
12
- data: { label: file_set.id } %>
12
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids } %>
13
13
  </div>
14
14
  <% else %>
15
15
  <div>
@@ -8,7 +8,7 @@
8
8
  </video>
9
9
  <%= link_to t('hyrax.file_set.show.downloadable_content.video_link'),
10
10
  hyrax.download_path(file_set),
11
- data: { label: file_set.id },
11
+ data: { label: file_set.id, work_id: @presenter.id, collection_ids: @presenter.member_of_collection_ids },
12
12
  target: :_blank,
13
13
  id: "file_download" %>
14
14
  </div>
@@ -3,18 +3,18 @@
3
3
  <script id="template-upload" type="text/x-tmpl">
4
4
  {% for (var i=0, file; file=o.files[i]; i++) { %}
5
5
  <tr class="template-upload <%= fade_class_if_not_test %>">
6
- <td>
6
+ <span>
7
7
  <span class="preview"></span>
8
- </td>
9
- <td>
8
+ </span>
9
+ <span>
10
10
  <p class="name">{%=file.name%}</p>
11
11
  <strong class="error text-danger"></strong>
12
- </td>
13
- <td>
12
+ </span>
13
+ <span>
14
14
  <p class="size">Processing...</p>
15
15
  <div class="progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-striped progress-bar-animated bg-success" style="width:0%;"></div></div>
16
- </td>
17
- <td class="text-right">
16
+ </span>
17
+ <span class="text-right">
18
18
  {% if (!i && !o.options.autoUpload) { %}
19
19
  <button class="btn btn-primary start" disabled>
20
20
  <span class="fa fa-upload"></span>
@@ -27,7 +27,7 @@
27
27
  <span><%= t('helpers.action.cancel') %></span>
28
28
  </button>
29
29
  {% } %}
30
- </td>
30
+ </span>
31
31
  </tr>
32
32
  {% } %}
33
33
  </script>