curation_concerns 1.0.0.beta4 → 1.0.0.beta5
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 +4 -4
- data/README.md +2 -3
- data/app/assets/stylesheets/curation_concerns/modules/forms.scss +16 -2
- data/app/controllers/concerns/curation_concerns/catalog_controller.rb +0 -5
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +0 -5
- data/app/helpers/curation_concerns/main_app_helpers.rb +1 -0
- data/app/helpers/curation_concerns/permissions_helper.rb +2 -4
- data/app/helpers/curation_concerns/rights_helper.rb +9 -0
- data/app/inputs/multi_value_select_input.rb +45 -0
- data/app/models/concerns/curation_concerns/collection.rb +0 -1
- data/app/presenters/curation_concerns/file_set_presenter.rb +4 -4
- data/app/presenters/curation_concerns/presents_attributes.rb +28 -2
- data/app/presenters/curation_concerns/work_show_presenter.rb +1 -8
- data/app/renderers/curation_concerns/renderers/attribute_renderer.rb +2 -33
- data/app/renderers/curation_concerns/renderers/faceted_attribute_renderer.rb +19 -0
- data/app/renderers/curation_concerns/renderers/linked_attribute_renderer.rb +20 -0
- data/app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb +27 -0
- data/app/services/curation_concerns/actors/actor_factory.rb +1 -2
- data/app/services/rights_service.rb +11 -1
- data/app/views/curation_concerns/base/_attribute_rows.html.erb +3 -3
- data/app/views/curation_concerns/base/_attributes.html.erb +1 -1
- data/app/views/curation_concerns/base/_form_permission.html.erb +1 -1
- data/app/views/curation_concerns/base/_form_rights.html.erb +4 -2
- data/app/views/records/edit_fields/_default.html.erb +1 -1
- data/config/locales/curation_concerns.en.yml +2 -0
- data/curation_concerns.gemspec +1 -1
- data/lib/curation_concerns/configuration.rb +0 -1
- data/lib/curation_concerns/version.rb +1 -1
- data/lib/generators/curation_concerns/install_generator.rb +6 -3
- data/lib/generators/curation_concerns/templates/config/initializers/simple_form.rb +170 -0
- data/lib/generators/curation_concerns/templates/config/initializers/simple_form_bootstrap.rb +150 -0
- data/spec/inputs/multi_value_with_help_input_spec.rb +0 -15
- data/spec/presenters/curation_concerns/file_set_presenter_spec.rb +15 -1
- data/spec/presenters/curation_concerns/work_show_presenter_spec.rb +0 -11
- data/spec/renderers/curation_concerns/renderers/faceted_attribute_renderer_spec.rb +21 -0
- data/spec/renderers/curation_concerns/renderers/linked_attribute_renderer_spec.rb +21 -0
- data/spec/renderers/curation_concerns/renderers/rights_attribute_renderer_spec.rb +21 -0
- data/spec/services/rights_service_spec.rb +9 -3
- data/spec/views/curation_concerns/base/_form_rights_spec.rb +41 -0
- data/spec/views/curation_concerns/base/file_manager.html.erb_spec.rb +1 -1
- metadata +19 -20
- data/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +0 -28
- data/app/actors/curation_concerns/actors/assign_identifier_actor.rb +0 -9
- data/app/actors/curation_concerns/actors/work_actor_behavior.rb +0 -12
- data/app/inputs/multi_value_with_help_input.rb +0 -8
- data/app/inputs/select_with_help_input.rb +0 -3
- data/app/inputs/select_with_modal_help_input.rb +0 -36
- data/app/inputs/with_help_icon.rb +0 -34
- data/app/search_builders/curation_concerns/search_builder.rb +0 -10
- data/spec/helpers/curation_concerns/permissions_helper_spec.rb +0 -12
- data/spec/inputs/select_with_help_input_spec.rb +0 -43
- data/spec/inputs/select_with_modal_help_input_spec.rb +0 -21
- data/spec/search_builders/curation_concerns/search_builder_spec.rb +0 -53
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curation_concerns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-05-
|
13
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hydra-head
|
@@ -178,14 +178,14 @@ dependencies:
|
|
178
178
|
requirements:
|
179
179
|
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
|
-
version: 0.
|
181
|
+
version: 0.12.0
|
182
182
|
type: :runtime
|
183
183
|
prerelease: false
|
184
184
|
version_requirements: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version: 0.
|
188
|
+
version: 0.12.0
|
189
189
|
- !ruby/object:Gem::Dependency
|
190
190
|
name: active_fedora-noid
|
191
191
|
requirement: !ruby/object:Gem::Requirement
|
@@ -613,13 +613,11 @@ files:
|
|
613
613
|
- README.md
|
614
614
|
- RELEASING.md
|
615
615
|
- Rakefile
|
616
|
-
- app/actors/concerns/curation_concerns/manages_embargoes_actor.rb
|
617
616
|
- app/actors/curation_concerns/actors.rb
|
618
617
|
- app/actors/curation_concerns/actors/abstract_actor.rb
|
619
618
|
- app/actors/curation_concerns/actors/actor_stack.rb
|
620
619
|
- app/actors/curation_concerns/actors/add_to_collection_actor.rb
|
621
620
|
- app/actors/curation_concerns/actors/apply_order_actor.rb
|
622
|
-
- app/actors/curation_concerns/actors/assign_identifier_actor.rb
|
623
621
|
- app/actors/curation_concerns/actors/assign_representative_actor.rb
|
624
622
|
- app/actors/curation_concerns/actors/attach_files_actor.rb
|
625
623
|
- app/actors/curation_concerns/actors/base_actor.rb
|
@@ -629,7 +627,6 @@ files:
|
|
629
627
|
- app/actors/curation_concerns/actors/interpret_visibility_actor.rb
|
630
628
|
- app/actors/curation_concerns/actors/lease_actor.rb
|
631
629
|
- app/actors/curation_concerns/actors/root_actor.rb
|
632
|
-
- app/actors/curation_concerns/actors/work_actor_behavior.rb
|
633
630
|
- app/assets/images/audio.png
|
634
631
|
- app/assets/images/default.png
|
635
632
|
- app/assets/images/loading.gif
|
@@ -714,17 +711,15 @@ files:
|
|
714
711
|
- app/helpers/curation_concerns/main_app_helpers.rb
|
715
712
|
- app/helpers/curation_concerns/permissions_helper.rb
|
716
713
|
- app/helpers/curation_concerns/render_constraints_helper.rb
|
714
|
+
- app/helpers/curation_concerns/rights_helper.rb
|
717
715
|
- app/helpers/curation_concerns/search_paths_helper.rb
|
718
716
|
- app/helpers/curation_concerns/title_helper.rb
|
719
717
|
- app/helpers/curation_concerns/url_helper.rb
|
720
718
|
- app/indexers/curation_concerns/collection_indexer.rb
|
721
719
|
- app/indexers/curation_concerns/file_set_indexer.rb
|
722
720
|
- app/indexers/curation_concerns/work_indexer.rb
|
723
|
-
- app/inputs/
|
721
|
+
- app/inputs/multi_value_select_input.rb
|
724
722
|
- app/inputs/multifile_input.rb
|
725
|
-
- app/inputs/select_with_help_input.rb
|
726
|
-
- app/inputs/select_with_modal_help_input.rb
|
727
|
-
- app/inputs/with_help_icon.rb
|
728
723
|
- app/jobs/audit_job.rb
|
729
724
|
- app/jobs/characterize_job.rb
|
730
725
|
- app/jobs/create_derivatives_job.rb
|
@@ -776,6 +771,9 @@ files:
|
|
776
771
|
- app/presenters/curation_concerns/work_show_presenter.rb
|
777
772
|
- app/renderers/curation_concerns/renderers/attribute_renderer.rb
|
778
773
|
- app/renderers/curation_concerns/renderers/configured_microdata.rb
|
774
|
+
- app/renderers/curation_concerns/renderers/faceted_attribute_renderer.rb
|
775
|
+
- app/renderers/curation_concerns/renderers/linked_attribute_renderer.rb
|
776
|
+
- app/renderers/curation_concerns/renderers/rights_attribute_renderer.rb
|
779
777
|
- app/renderers/renderers.rb
|
780
778
|
- app/search_builders/curation_concerns/collection_member_search_builder.rb
|
781
779
|
- app/search_builders/curation_concerns/collection_search_builder.rb
|
@@ -788,7 +786,6 @@ files:
|
|
788
786
|
- app/search_builders/curation_concerns/filter_by_type.rb
|
789
787
|
- app/search_builders/curation_concerns/lease_search_builder.rb
|
790
788
|
- app/search_builders/curation_concerns/member_search_builder.rb
|
791
|
-
- app/search_builders/curation_concerns/search_builder.rb
|
792
789
|
- app/search_builders/curation_concerns/search_filters.rb
|
793
790
|
- app/search_builders/curation_concerns/single_result.rb
|
794
791
|
- app/search_builders/curation_concerns/single_use_link_search_builder.rb
|
@@ -997,6 +994,8 @@ files:
|
|
997
994
|
- lib/generators/curation_concerns/templates/config/authorities/rights.yml
|
998
995
|
- lib/generators/curation_concerns/templates/config/clamav.rb
|
999
996
|
- lib/generators/curation_concerns/templates/config/curation_concerns.rb
|
997
|
+
- lib/generators/curation_concerns/templates/config/initializers/simple_form.rb
|
998
|
+
- lib/generators/curation_concerns/templates/config/initializers/simple_form_bootstrap.rb
|
1000
999
|
- lib/generators/curation_concerns/templates/config/mime_types.rb
|
1001
1000
|
- lib/generators/curation_concerns/templates/config/redis.yml
|
1002
1001
|
- lib/generators/curation_concerns/templates/config/redis_config.rb
|
@@ -1089,7 +1088,6 @@ files:
|
|
1089
1088
|
- spec/helpers/curation_concerns/ability_helper_spec.rb
|
1090
1089
|
- spec/helpers/curation_concerns/collections_helper_spec.rb
|
1091
1090
|
- spec/helpers/curation_concerns/file_set_helper_spec.rb
|
1092
|
-
- spec/helpers/curation_concerns/permissions_helper_spec.rb
|
1093
1091
|
- spec/helpers/render_constraints_helper_spec.rb
|
1094
1092
|
- spec/helpers/url_helper_spec.rb
|
1095
1093
|
- spec/indexers/collection_indexer_spec.rb
|
@@ -1097,8 +1095,6 @@ files:
|
|
1097
1095
|
- spec/indexers/work_indexer_spec.rb
|
1098
1096
|
- spec/inputs/multi_value_with_help_input_spec.rb
|
1099
1097
|
- spec/inputs/multifile_input_spec.rb
|
1100
|
-
- spec/inputs/select_with_help_input_spec.rb
|
1101
|
-
- spec/inputs/select_with_modal_help_input_spec.rb
|
1102
1098
|
- spec/javascripts/file_manager_member_spec.coffee
|
1103
1099
|
- spec/javascripts/fixtures/.gitkeep
|
1104
1100
|
- spec/javascripts/fixtures/file_manager_member.html
|
@@ -1150,12 +1146,14 @@ files:
|
|
1150
1146
|
- spec/presenters/embargo_presenter_spec.rb
|
1151
1147
|
- spec/presenters/lease_presenter_spec.rb
|
1152
1148
|
- spec/renderers/curation_concerns/renderers/attribute_renderer_spec.rb
|
1149
|
+
- spec/renderers/curation_concerns/renderers/faceted_attribute_renderer_spec.rb
|
1150
|
+
- spec/renderers/curation_concerns/renderers/linked_attribute_renderer_spec.rb
|
1151
|
+
- spec/renderers/curation_concerns/renderers/rights_attribute_renderer_spec.rb
|
1153
1152
|
- spec/routing/curation_concerns/routes_spec.rb
|
1154
1153
|
- spec/routing/route_spec.rb
|
1155
1154
|
- spec/search_builders/curation_concerns/embargo_search_builder_spec.rb
|
1156
1155
|
- spec/search_builders/curation_concerns/file_set_search_builder_spec.rb
|
1157
1156
|
- spec/search_builders/curation_concerns/lease_search_builder_spec.rb
|
1158
|
-
- spec/search_builders/curation_concerns/search_builder_spec.rb
|
1159
1157
|
- spec/search_builders/resource_types_service_spec.rb
|
1160
1158
|
- spec/services/curation_concern_spec.rb
|
1161
1159
|
- spec/services/derivative_path_spec.rb
|
@@ -1189,6 +1187,7 @@ files:
|
|
1189
1187
|
- spec/views/collections/_sort_and_per_page.html.erb_spec.rb
|
1190
1188
|
- spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
|
1191
1189
|
- spec/views/curation_concerns/base/_form_permission.html.erb_spec.rb
|
1190
|
+
- spec/views/curation_concerns/base/_form_rights_spec.rb
|
1192
1191
|
- spec/views/curation_concerns/base/_member.html.erb_spec.rb
|
1193
1192
|
- spec/views/curation_concerns/base/_show_actions.html.erb_spec.rb
|
1194
1193
|
- spec/views/curation_concerns/base/file_manager.html.erb_spec.rb
|
@@ -1291,7 +1290,6 @@ test_files:
|
|
1291
1290
|
- spec/helpers/curation_concerns/ability_helper_spec.rb
|
1292
1291
|
- spec/helpers/curation_concerns/collections_helper_spec.rb
|
1293
1292
|
- spec/helpers/curation_concerns/file_set_helper_spec.rb
|
1294
|
-
- spec/helpers/curation_concerns/permissions_helper_spec.rb
|
1295
1293
|
- spec/helpers/render_constraints_helper_spec.rb
|
1296
1294
|
- spec/helpers/url_helper_spec.rb
|
1297
1295
|
- spec/indexers/collection_indexer_spec.rb
|
@@ -1299,8 +1297,6 @@ test_files:
|
|
1299
1297
|
- spec/indexers/work_indexer_spec.rb
|
1300
1298
|
- spec/inputs/multi_value_with_help_input_spec.rb
|
1301
1299
|
- spec/inputs/multifile_input_spec.rb
|
1302
|
-
- spec/inputs/select_with_help_input_spec.rb
|
1303
|
-
- spec/inputs/select_with_modal_help_input_spec.rb
|
1304
1300
|
- spec/javascripts/file_manager_member_spec.coffee
|
1305
1301
|
- spec/javascripts/fixtures/.gitkeep
|
1306
1302
|
- spec/javascripts/fixtures/file_manager_member.html
|
@@ -1352,12 +1348,14 @@ test_files:
|
|
1352
1348
|
- spec/presenters/embargo_presenter_spec.rb
|
1353
1349
|
- spec/presenters/lease_presenter_spec.rb
|
1354
1350
|
- spec/renderers/curation_concerns/renderers/attribute_renderer_spec.rb
|
1351
|
+
- spec/renderers/curation_concerns/renderers/faceted_attribute_renderer_spec.rb
|
1352
|
+
- spec/renderers/curation_concerns/renderers/linked_attribute_renderer_spec.rb
|
1353
|
+
- spec/renderers/curation_concerns/renderers/rights_attribute_renderer_spec.rb
|
1355
1354
|
- spec/routing/curation_concerns/routes_spec.rb
|
1356
1355
|
- spec/routing/route_spec.rb
|
1357
1356
|
- spec/search_builders/curation_concerns/embargo_search_builder_spec.rb
|
1358
1357
|
- spec/search_builders/curation_concerns/file_set_search_builder_spec.rb
|
1359
1358
|
- spec/search_builders/curation_concerns/lease_search_builder_spec.rb
|
1360
|
-
- spec/search_builders/curation_concerns/search_builder_spec.rb
|
1361
1359
|
- spec/search_builders/resource_types_service_spec.rb
|
1362
1360
|
- spec/services/curation_concern_spec.rb
|
1363
1361
|
- spec/services/derivative_path_spec.rb
|
@@ -1391,6 +1389,7 @@ test_files:
|
|
1391
1389
|
- spec/views/collections/_sort_and_per_page.html.erb_spec.rb
|
1392
1390
|
- spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
|
1393
1391
|
- spec/views/curation_concerns/base/_form_permission.html.erb_spec.rb
|
1392
|
+
- spec/views/curation_concerns/base/_form_rights_spec.rb
|
1394
1393
|
- spec/views/curation_concerns/base/_member.html.erb_spec.rb
|
1395
1394
|
- spec/views/curation_concerns/base/_show_actions.html.erb_spec.rb
|
1396
1395
|
- spec/views/curation_concerns/base/file_manager.html.erb_spec.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module CurationConcerns
|
2
|
-
# To use this module, include it in your Actor class
|
3
|
-
# and then add its interpreters wherever you want them to run.
|
4
|
-
# They should be called _before_ apply_attributes is called because
|
5
|
-
# they intercept values in the attributes Hash.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# class MyActorClass < BaseActor
|
9
|
-
# include Worthwile::ManagesEmbargoesActor
|
10
|
-
#
|
11
|
-
# def create
|
12
|
-
# interpret_visibility && super
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# def update
|
16
|
-
# interpret_visibility && super
|
17
|
-
# end
|
18
|
-
# end
|
19
|
-
#
|
20
|
-
module ManagesEmbargoesActor
|
21
|
-
extend ActiveSupport::Concern
|
22
|
-
extend Deprecation
|
23
|
-
|
24
|
-
included do
|
25
|
-
Deprecation.warn(ManagesEmbargoesActor, "ManagesEmbargoesActor is deprecated and will be removed in CurationConcerns 1.0")
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module CurationConcerns
|
2
|
-
module Actors
|
3
|
-
module WorkActorBehavior
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
extend Deprecation
|
6
|
-
|
7
|
-
included do
|
8
|
-
Deprecation.warn(CurationConcerns::WorkActorBehavior, "CurationConcerns::WorkActorBehavior is deprecated and will be removed in CurationConcerns 1.0")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
class SelectWithModalHelpInput < MultiValueWithHelpInput
|
2
|
-
def link_to_help
|
3
|
-
template.link_to "##{attribute_name}Modal", id: "#{input_class}_help_modal", rel: 'button',
|
4
|
-
data: { toggle: 'modal' }, 'aria-label' => aria_label do
|
5
|
-
help_icon
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def select_options
|
12
|
-
@select_options ||= begin
|
13
|
-
collection = options.delete(:collection) || self.class.boolean_collection
|
14
|
-
collection.respond_to?(:call) ? collection.call : collection.to_a
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def build_field(value, _index)
|
19
|
-
html_options = input_html_options.dup
|
20
|
-
|
21
|
-
if @rendered_first_element
|
22
|
-
html_options[:id] = nil
|
23
|
-
html_options[:required] = nil
|
24
|
-
else
|
25
|
-
html_options[:id] ||= input_dom_id
|
26
|
-
end
|
27
|
-
html_options[:class] ||= []
|
28
|
-
html_options[:class] += ["#{input_dom_id} form-control multi-text-field"]
|
29
|
-
html_options[:'aria-labelledby'] = label_id
|
30
|
-
html_options.delete(:multiple)
|
31
|
-
@rendered_first_element = true
|
32
|
-
|
33
|
-
html_options.merge!(options.slice(:include_blank))
|
34
|
-
template.select_tag(attribute_name, template.options_for_select(select_options, value), html_options)
|
35
|
-
end
|
36
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module WithHelpIcon
|
2
|
-
def label(wrapper_options = nil)
|
3
|
-
"#{super} #{link_to_help}"
|
4
|
-
end
|
5
|
-
|
6
|
-
protected
|
7
|
-
|
8
|
-
def link_to_help
|
9
|
-
template.link_to '#', id: "#{input_class}_help",
|
10
|
-
data: { toggle: 'popover'.freeze,
|
11
|
-
content: metadata_help,
|
12
|
-
'original-title' => raw_label_text },
|
13
|
-
'aria-label' => aria_label do
|
14
|
-
help_icon
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def help_icon
|
19
|
-
template.content_tag 'i', nil, 'aria-hidden' => true, class: "help-icon"
|
20
|
-
end
|
21
|
-
|
22
|
-
def metadata_help
|
23
|
-
translate_from_namespace(:metadata_help) || attribute_name.to_s.humanize
|
24
|
-
end
|
25
|
-
|
26
|
-
def aria_label
|
27
|
-
translate_from_namespace(:aria_label) || default_aria_label
|
28
|
-
end
|
29
|
-
|
30
|
-
def default_aria_label
|
31
|
-
I18n.t("#{i18n_scope}.aria_label.#{lookup_model_names.join('.')}.default",
|
32
|
-
title: attribute_name.to_s.humanize)
|
33
|
-
end
|
34
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
class CurationConcerns::SearchBuilder < Blacklight::SearchBuilder
|
2
|
-
include Blacklight::Solr::SearchBuilderBehavior
|
3
|
-
include Hydra::AccessControlsEnforcement
|
4
|
-
include CurationConcerns::SearchFilters
|
5
|
-
extend Deprecation
|
6
|
-
def initialize(*)
|
7
|
-
Deprecation.warn CurationConcerns::SearchBuilder, "CurationConcerns::SearchBuilder is deprecated and will be removed in CurationConcerns 1.0. Add CurationConcerns::SearchFilters to your own SearchBuilder instead"
|
8
|
-
super
|
9
|
-
end
|
10
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CurationConcerns::PermissionsHelper do
|
4
|
-
describe "#help_link" do
|
5
|
-
subject { helper.help_link 'curation_concerns/base/visibility', 'Visibility', 'Usage information for visibility' }
|
6
|
-
|
7
|
-
it "draws help_icon" do
|
8
|
-
expect(subject).to match(/data-content="<p>This setting will determine who can view your file/)
|
9
|
-
expect(subject).to have_selector 'a i.help-icon'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'SelectWithHelpInput', type: :input do
|
4
|
-
subject { input_for form, :resource_type, options }
|
5
|
-
let(:file) { FileSet.new }
|
6
|
-
let(:form_class) do
|
7
|
-
Class.new do
|
8
|
-
include HydraEditor::Form
|
9
|
-
self.model_class = FileSet
|
10
|
-
self.terms = [:resource_type]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
let(:form) { form_class.new(FileSet.new) }
|
14
|
-
let(:collection) { ResourceTypesService.select_options }
|
15
|
-
let(:base_options) do
|
16
|
-
{ as: :select_with_help, collection: collection,
|
17
|
-
input_html: { class: 'form-control', multiple: true } }
|
18
|
-
end
|
19
|
-
let(:options) { base_options }
|
20
|
-
|
21
|
-
it "does not be required by default" do
|
22
|
-
expect(subject).to have_selector 'select'
|
23
|
-
expect(subject).not_to match(/required/)
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'with File Edit' do
|
27
|
-
let(:user) { create(:user) }
|
28
|
-
let(:file) { FileSet.create(label: 'f1') { |f| f.apply_depositor_metadata(user) } }
|
29
|
-
let(:form) { CurationConcerns::Forms::FileSetEditForm.new(file) }
|
30
|
-
let(:base_options) do
|
31
|
-
{ as: :select_with_help, collection: collection,
|
32
|
-
input_html: { class: 'form-control', multiple: true } }
|
33
|
-
end
|
34
|
-
let(:options) { base_options }
|
35
|
-
|
36
|
-
subject { input_for form, :resource_type, options }
|
37
|
-
|
38
|
-
it "is not required by default" do
|
39
|
-
expect(subject).to have_selector 'select'
|
40
|
-
expect(subject).not_to match(/required/)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'SelectWithModalHelpInput', type: :input do
|
4
|
-
subject { input_for file, :rights, options }
|
5
|
-
let(:file) { FileSet.new }
|
6
|
-
let(:base_options) { { as: :select_with_modal_help, required: true, collection: RightsService.select_options } }
|
7
|
-
let(:options) { base_options }
|
8
|
-
|
9
|
-
context "when a blank is requested" do
|
10
|
-
let(:options) { base_options.merge(include_blank: true) }
|
11
|
-
it 'renders a blank option' do
|
12
|
-
expect(subject).to have_selector 'select option[value=""]'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "when a blank is not requested" do
|
17
|
-
it 'has no blanks' do
|
18
|
-
expect(subject).to have_selector 'select option:first-child', text: 'Attribution 3.0 United States'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe CurationConcerns::SearchBuilder do
|
4
|
-
let(:processor_chain) { [:filter_models] }
|
5
|
-
let(:ability) { double('ability') }
|
6
|
-
let(:context) { double('context') }
|
7
|
-
let(:user) { double('user') }
|
8
|
-
let(:solr_params) { { fq: [] } }
|
9
|
-
|
10
|
-
subject { described_class.new(processor_chain, context) }
|
11
|
-
|
12
|
-
describe '#gated_discovery_filters' do
|
13
|
-
before do
|
14
|
-
allow(subject).to receive(:current_ability).and_return(ability)
|
15
|
-
allow(ability).to receive(:admin?).and_return(true)
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'does not filter results for admin users' do
|
19
|
-
expect(subject.gated_discovery_filters).to eq([])
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#discovery_permissions' do
|
24
|
-
context 'when showing my works' do
|
25
|
-
before { allow(subject).to receive(:blacklight_params).and_return(works: 'mine') }
|
26
|
-
|
27
|
-
it 'limits query to edit permissions' do
|
28
|
-
expect(subject.discovery_permissions).to eq(['edit'])
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#filter_models' do
|
34
|
-
context "with default work types" do
|
35
|
-
before { subject.filter_models(solr_params) }
|
36
|
-
|
37
|
-
it 'limits query to collection and generic work' do
|
38
|
-
expect(solr_params[:fq].first).to match(/{!field f=has_model_ssim}GenericWork.*OR.*{!field f=has_model_ssim}Collection/)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'when work_types is overridden' do
|
43
|
-
before do
|
44
|
-
allow(subject).to receive(:work_types).and_return([FileSet])
|
45
|
-
subject.filter_models(solr_params)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "doesn't have GenericWork" do
|
49
|
-
expect(solr_params[:fq].first).not_to match(/{!field f=has_model_ssim}GenericWork/)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|