hyrax 3.0.0.pre.beta1 → 3.0.0.pre.beta2
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.
- checksums.yaml +5 -5
- data/.circleci/config.yml +157 -68
- data/.travis.yml +4 -1
- data/Gemfile +1 -0
- data/README.md +3 -3
- data/app/actors/hyrax/actors/collections_membership_actor.rb +5 -55
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +6 -8
- data/app/actors/hyrax/actors/environment.rb +15 -0
- data/app/actors/hyrax/actors/interpret_visibility_actor.rb +22 -37
- data/app/assets/javascripts/hyrax/editor/controlled_vocabulary.es6 +1 -1
- data/app/assets/stylesheets/hyrax/_collections.scss +5 -3
- data/app/assets/stylesheets/hyrax/dashboard.scss +3 -3
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +21 -2
- data/app/controllers/hyrax/homepage_controller.rb +1 -1
- data/app/forms/hyrax/forms/work_form.rb +1 -1
- data/app/helpers/hyrax/collections_helper.rb +13 -0
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +3 -3
- data/app/indexers/hyrax/admin_set_indexer.rb +1 -1
- data/app/indexers/hyrax/basic_metadata_indexer.rb +1 -1
- data/app/indexers/hyrax/collection_indexer.rb +3 -3
- data/app/indexers/hyrax/deep_indexing_service.rb +12 -12
- data/app/indexers/hyrax/file_set_indexer.rb +1 -1
- data/app/indexers/hyrax/indexes_workflow.rb +4 -4
- data/app/indexers/hyrax/work_indexer.rb +1 -1
- data/app/models/concerns/hyrax/basic_metadata.rb +2 -0
- data/app/models/concerns/hyrax/collection_behavior.rb +3 -3
- data/app/models/concerns/hyrax/file_set/querying.rb +1 -1
- data/app/models/concerns/hyrax/human_readable_type.rb +2 -2
- data/app/models/concerns/hyrax/solr_document/characterization.rb +23 -23
- data/app/models/concerns/hyrax/solr_document/metadata.rb +3 -2
- data/app/models/concerns/hyrax/solr_document_behavior.rb +3 -3
- data/app/models/concerns/hyrax/user.rb +10 -2
- data/app/presenters/hyrax/work_show_presenter.rb +2 -2
- data/app/renderers/hyrax/renderers/faceted_attribute_renderer.rb +1 -1
- data/app/search_builders/hyrax/collection_search_builder.rb +1 -1
- data/app/search_builders/hyrax/deposit_search_builder.rb +1 -1
- data/app/search_builders/hyrax/embargo_search_builder.rb +1 -1
- data/app/search_builders/hyrax/lease_search_builder.rb +1 -1
- data/app/services/hyrax/default_middleware_stack.rb +0 -4
- data/app/services/hyrax/statistics/file_sets/by_format.rb +1 -1
- data/app/services/hyrax/statistics/works/by_resource_type.rb +1 -1
- data/app/services/hyrax/visibility_intention.rb +78 -0
- data/app/views/catalog/_index_list_default.html.erb +3 -3
- data/app/views/catalog/_thumbnail_list_collection.html.erb +3 -2
- data/app/views/hyrax/base/_attribute_rows.html.erb +1 -0
- data/app/views/hyrax/base/_form_files.html.erb +2 -2
- data/app/views/hyrax/base/_form_visibility_component.html.erb +1 -1
- data/app/views/hyrax/base/_show_actions.html.erb +6 -6
- data/app/views/hyrax/base/show.html.erb +2 -2
- data/app/views/hyrax/batch_edits/_check_all.html.erb +1 -1
- data/app/views/hyrax/batch_edits/_delete_selected.html.erb +1 -1
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +1 -1
- data/app/views/hyrax/dashboard/show_admin.html.erb +4 -4
- data/app/views/records/show_fields/_based_near.html.erb +1 -1
- data/app/views/records/show_fields/_creator.html.erb +1 -1
- data/app/views/records/show_fields/_keyword.html.erb +1 -1
- data/app/views/records/show_fields/_language.html.erb +1 -1
- data/app/views/records/show_fields/_publisher.html.erb +1 -1
- data/app/views/records/show_fields/_resource_type.html.erb +1 -1
- data/app/views/records/show_fields/_subject.html.erb +1 -1
- data/config/initializers/samvera-nesting_indexer_initializer.rb +3 -3
- data/config/locales/hyrax.de.yml +35 -22
- data/config/locales/hyrax.en.yml +22 -2
- data/config/locales/hyrax.es.yml +21 -1
- data/config/locales/hyrax.fr.yml +21 -1
- data/config/locales/hyrax.it.yml +21 -1
- data/config/locales/hyrax.pt-BR.yml +21 -1
- data/config/locales/hyrax.zh.yml +21 -1
- data/hyrax.gemspec +7 -9
- data/lib/generators/hyrax/templates/catalog_controller.rb +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.pt-BR.yml +10 -10
- data/lib/generators/hyrax/work/templates/locale.pt-BR.yml.erb +1 -1
- data/lib/hyrax/configuration.rb +18 -0
- data/lib/hyrax/engine.rb +8 -0
- data/lib/hyrax/transactions/container.rb +6 -0
- data/lib/hyrax/transactions/destroy_work.rb +21 -0
- data/lib/hyrax/transactions/steps/destroy_work.rb +24 -0
- data/lib/hyrax/version.rb +1 -1
- data/lib/wings.rb +45 -0
- data/lib/wings/active_fedora_converter.rb +56 -0
- data/lib/wings/model_transformer.rb +158 -0
- data/lib/wings/resource_factory.rb +8 -0
- data/lib/wings/valkyrie/metadata_adapter.rb +29 -0
- data/lib/wings/valkyrie/persister.rb +50 -0
- data/lib/wings/valkyrie/query_service.rb +43 -0
- data/lib/wings/valkyrie/resource_factory.rb +45 -0
- data/lib/wings/valkyrizable.rb +24 -0
- data/lib/wings/value_mapper.rb +59 -0
- data/spec/abilities/collection_ability_spec.rb +5 -5
- data/spec/abilities/permission_template_ability_spec.rb +1 -1
- data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +6 -175
- data/spec/actors/hyrax/actors/create_with_remote_files_ordered_members_actor_spec.rb +30 -22
- data/spec/actors/hyrax/actors/interpret_visibility_actor_spec.rb +2 -0
- data/spec/controllers/catalog_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +9 -9
- data/spec/controllers/hyrax/collections_controller_spec.rb +5 -5
- data/spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb +16 -13
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +9 -9
- data/spec/controllers/hyrax/dashboard/nest_collections_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +10 -1
- data/spec/controllers/hyrax/homepage_controller_spec.rb +3 -3
- data/spec/controllers/hyrax/my/shares_controller_spec.rb +1 -1
- data/spec/features/actor_stack_spec.rb +48 -0
- data/spec/features/catalog_search_spec.rb +2 -2
- data/spec/features/collection_multi_membership_spec.rb +2 -2
- data/spec/features/collection_spec.rb +7 -7
- data/spec/features/collection_type_spec.rb +2 -2
- data/spec/features/dashboard/collection_spec.rb +18 -18
- data/spec/features/delete_work_spec.rb +1 -1
- data/spec/features/search_spec.rb +2 -2
- data/spec/features/work_show_spec.rb +5 -2
- data/spec/forms/hyrax/forms/batch_upload_form_spec.rb +1 -0
- data/spec/forms/hyrax/forms/collection_form_spec.rb +5 -5
- data/spec/forms/hyrax/forms/permission_template_form_spec.rb +1 -1
- data/spec/forms/hyrax/forms/work_form_spec.rb +2 -0
- data/spec/helpers/blacklight_helper_spec.rb +3 -1
- data/spec/helpers/hyrax/collections_helper_spec.rb +42 -0
- data/spec/helpers/hyrax/dashboard_helper_behavior_spec.rb +4 -4
- data/spec/helpers/hyrax_helper_spec.rb +8 -4
- data/spec/hyrax/transactions/destroy_work_spec.rb +35 -0
- data/spec/hyrax/transactions/steps/destroy_work_spec.rb +33 -0
- data/spec/indexers/hyrax/collection_indexer_spec.rb +1 -1
- data/spec/jobs/characterize_job_spec.rb +1 -1
- data/spec/lib/hyrax/resource_sync/change_list_writer_spec.rb +35 -21
- data/spec/lib/hyrax/resource_sync/resource_list_writer_spec.rb +1 -1
- data/spec/models/collection_spec.rb +18 -18
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +2 -2
- data/spec/models/file_set_spec.rb +2 -2
- data/spec/models/hyrax/collection_type_spec.rb +2 -2
- data/spec/models/user_spec.rb +26 -1
- data/spec/presenters/hyrax/collection_presenter_spec.rb +11 -11
- data/spec/presenters/hyrax/work_show_presenter_spec.rb +11 -0
- data/spec/search_builders/hyrax/collection_member_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/collection_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/dashboard/nested_collections_search_builder_spec.rb +1 -1
- data/spec/search_builders/hyrax/work_relation_spec.rb +1 -1
- data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +2 -2
- data/spec/services/hyrax/collections/collection_member_service_spec.rb +2 -2
- data/spec/services/hyrax/collections/migration_service_spec.rb +27 -27
- data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/nested_collection_query_service_spec.rb +38 -38
- data/spec/services/hyrax/curation_concern_spec.rb +1 -1
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -2
- data/spec/services/hyrax/statistics/depositors/summary_spec.rb +1 -1
- data/spec/services/hyrax/statistics/works/by_resource_type_spec.rb +11 -4
- data/spec/services/hyrax/visibility_intention_spec.rb +144 -0
- data/spec/services/hyrax/workflow/changes_required_notification_spec.rb +1 -1
- data/spec/spec_helper.rb +10 -8
- data/spec/support/selectors.rb +10 -1
- data/spec/test_app_templates/Gemfile.extra +2 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +6 -0
- data/spec/views/catalog/_index_list_default.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_thumbnail_list_collection.html.erb_spec.rb +38 -5
- data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +9 -9
- data/spec/views/hyrax/base/show.html.erb_spec.rb +3 -2
- data/spec/views/hyrax/collections/_show_document_list_row.html.erb_spec.rb +3 -2
- data/spec/views/hyrax/dashboard/collections/_show_document_list_row.html.erb_spec.rb +3 -2
- data/spec/wings/active_fedora_converter_spec.rb +31 -0
- data/spec/wings/model_transformer_spec.rb +288 -0
- data/spec/wings/valkyrie/metadata_adapter_spec.rb +10 -0
- data/spec/wings/valkyrie/persister_spec.rb +71 -0
- data/spec/wings/valkyrie/query_service_spec.rb +81 -0
- data/spec/wings/valkyrie/resource_factory_spec.rb +32 -0
- data/spec/wings/value_mapper_spec.rb +60 -0
- data/spec/wings_spec.rb +8 -0
- data/template.rb +3 -1
- metadata +86 -36
|
@@ -8,6 +8,7 @@ module Hyrax
|
|
|
8
8
|
@curation_concern = curation_concern
|
|
9
9
|
@current_ability = current_ability
|
|
10
10
|
@attributes = attributes.to_h.with_indifferent_access
|
|
11
|
+
@actor_storage = {}
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
attr_reader :curation_concern, :current_ability, :attributes
|
|
@@ -16,6 +17,20 @@ module Hyrax
|
|
|
16
17
|
def user
|
|
17
18
|
current_ability.current_user
|
|
18
19
|
end
|
|
20
|
+
|
|
21
|
+
def store(actor, key, value)
|
|
22
|
+
store_for(actor)[key] = value
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def retrieve(actor, key)
|
|
26
|
+
store_for(actor)[key]
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def store_for(actor)
|
|
32
|
+
@actor_storage[actor] ||= {}
|
|
33
|
+
end
|
|
19
34
|
end
|
|
20
35
|
end
|
|
21
36
|
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
module Hyrax
|
|
2
2
|
module Actors
|
|
3
3
|
class InterpretVisibilityActor < AbstractActor
|
|
4
|
-
class Intention
|
|
4
|
+
class Intention < VisibilityIntention
|
|
5
5
|
def initialize(attributes)
|
|
6
6
|
@attributes = attributes
|
|
7
|
+
|
|
8
|
+
instance_vars_from_attributes
|
|
7
9
|
end
|
|
8
10
|
|
|
9
11
|
# returns a copy of attributes with the necessary params removed
|
|
@@ -21,36 +23,27 @@ module Hyrax
|
|
|
21
23
|
end
|
|
22
24
|
end
|
|
23
25
|
|
|
24
|
-
def wants_lease?
|
|
25
|
-
visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def wants_embargo?
|
|
29
|
-
visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def valid_lease?
|
|
33
|
-
wants_lease? && @attributes[:lease_expiration_date].present?
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def valid_embargo?
|
|
37
|
-
wants_embargo? && @attributes[:embargo_release_date].present?
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def lease_params
|
|
41
|
-
[:lease_expiration_date,
|
|
42
|
-
:visibility_during_lease,
|
|
43
|
-
:visibility_after_lease].map { |key| @attributes[key] }
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def embargo_params
|
|
47
|
-
[:embargo_release_date,
|
|
48
|
-
:visibility_during_embargo,
|
|
49
|
-
:visibility_after_embargo].map { |key| @attributes[key] }
|
|
50
|
-
end
|
|
51
|
-
|
|
52
26
|
private
|
|
53
27
|
|
|
28
|
+
##
|
|
29
|
+
# This method provides compatibility between form attributes passed in
|
|
30
|
+
# by the Actor, and the interface of `VisibilityIntention`. This
|
|
31
|
+
# behavior might benefit from being extracted elsewhere (the Actor?
|
|
32
|
+
# the form object?). Or it might be better to just expect clients to
|
|
33
|
+
# only pass in one set of end_date/during/after values.
|
|
34
|
+
#
|
|
35
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
36
|
+
def instance_vars_from_attributes
|
|
37
|
+
self.visibility = @attributes[:visibility]
|
|
38
|
+
self.release_date = (wants_embargo? && @attributes[:embargo_release_date].presence) ||
|
|
39
|
+
(wants_lease? && @attributes[:lease_expiration_date].presence)
|
|
40
|
+
self.after = (wants_embargo? && @attributes[:visibility_after_embargo].presence) ||
|
|
41
|
+
(wants_lease? && @attributes[:visibility_after_lease].presence)
|
|
42
|
+
self.during = (wants_embargo? && @attributes[:visibility_during_embargo].presence) ||
|
|
43
|
+
(wants_lease? && @attributes[:visibility_during_lease].presence)
|
|
44
|
+
end
|
|
45
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
46
|
+
|
|
54
47
|
def sanitize_unrestricted_params
|
|
55
48
|
@attributes.except(:lease_expiration_date,
|
|
56
49
|
:visibility_during_lease,
|
|
@@ -73,10 +66,6 @@ module Hyrax
|
|
|
73
66
|
:visibility_during_embargo,
|
|
74
67
|
:visibility_after_embargo)
|
|
75
68
|
end
|
|
76
|
-
|
|
77
|
-
def visibility
|
|
78
|
-
@attributes[:visibility]
|
|
79
|
-
end
|
|
80
69
|
end
|
|
81
70
|
|
|
82
71
|
# @param [Hyrax::Actors::Environment] env
|
|
@@ -216,16 +205,12 @@ module Hyrax
|
|
|
216
205
|
def apply_lease(env, intention)
|
|
217
206
|
return true unless intention.wants_lease?
|
|
218
207
|
env.curation_concern.apply_lease(*intention.lease_params)
|
|
219
|
-
return unless env.curation_concern.lease
|
|
220
|
-
env.curation_concern.lease.save # see https://github.com/samvera/hydra-head/issues/226
|
|
221
208
|
end
|
|
222
209
|
|
|
223
210
|
# If they want an embargo, we can assume it's valid
|
|
224
211
|
def apply_embargo(env, intention)
|
|
225
212
|
return true unless intention.wants_embargo?
|
|
226
213
|
env.curation_concern.apply_embargo(*intention.embargo_params)
|
|
227
|
-
return unless env.curation_concern.embargo
|
|
228
|
-
env.curation_concern.embargo.save # see https://github.com/samvera/hydra-head/issues/226
|
|
229
214
|
end
|
|
230
215
|
end
|
|
231
216
|
end
|
|
@@ -27,7 +27,7 @@ export default class ControlledVocabulary extends FieldManager {
|
|
|
27
27
|
|
|
28
28
|
labelControls: true,
|
|
29
29
|
}
|
|
30
|
-
super(element, options)
|
|
30
|
+
super(element, $.extend({}, options, $(element).data()))
|
|
31
31
|
this.paramKey = paramKey
|
|
32
32
|
this.fieldName = this.element.data('fieldName')
|
|
33
33
|
this.searchUrl = this.element.data('autocompleteUrl')
|
|
@@ -209,11 +209,13 @@ button.branding-banner-remove:hover {
|
|
|
209
209
|
display: flex;
|
|
210
210
|
|
|
211
211
|
.thumbnail-wrapper {
|
|
212
|
-
|
|
212
|
+
flex: 0 0 64px;
|
|
213
|
+
margin-right: 10px;
|
|
214
|
+
overflow-x: hidden;
|
|
213
215
|
|
|
214
216
|
> img {
|
|
215
|
-
height:
|
|
216
|
-
width:
|
|
217
|
+
height: auto;
|
|
218
|
+
max-width: 64px;
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
|
|
@@ -127,9 +127,12 @@ module Hyrax
|
|
|
127
127
|
|
|
128
128
|
def manifest
|
|
129
129
|
headers['Access-Control-Allow-Origin'] = '*'
|
|
130
|
+
|
|
131
|
+
json = sanitize_manifest(JSON.parse(manifest_builder.to_h.to_json))
|
|
132
|
+
|
|
130
133
|
respond_to do |wants|
|
|
131
|
-
wants.json { render json:
|
|
132
|
-
wants.html { render json:
|
|
134
|
+
wants.json { render json: json }
|
|
135
|
+
wants.html { render json: json }
|
|
133
136
|
end
|
|
134
137
|
end
|
|
135
138
|
|
|
@@ -324,5 +327,21 @@ module Hyrax
|
|
|
324
327
|
def permissions_changed?
|
|
325
328
|
@saved_permissions != curation_concern.permissions.map(&:to_hash)
|
|
326
329
|
end
|
|
330
|
+
|
|
331
|
+
def sanitize_manifest(hash)
|
|
332
|
+
hash['label'] = sanitize_value(hash['label']) if hash.key?('label')
|
|
333
|
+
hash['description'] = hash['description']&.collect { |elem| sanitize_value(elem) } if hash.key?('description')
|
|
334
|
+
|
|
335
|
+
hash['sequences']&.each do |sequence|
|
|
336
|
+
sequence['canvases']&.each do |canvas|
|
|
337
|
+
canvas['label'] = sanitize_value(canvas['label'])
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
hash
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def sanitize_value(text)
|
|
344
|
+
Loofah.fragment(text.to_s).scrub!(:prune).to_s
|
|
345
|
+
end
|
|
327
346
|
end
|
|
328
347
|
end
|
|
@@ -44,6 +44,6 @@ class Hyrax::HomepageController < ApplicationController
|
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
def sort_field
|
|
47
|
-
"#{
|
|
47
|
+
"#{ActiveFedora.index_field_mapper.solr_name('date_uploaded', :stored_sortable, type: :date)} desc"
|
|
48
48
|
end
|
|
49
49
|
end
|
|
@@ -22,7 +22,7 @@ module Hyrax
|
|
|
22
22
|
attr_reader :agreement_accepted
|
|
23
23
|
|
|
24
24
|
self.terms = [:title, :creator, :contributor, :description,
|
|
25
|
-
:keyword, :license, :rights_statement, :publisher, :date_created,
|
|
25
|
+
:keyword, :license, :rights_statement, :rights_notes, :publisher, :date_created,
|
|
26
26
|
:subject, :language, :identifier, :based_near, :related_url,
|
|
27
27
|
:representative_id, :thumbnail_id, :rendering_ids, :files,
|
|
28
28
|
:visibility_during_embargo, :embargo_release_date, :visibility_after_embargo,
|
|
@@ -20,6 +20,19 @@ module Hyrax
|
|
|
20
20
|
content_tag :span, safe_join([t('hyrax.collection.is_part_of'), ': '] + collection_links)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def render_other_collection_links(solr_doc, collection_id)
|
|
24
|
+
collection_list = Hyrax::CollectionMemberService.run(solr_doc, controller.current_ability)
|
|
25
|
+
return if collection_list.empty?
|
|
26
|
+
links = collection_list.select { |collection| collection.id != collection_id }.map { |collection| link_to collection.title_or_label, hyrax.collection_path(collection.id) }
|
|
27
|
+
return if links.empty?
|
|
28
|
+
collection_links = []
|
|
29
|
+
links.each_with_index do |link, n|
|
|
30
|
+
collection_links << link
|
|
31
|
+
collection_links << ', ' unless links[n + 1].nil?
|
|
32
|
+
end
|
|
33
|
+
content_tag :span, safe_join([t('hyrax.collection.also_belongs_to'), ': '] + collection_links)
|
|
34
|
+
end
|
|
35
|
+
|
|
23
36
|
##
|
|
24
37
|
# Append a collection_type_id to the existing querystring (whether or not it has pre-existing params)
|
|
25
38
|
# @return [String] the original url with and added collection_type_id param
|
|
@@ -89,7 +89,7 @@ module Hyrax
|
|
|
89
89
|
# @return [ActiveSupport::SafeBuffer] the html_safe link
|
|
90
90
|
def link_to_facet_list(values, solr_field, empty_message = "No value entered", separator = ", ")
|
|
91
91
|
return empty_message if values.blank?
|
|
92
|
-
facet_field =
|
|
92
|
+
facet_field = ActiveFedora.index_field_mapper.solr_name(solr_field, :facetable)
|
|
93
93
|
safe_join(values.map { |item| link_to_facet(item, facet_field) }, separator)
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -261,7 +261,7 @@ module Hyrax
|
|
|
261
261
|
def collection_title_by_id(id)
|
|
262
262
|
solr_docs = controller.repository.find(id).docs
|
|
263
263
|
return nil if solr_docs.empty?
|
|
264
|
-
solr_field = solr_docs.first[
|
|
264
|
+
solr_field = solr_docs.first[ActiveFedora.index_field_mapper.solr_name("title", :stored_searchable)]
|
|
265
265
|
return nil if solr_field.nil?
|
|
266
266
|
solr_field.first
|
|
267
267
|
end
|
|
@@ -307,7 +307,7 @@ module Hyrax
|
|
|
307
307
|
def search_state_with_facets(params, facet = {})
|
|
308
308
|
state = Blacklight::SearchState.new(params, CatalogController.blacklight_config)
|
|
309
309
|
return state.params if facet.none?
|
|
310
|
-
state.add_facet_params(
|
|
310
|
+
state.add_facet_params(ActiveFedora.index_field_mapper.solr_name(facet.keys.first, :facetable),
|
|
311
311
|
facet.values.first)
|
|
312
312
|
end
|
|
313
313
|
|
|
@@ -7,7 +7,7 @@ module Hyrax
|
|
|
7
7
|
def generate_solr_document
|
|
8
8
|
super.tap do |solr_doc|
|
|
9
9
|
# Makes Admin Sets show under the "Admin Sets" tab
|
|
10
|
-
|
|
10
|
+
ActiveFedora.index_field_mapper.set_field(solr_doc, 'generic_type', 'Admin Set', :facetable)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -3,7 +3,7 @@ module Hyrax
|
|
|
3
3
|
class BasicMetadataIndexer < ActiveFedora::RDF::IndexingService
|
|
4
4
|
class_attribute :stored_and_facetable_fields, :stored_fields, :symbol_fields
|
|
5
5
|
self.stored_and_facetable_fields = %i[resource_type creator contributor keyword publisher subject language based_near]
|
|
6
|
-
self.stored_fields = %i[description license rights_statement date_created identifier related_url bibliographic_citation source]
|
|
6
|
+
self.stored_fields = %i[description license rights_statement rights_notes date_created identifier related_url bibliographic_citation source]
|
|
7
7
|
self.symbol_fields = %i[import_url]
|
|
8
8
|
|
|
9
9
|
private
|
|
@@ -2,7 +2,7 @@ module Hyrax
|
|
|
2
2
|
class CollectionIndexer < Hydra::PCDM::CollectionIndexer
|
|
3
3
|
include Hyrax::IndexesThumbnails
|
|
4
4
|
|
|
5
|
-
STORED_LONG =
|
|
5
|
+
STORED_LONG = ActiveFedora::Indexing::Descriptor.new(:long, :stored)
|
|
6
6
|
|
|
7
7
|
self.thumbnail_path_service = Hyrax::CollectionThumbnailPathService
|
|
8
8
|
|
|
@@ -11,9 +11,9 @@ module Hyrax
|
|
|
11
11
|
def generate_solr_document
|
|
12
12
|
super.tap do |solr_doc|
|
|
13
13
|
# Makes Collections show under the "Collections" tab
|
|
14
|
-
|
|
14
|
+
ActiveFedora.index_field_mapper.set_field(solr_doc, 'generic_type', 'Collection', :facetable)
|
|
15
15
|
# Index the size of the collection in bytes
|
|
16
|
-
solr_doc[
|
|
16
|
+
solr_doc[ActiveFedora.index_field_mapper.solr_name(:bytes, STORED_LONG)] = object.bytes
|
|
17
17
|
solr_doc['visibility_ssi'] = object.visibility
|
|
18
18
|
|
|
19
19
|
object.in_collections.each do |col|
|
|
@@ -67,13 +67,13 @@ module Hyrax
|
|
|
67
67
|
# @param [Array] val an array of two elements, first is a string (the uri) and the second is a hash with one key: `:label`
|
|
68
68
|
def append_label_and_uri(solr_doc, solr_field_key, field_info, val)
|
|
69
69
|
val = val.solrize
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
ActiveFedora::Indexing::Inserter.create_and_insert_terms(solr_field_key,
|
|
71
|
+
val.first,
|
|
72
|
+
field_info.behaviors, solr_doc)
|
|
73
73
|
return unless val.last.is_a? Hash
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
ActiveFedora::Indexing::Inserter.create_and_insert_terms("#{solr_field_key}_label",
|
|
75
|
+
label(val),
|
|
76
|
+
field_info.behaviors, solr_doc)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
# Use this method to append a string value from a controlled vocabulary field
|
|
@@ -83,12 +83,12 @@ module Hyrax
|
|
|
83
83
|
# @param [Hash] field_info
|
|
84
84
|
# @param [String] val
|
|
85
85
|
def append_label(solr_doc, solr_field_key, field_info, val)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
ActiveFedora::Indexing::Inserter.create_and_insert_terms(solr_field_key,
|
|
87
|
+
val,
|
|
88
|
+
field_info.behaviors, solr_doc)
|
|
89
|
+
ActiveFedora::Indexing::Inserter.create_and_insert_terms("#{solr_field_key}_label",
|
|
90
|
+
val,
|
|
91
|
+
field_info.behaviors, solr_doc)
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
# Return a label for the solrized term:
|
|
@@ -2,7 +2,7 @@ module Hyrax
|
|
|
2
2
|
class FileSetIndexer < ActiveFedora::IndexingService
|
|
3
3
|
include Hyrax::IndexesThumbnails
|
|
4
4
|
include Hyrax::IndexesBasicMetadata
|
|
5
|
-
STORED_LONG =
|
|
5
|
+
STORED_LONG = ActiveFedora::Indexing::Descriptor.new(:long, :stored)
|
|
6
6
|
|
|
7
7
|
def generate_solr_document
|
|
8
8
|
super.tap do |solr_doc|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module Hyrax
|
|
2
2
|
module IndexesWorkflow
|
|
3
|
-
STORED_BOOL =
|
|
3
|
+
STORED_BOOL = ActiveFedora::Indexing::Descriptor.new(:boolean, :stored, :indexed)
|
|
4
4
|
|
|
5
5
|
mattr_accessor :suppressed_field, instance_writer: false do
|
|
6
|
-
|
|
6
|
+
ActiveFedora.index_field_mapper.solr_name('suppressed', STORED_BOOL)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
# Adds thumbnail indexing to the solr document
|
|
@@ -31,11 +31,11 @@ module Hyrax
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def workflow_state_name_field
|
|
34
|
-
@workflow_state_name_field ||=
|
|
34
|
+
@workflow_state_name_field ||= ActiveFedora.index_field_mapper.solr_name('workflow_state_name', :symbol)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
def workflow_role_field
|
|
38
|
-
@workflow_role_field ||=
|
|
38
|
+
@workflow_role_field ||= ActiveFedora.index_field_mapper.solr_name('actionable_workflow_roles', :symbol)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def workflow_roles(entity)
|
|
@@ -9,7 +9,7 @@ module Hyrax
|
|
|
9
9
|
solr_doc['member_ids_ssim'] = object.member_ids
|
|
10
10
|
solr_doc['member_of_collections_ssim'] = object.member_of_collections.map(&:first_title)
|
|
11
11
|
solr_doc['member_of_collection_ids_ssim'] = object.member_of_collections.map(&:id)
|
|
12
|
-
|
|
12
|
+
ActiveFedora.index_field_mapper.set_field(solr_doc, 'generic_type', 'Work', :facetable)
|
|
13
13
|
|
|
14
14
|
# This enables us to return a Work when we have a FileSet that matches
|
|
15
15
|
# the search query. While at the same time allowing us not to return Collections
|
|
@@ -19,6 +19,8 @@ module Hyrax
|
|
|
19
19
|
# Used for a license
|
|
20
20
|
property :license, predicate: ::RDF::Vocab::DC.rights
|
|
21
21
|
|
|
22
|
+
property :rights_notes, predicate: ::RDF::URI.new('http://purl.org/dc/elements/1.1/rights'), multiple: true
|
|
23
|
+
|
|
22
24
|
# This is for the rights statement
|
|
23
25
|
property :rights_statement, predicate: ::RDF::Vocab::EDM.rights
|
|
24
26
|
property :publisher, predicate: ::RDF::Vocab::DC11.publisher
|
|
@@ -89,7 +89,7 @@ module Hyrax
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def collection_type_gid_document_field_name
|
|
92
|
-
|
|
92
|
+
ActiveFedora.index_field_mapper.solr_name('collection_type_gid', *index_collection_type_gid_as)
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -171,12 +171,12 @@ module Hyrax
|
|
|
171
171
|
# Field name to look up when locating the size of each file in Solr.
|
|
172
172
|
# Override for your own installation if using something different
|
|
173
173
|
def file_size_field
|
|
174
|
-
|
|
174
|
+
ActiveFedora.index_field_mapper.solr_name(:file_size, Hyrax::FileSetIndexer::STORED_LONG)
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
# Solr field name works use to index member ids
|
|
178
178
|
def member_ids_field
|
|
179
|
-
|
|
179
|
+
ActiveFedora.index_field_mapper.solr_name('member_ids', :symbol)
|
|
180
180
|
end
|
|
181
181
|
|
|
182
182
|
def destroy_permission_template
|
|
@@ -5,7 +5,7 @@ module Hyrax
|
|
|
5
5
|
|
|
6
6
|
module ClassMethods
|
|
7
7
|
def where_digest_is(digest_string)
|
|
8
|
-
where
|
|
8
|
+
where ActiveFedora.index_field_mapper.solr_name('digest', :symbol) => urnify(digest_string)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def urnify(digest_string)
|
|
@@ -22,8 +22,8 @@ module Hyrax
|
|
|
22
22
|
|
|
23
23
|
def to_solr(solr_doc = {})
|
|
24
24
|
super(solr_doc).tap do |doc|
|
|
25
|
-
doc[
|
|
26
|
-
doc[
|
|
25
|
+
doc[ActiveFedora.index_field_mapper.solr_name('human_readable_type', :facetable)] = human_readable_type
|
|
26
|
+
doc[ActiveFedora.index_field_mapper.solr_name('human_readable_type', :stored_searchable)] = human_readable_type
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|