hyrax 2.3.3 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +1 -1
- data/.github/stale.yml +19 -0
- data/README.md +2 -2
- data/app/actors/hyrax/actors/apply_permission_template_actor.rb +2 -4
- data/app/actors/hyrax/actors/create_with_files_ordered_members_actor.rb +45 -0
- data/app/actors/hyrax/actors/create_with_remote_files_ordered_members_actor.rb +96 -0
- data/app/actors/hyrax/actors/file_set_ordered_members_actor.rb +16 -0
- data/app/actors/hyrax/actors/ordered_members_actor.rb +28 -0
- data/app/assets/javascripts/hyrax/collections.js +2 -0
- data/app/assets/stylesheets/hyrax/_file-listing.scss +2 -1
- data/app/assets/stylesheets/hyrax/_work-show.scss +4 -0
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +1 -1
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +5 -2
- data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +2 -9
- data/app/helpers/hyrax/batch_edits_helper.rb +0 -1
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +1 -0
- data/app/helpers/hyrax/iiif_helper.rb +12 -0
- data/app/jobs/attach_files_to_work_with_ordered_members_job.rb +41 -0
- data/app/presenters/hyrax/work_show_presenter.rb +29 -2
- data/app/services/hyrax/permission_template_applicator.rb +48 -0
- data/app/views/hyrax/admin/collection_types/_form_settings.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_form_rendering.html.erb +7 -5
- data/app/views/hyrax/base/_form_representative.html.erb +4 -2
- data/app/views/hyrax/base/_form_thumbnail.html.erb +4 -2
- data/app/views/hyrax/base/_member.html.erb +1 -1
- data/app/views/hyrax/base/_representative_media.html.erb +1 -4
- data/app/views/hyrax/base/_show_actions.html.erb +6 -4
- data/app/views/hyrax/base/iiif_viewers/_universal_viewer.html.erb +4 -0
- data/app/views/hyrax/base/show.html.erb +2 -2
- data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/file_sets/_file_set_title.erb +2 -2
- data/app/views/hyrax/homepage/_featured.html.erb +0 -3
- data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -0
- data/app/views/hyrax/my/collections/_default_group.html.erb +1 -9
- data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/users/_activity_log.html.erb +1 -1
- data/config/locales/hyrax.de.yml +2 -0
- data/config/locales/hyrax.en.yml +2 -0
- data/config/locales/hyrax.es.yml +2 -0
- data/config/locales/hyrax.fr.yml +2 -0
- data/config/locales/hyrax.it.yml +2 -0
- data/config/locales/hyrax.pt-BR.yml +2 -0
- data/config/locales/hyrax.zh.yml +2 -0
- data/hyrax.gemspec +1 -0
- data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.de.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.es.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.fr.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.it.yml +1 -1
- data/lib/generators/hyrax/templates/config/locales/hyrax.zh.yml +1 -1
- data/lib/hyrax/configuration.rb +1 -1
- data/lib/hyrax/transactions.rb +23 -0
- data/lib/hyrax/transactions/container.rb +63 -0
- data/lib/hyrax/transactions/create_work.rb +47 -0
- data/lib/hyrax/transactions/steps/apply_permission_template.rb +29 -0
- data/lib/hyrax/transactions/steps/ensure_admin_set.rb +23 -0
- data/lib/hyrax/transactions/steps/ensure_permission_template.rb +27 -0
- data/lib/hyrax/transactions/steps/save_work.rb +35 -0
- data/lib/hyrax/transactions/steps/set_default_admin_set.rb +25 -0
- data/lib/hyrax/transactions/steps/set_modified_date.rb +25 -0
- data/lib/hyrax/transactions/steps/set_uploaded_date.rb +28 -0
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/create_with_files_ordered_members_actor_spec.rb +41 -0
- data/spec/actors/hyrax/actors/create_with_remote_files_ordered_members_actor_spec.rb +49 -0
- data/spec/actors/hyrax/actors/file_set_ordered_members_actor_spec.rb +35 -0
- data/spec/actors/hyrax/actors/ordered_members_actor_spec.rb +59 -0
- data/spec/controllers/hyrax/embargoes_controller_spec.rb +2 -0
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +6 -1
- data/spec/factories/generic_works.rb +6 -0
- data/spec/features/collection_multi_membership_spec.rb +6 -6
- data/spec/features/work_show_spec.rb +58 -5
- data/spec/helpers/hyrax/batch_edits_helper_spec.rb +4 -2
- data/spec/helpers/hyrax/iiif_helper_spec.rb +44 -0
- data/spec/hyrax/transactions/create_work_spec.rb +155 -0
- data/spec/hyrax/transactions/steps/apply_permission_template_spec.rb +72 -0
- data/spec/hyrax/transactions/steps/ensure_admin_set_spec.rb +25 -0
- data/spec/hyrax/transactions/steps/ensure_permission_template_spec.rb +33 -0
- data/spec/hyrax/transactions/steps/save_work_spec.rb +32 -0
- data/spec/hyrax/transactions/steps/set_default_admin_set_spec.rb +38 -0
- data/spec/hyrax/transactions/steps/set_modified_date_spec.rb +22 -0
- data/spec/hyrax/transactions/steps/set_uploaded_date_spec.rb +32 -0
- data/spec/jobs/attach_files_to_work_with_ordered_members_job_spec.rb +13 -0
- data/spec/presenters/hyrax/presenter_renderer_spec.rb +4 -2
- data/spec/presenters/hyrax/work_show_presenter_spec.rb +46 -2
- data/spec/services/hyrax/permission_template_applicator_spec.rb +69 -0
- data/spec/spec_helper.rb +13 -2
- data/spec/views/catalog/index.html.erb_spec.rb +7 -4
- data/spec/views/hyrax/admin/admin_sets/_show_actions.html.erb_spec.rb +2 -0
- data/spec/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb_spec.rb +4 -1
- data/spec/views/hyrax/admin/admin_sets/index.html.erb_spec.rb +6 -2
- data/spec/views/hyrax/admin/admin_sets/index.json.erb_spec.rb +1 -2
- data/spec/views/hyrax/admin/collection_types/_form_metadata_admin_set.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/admin/collection_types/_form_settings.html.erb_spec.rb +5 -26
- data/spec/views/hyrax/admin/collection_types/index.html.erb_spec.rb +26 -5
- data/spec/views/hyrax/admin/stats/show.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/base/_attribute_rows.html.erb_spec.rb +5 -1
- data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/base/_form_rendering.html.erb_spec.rb +5 -1
- data/spec/views/hyrax/base/_items.html.erb_spec.rb +2 -0
- data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +2 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +71 -0
- data/spec/views/hyrax/base/file_manager.html.erb_spec.rb +11 -14
- data/spec/views/hyrax/base/show.html.erb_spec.rb +2 -2
- data/spec/views/hyrax/base/show.json.jbuilder_spec.rb +3 -1
- data/spec/views/hyrax/collections/_show_document_list_row.html.erb_spec.rb +6 -1
- data/spec/views/hyrax/collections/_show_parent_collections.html.erb_spec.rb +5 -5
- data/spec/views/hyrax/collections/_subcollection_list.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/collections/show.html.erb_spec.rb +3 -2
- data/spec/views/hyrax/dashboard/collections/_form_share.erb_spec.rb +1 -1
- data/spec/views/hyrax/dashboard/collections/_form_share_table.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/dashboard/collections/_show_document_list_row.html.erb_spec.rb +6 -1
- data/spec/views/hyrax/dashboard/collections/_subcollection_list.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/dashboard/collections/edit.html.erb_spec.rb +3 -1
- data/spec/views/hyrax/dashboard/profiles/show.html.erb_spec.rb +2 -3
- data/spec/views/hyrax/file_sets/_show_characterization_details.html.erb_spec.rb +1 -2
- data/spec/views/hyrax/file_sets/_single_use_links.html.erb_spec.rb +1 -2
- data/spec/views/hyrax/homepage/_sortable_featured.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/my/_collection_action_menu.html.erb_spec.rb +5 -5
- data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +11 -8
- data/spec/views/hyrax/users/index.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/users/show.html.erb_spec.rb +3 -0
- data/template.rb +1 -1
- metadata +65 -3
- data/app/views/hyrax/dashboard/collections/_form_default_group_delt.html.erb +0 -27
@@ -13,8 +13,12 @@ RSpec.describe "hyrax/admin/admin_sets/index.html.erb", type: :view do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
context "when an admin set exists" do
|
16
|
-
let(:
|
17
|
-
|
16
|
+
let(:solr_doc) do
|
17
|
+
SolrDocument.new(has_model_ssim: 'AdminSet',
|
18
|
+
id: 123,
|
19
|
+
title_tesim: ['Example Admin Set'],
|
20
|
+
creator_ssim: ['jdoe@example.com'])
|
21
|
+
end
|
18
22
|
let(:admin_sets) { [solr_doc] }
|
19
23
|
let(:presenter_class) { Hyrax::AdminSetPresenter }
|
20
24
|
let(:presenter) { instance_double(presenter_class, total_items: 99) }
|
@@ -8,8 +8,7 @@ RSpec.describe "hyrax/admin/admin_sets/index.json.jbuilder" do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
context "when an admin set exists" do
|
11
|
-
let(:
|
12
|
-
let(:solr_doc) { SolrDocument.new(admin_set.to_solr) }
|
11
|
+
let(:solr_doc) { SolrDocument.new(id: '123', title_tesim: ['Example Admin Set'], description_tesim: ['Wat']) }
|
13
12
|
let(:admin_sets) { [solr_doc] }
|
14
13
|
let(:presenter_class) { Hyrax::AdminSetPresenter }
|
15
14
|
let(:presenter) { instance_double(presenter_class, total_items: 99) }
|
@@ -1,5 +1,5 @@
|
|
1
1
|
RSpec.describe 'hyrax/admin/collection_types/_form_metadata_admin_set.html.erb', type: :view do
|
2
|
-
let(:collection_type) {
|
2
|
+
let(:collection_type) { stub_model(Hyrax::CollectionType) }
|
3
3
|
let(:collection_type_form) { Hyrax::Forms::Admin::CollectionTypeForm.new }
|
4
4
|
|
5
5
|
let(:form) do
|
@@ -14,6 +14,7 @@ RSpec.describe 'hyrax/admin/collection_types/_form_settings.html.erb', type: :vi
|
|
14
14
|
].freeze
|
15
15
|
|
16
16
|
let(:collection_type_form) { Hyrax::Forms::Admin::CollectionTypeForm.new }
|
17
|
+
let(:collection_type) { stub_model(Hyrax::CollectionType) }
|
17
18
|
|
18
19
|
let(:form) do
|
19
20
|
view.simple_form_for(collection_type, url: '/update') do |fs_form|
|
@@ -22,16 +23,14 @@ RSpec.describe 'hyrax/admin/collection_types/_form_settings.html.erb', type: :vi
|
|
22
23
|
end
|
23
24
|
|
24
25
|
before do
|
26
|
+
collection_type_form.collection_type = collection_type
|
25
27
|
allow(view).to receive(:f).and_return(form)
|
26
28
|
allow(form).to receive(:object).and_return(collection_type_form)
|
27
29
|
end
|
28
30
|
|
29
31
|
context 'for non-special collection types' do
|
30
|
-
let(:collection_type) { create(:collection_type) }
|
31
|
-
|
32
32
|
context "when collection_type.collections? is false" do
|
33
33
|
before do
|
34
|
-
collection_type_form.collection_type = collection_type
|
35
34
|
allow(collection_type).to receive(:collections?).and_return(false)
|
36
35
|
render
|
37
36
|
end
|
@@ -69,35 +68,15 @@ RSpec.describe 'hyrax/admin/collection_types/_form_settings.html.erb', type: :vi
|
|
69
68
|
end
|
70
69
|
end
|
71
70
|
|
72
|
-
context '
|
73
|
-
let(:collection_type) { create(:admin_set_collection_type) }
|
74
|
-
|
75
|
-
before do
|
76
|
-
collection_type_form.collection_type = collection_type
|
77
|
-
allow(collection_type).to receive(:collections?).and_return(false)
|
78
|
-
render
|
79
|
-
end
|
80
|
-
|
81
|
-
INPUT_IDS.each do |id|
|
82
|
-
it "renders the #{id} checkbox to be disabled" do
|
83
|
-
match = rendered.match(/(<input.*id="#{id}".*)/)
|
84
|
-
expect(match).not_to be_nil
|
85
|
-
expect(match[1].index('disabled="disabled"')).not_to be_nil
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'for user collection type' do
|
91
|
-
let(:collection_type) { create(:user_collection_type) }
|
92
|
-
|
71
|
+
context 'when all_settings_disabled? is true (admin_set or user collection type)' do
|
93
72
|
before do
|
94
|
-
collection_type_form.
|
73
|
+
allow(collection_type_form).to receive(:all_settings_disabled?).and_return(true)
|
95
74
|
allow(collection_type).to receive(:collections?).and_return(false)
|
96
75
|
render
|
97
76
|
end
|
98
77
|
|
99
78
|
INPUT_IDS.each do |id|
|
100
|
-
it "renders the #{id} checkbox
|
79
|
+
it "renders the disabled #{id} checkbox " do
|
101
80
|
match = rendered.match(/(<input.*id="#{id}".*)/)
|
102
81
|
expect(match).not_to be_nil
|
103
82
|
expect(match[1].index('disabled="disabled"')).not_to be_nil
|
@@ -1,12 +1,33 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe 'hyrax/admin/collection_types/index.html.erb', type: :view
|
3
|
+
RSpec.describe 'hyrax/admin/collection_types/index.html.erb', type: :view do
|
4
|
+
let(:user_collection_type) do
|
5
|
+
stub_model(Hyrax::CollectionType,
|
6
|
+
collections?: false,
|
7
|
+
title: 'User Collection')
|
8
|
+
end
|
9
|
+
let(:admin_set_collection_type) do
|
10
|
+
stub_model(Hyrax::CollectionType,
|
11
|
+
collections?: false,
|
12
|
+
title: 'Admin Set')
|
13
|
+
end
|
14
|
+
let(:custom1) do
|
15
|
+
stub_model(Hyrax::CollectionType,
|
16
|
+
collections?: false,
|
17
|
+
title: 'Test Title 1')
|
18
|
+
end
|
19
|
+
let(:custom2) do
|
20
|
+
stub_model(Hyrax::CollectionType,
|
21
|
+
collections?: false,
|
22
|
+
title: 'Test Title 2')
|
23
|
+
end
|
24
|
+
|
4
25
|
before do
|
5
26
|
assign(:collection_types, [
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
27
|
+
user_collection_type,
|
28
|
+
admin_set_collection_type,
|
29
|
+
custom1,
|
30
|
+
custom2
|
10
31
|
])
|
11
32
|
render
|
12
33
|
end
|
@@ -7,7 +7,11 @@ RSpec.describe 'hyrax/base/_attribute_rows.html.erb', type: :view do
|
|
7
7
|
related_url: [url],
|
8
8
|
rights_statement: [rights_statement_uri])
|
9
9
|
end
|
10
|
-
let(:solr_document)
|
10
|
+
let(:solr_document) do
|
11
|
+
SolrDocument.new(has_model_ssim: 'GenericWork',
|
12
|
+
rights_statement_tesim: [rights_statement_uri],
|
13
|
+
related_url_tesim: [url])
|
14
|
+
end
|
11
15
|
let(:presenter) { Hyrax::WorkShowPresenter.new(solr_document, ability) }
|
12
16
|
|
13
17
|
let(:page) do
|
@@ -21,6 +21,7 @@ RSpec.describe 'hyrax/base/_attributes.html.erb' do
|
|
21
21
|
let(:doc) { Nokogiri::HTML(rendered) }
|
22
22
|
|
23
23
|
before do
|
24
|
+
allow(presenter).to receive(:member_of_collection_presenters).and_return([])
|
24
25
|
allow(view).to receive(:dom_class) { '' }
|
25
26
|
|
26
27
|
render 'hyrax/base/attributes', presenter: presenter
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec.describe 'hyrax/base/_form_rendering.html.erb', type: :view do
|
2
2
|
let(:ability) { double }
|
3
|
-
let(:work) {
|
3
|
+
let(:work) { stub_model(GenericWork, new_record?: false) }
|
4
4
|
let(:form) do
|
5
5
|
Hyrax::GenericWorkForm.new(work, ability, controller)
|
6
6
|
end
|
@@ -12,6 +12,10 @@ RSpec.describe 'hyrax/base/_form_rendering.html.erb', type: :view do
|
|
12
12
|
Capybara::Node::Simple.new(rendered)
|
13
13
|
end
|
14
14
|
|
15
|
+
before do
|
16
|
+
allow(form).to receive(:select_files).and_return([{ '123' => 'File one' }])
|
17
|
+
end
|
18
|
+
|
15
19
|
it 'has a rendering_ids field' do
|
16
20
|
expect(page).to have_selector("select#generic_work_rendering_ids", count: 1)
|
17
21
|
end
|
@@ -40,6 +40,8 @@ RSpec.describe 'hyrax/base/_items.html.erb', type: :view do
|
|
40
40
|
expect(Flipflop).to receive(:hide_private_items?).and_return(:flipflop)
|
41
41
|
allow(presenter).to receive(:list_of_item_ids_to_display).and_return(member_list)
|
42
42
|
allow(presenter).to receive(:member_presenters_for).with(member_list).and_return(member_list)
|
43
|
+
allow(presenter).to receive(:ordered_ids).and_return([])
|
44
|
+
|
43
45
|
allow(ability).to receive(:can?).with(:read, child1.id).and_return true
|
44
46
|
allow(ability).to receive(:can?).with(:read, child2.id).and_return false
|
45
47
|
allow(ability).to receive(:can?).with(:read, child3.id).and_return true
|
@@ -77,13 +77,14 @@ RSpec.describe 'hyrax/base/relationships', type: :view do
|
|
77
77
|
it "renders using attribute_to_html" do
|
78
78
|
allow(controller).to receive(:current_user).and_return(user)
|
79
79
|
allow(solr_doc).to receive(:member_of_collection_ids).and_return([])
|
80
|
+
allow(presenter).to receive(:grouped_presenters).and_return({})
|
80
81
|
expect(presenter).to receive(:attribute_to_html).with(:admin_set, render_as: :faceted, html_dl: true)
|
81
82
|
render 'hyrax/base/relationships', presenter: presenter
|
82
83
|
end
|
83
84
|
|
84
85
|
it "skips admin sets if user not logged in" do
|
85
86
|
allow(controller).to receive(:current_user).and_return(nil)
|
86
|
-
allow(
|
87
|
+
allow(presenter).to receive(:member_of_collection_presenters).and_return([])
|
87
88
|
expect(presenter).not_to receive(:attribute_to_html).with(:admin_set, render_as: :faceted)
|
88
89
|
render 'hyrax/base/relationships', presenter: presenter
|
89
90
|
end
|
@@ -13,6 +13,7 @@ RSpec.describe 'hyrax/base/_show_actions.html.erb', type: :view do
|
|
13
13
|
|
14
14
|
context "as an unregistered user" do
|
15
15
|
before do
|
16
|
+
allow(presenter).to receive(:show_deposit_for?).with(anything).and_return(false)
|
16
17
|
allow(presenter).to receive(:editor?).and_return(false)
|
17
18
|
render 'hyrax/base/show_actions.html.erb', presenter: presenter
|
18
19
|
end
|
@@ -25,6 +26,7 @@ RSpec.describe 'hyrax/base/_show_actions.html.erb', type: :view do
|
|
25
26
|
|
26
27
|
context "as an editor" do
|
27
28
|
before do
|
29
|
+
allow(presenter).to receive(:show_deposit_for?).with(anything).and_return(true)
|
28
30
|
allow(presenter).to receive(:editor?).and_return(true)
|
29
31
|
end
|
30
32
|
context "when the work does not contain children" do
|
@@ -75,4 +77,73 @@ RSpec.describe 'hyrax/base/_show_actions.html.erb', type: :view do
|
|
75
77
|
end
|
76
78
|
end
|
77
79
|
end
|
80
|
+
|
81
|
+
context "when user CAN deposit to at least one collection" do
|
82
|
+
before do
|
83
|
+
allow(presenter).to receive(:show_deposit_for?).with(anything).and_return(true)
|
84
|
+
allow(presenter).to receive(:member_presenters).and_return([])
|
85
|
+
end
|
86
|
+
|
87
|
+
context "and user is editor" do
|
88
|
+
before do
|
89
|
+
allow(presenter).to receive(:editor?).and_return(true)
|
90
|
+
render 'hyrax/base/show_actions.html.erb', presenter: presenter
|
91
|
+
end
|
92
|
+
|
93
|
+
it "shows editor related buttons" do
|
94
|
+
expect(rendered).not_to have_link 'File Manager'
|
95
|
+
expect(rendered).to have_link 'Edit'
|
96
|
+
expect(rendered).to have_link 'Delete'
|
97
|
+
expect(rendered).to have_button 'Add to collection'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context "and user is viewer" do
|
102
|
+
before do
|
103
|
+
allow(presenter).to receive(:editor?).and_return(false)
|
104
|
+
render 'hyrax/base/show_actions.html.erb', presenter: presenter
|
105
|
+
end
|
106
|
+
it "shows only Add to collection link" do
|
107
|
+
expect(rendered).not_to have_link 'File Manager'
|
108
|
+
expect(rendered).not_to have_link 'Edit'
|
109
|
+
expect(rendered).not_to have_link 'Delete'
|
110
|
+
expect(rendered).to have_button 'Add to collection'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "when user can NOT deposit to any collections" do
|
116
|
+
before do
|
117
|
+
allow(presenter).to receive(:show_deposit_for?).with(anything).and_return(false)
|
118
|
+
allow(presenter).to receive(:member_presenters).and_return([])
|
119
|
+
end
|
120
|
+
|
121
|
+
context "and user is editor" do
|
122
|
+
before do
|
123
|
+
allow(presenter).to receive(:editor?).and_return(true)
|
124
|
+
render 'hyrax/base/show_actions.html.erb', presenter: presenter
|
125
|
+
end
|
126
|
+
|
127
|
+
it "shows editor related buttons" do
|
128
|
+
expect(rendered).not_to have_link 'File Manager'
|
129
|
+
expect(rendered).to have_link 'Edit'
|
130
|
+
expect(rendered).to have_link 'Delete'
|
131
|
+
expect(rendered).not_to have_button 'Add to collection'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
context "and user is viewer" do
|
136
|
+
before do
|
137
|
+
allow(presenter).to receive(:editor?).and_return(false)
|
138
|
+
render 'hyrax/base/show_actions.html.erb', presenter: presenter
|
139
|
+
end
|
140
|
+
|
141
|
+
it "shows only Add to collection link" do
|
142
|
+
expect(rendered).not_to have_link 'File Manager'
|
143
|
+
expect(rendered).not_to have_link 'Edit'
|
144
|
+
expect(rendered).not_to have_link 'Delete'
|
145
|
+
expect(rendered).not_to have_button 'Add to collection'
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
78
149
|
end
|
@@ -4,27 +4,24 @@ RSpec.describe "hyrax/base/file_manager.html.erb" do
|
|
4
4
|
let(:member) { Hyrax::WorkShowPresenter.new(solr_doc_work, nil) }
|
5
5
|
let(:solr_doc) do
|
6
6
|
SolrDocument.new(
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
)
|
7
|
+
id: "test",
|
8
|
+
title_tesim: ["Test"],
|
9
|
+
thumbnail_path_ss: "/test/image/path.jpg",
|
10
|
+
label_tesim: ["file_name.tif"],
|
11
|
+
has_model_ssim: 'FileSet'
|
13
12
|
)
|
14
13
|
end
|
15
14
|
let(:solr_doc_work) do
|
16
15
|
SolrDocument.new(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
)
|
16
|
+
id: "work",
|
17
|
+
has_model_ssim: 'GenericWork',
|
18
|
+
title_tesim: ["Work"],
|
19
|
+
thumbnail_path_ss: "/test/image/path.jpg",
|
20
|
+
label_tesim: ["work"]
|
23
21
|
)
|
24
22
|
end
|
25
|
-
let(:resource) { build(:file_set) }
|
26
23
|
|
27
|
-
let(:parent) {
|
24
|
+
let(:parent) { stub_model(GenericWork, title: ["Test title"]) }
|
28
25
|
|
29
26
|
let(:form) do
|
30
27
|
Hyrax::Forms::FileManagerForm.new(parent, nil)
|
@@ -69,9 +69,9 @@ RSpec.describe 'hyrax/base/show.html.erb', type: :view do
|
|
69
69
|
expect(page).to have_content 'Foobar'
|
70
70
|
end
|
71
71
|
|
72
|
-
describe '
|
72
|
+
describe 'IIIF viewer integration' do
|
73
73
|
before do
|
74
|
-
allow(presenter).to receive(:
|
74
|
+
allow(presenter).to receive(:iiif_viewer?).and_return(viewer_enabled)
|
75
75
|
render template: 'hyrax/base/show.html.erb'
|
76
76
|
end
|
77
77
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
RSpec.describe 'hyrax/base/show.json.jbuilder' do
|
2
|
-
let(:curation_concern)
|
2
|
+
let(:curation_concern) do
|
3
|
+
stub_model(GenericWork, title: ['Test title'])
|
4
|
+
end
|
3
5
|
|
4
6
|
before do
|
5
7
|
allow(curation_concern).to receive(:etag).and_return('W/"87f79d2244ded4239ad1f0e822c8429b1e72b66c"')
|
@@ -2,7 +2,12 @@ RSpec.describe 'hyrax/collections/_show_document_list_row.html.erb', type: :view
|
|
2
2
|
let(:user) { create(:user) }
|
3
3
|
|
4
4
|
let(:work) do
|
5
|
-
|
5
|
+
mock_model(GenericWork, label: 'One Hundred Years of Solitude', date_uploaded: '1999',
|
6
|
+
collection?: true, visibility: 'open',
|
7
|
+
title: ['One Hundred Years of Solitude'],
|
8
|
+
depositor: user,
|
9
|
+
edit_groups: [],
|
10
|
+
creator: ["ggm"])
|
6
11
|
end
|
7
12
|
|
8
13
|
let(:collection) { mock_model(Collection, title: 'My awesome collection', members: [work]) }
|
@@ -11,11 +11,11 @@ RSpec.describe 'hyrax/collections/_show_parent_collections.html.erb', type: :vie
|
|
11
11
|
let(:ability) { double }
|
12
12
|
let(:solr_document) { SolrDocument.new(collection_doc) }
|
13
13
|
let(:presenter) { Hyrax::CollectionPresenter.new(solr_document, ability) }
|
14
|
-
let(:collection1) {
|
15
|
-
let(:collection2) {
|
16
|
-
let(:collection3) {
|
17
|
-
let(:collection4) {
|
18
|
-
let(:collection5) {
|
14
|
+
let(:collection1) { stub_model(Collection, id: 'col1', title: ['col1']) }
|
15
|
+
let(:collection2) { stub_model(Collection, id: 'col2', title: ['col2']) }
|
16
|
+
let(:collection3) { stub_model(Collection, id: 'col3', title: ['col3']) }
|
17
|
+
let(:collection4) { stub_model(Collection, id: 'col4', title: ['col4']) }
|
18
|
+
let(:collection5) { stub_model(Collection, id: 'col5', title: ['col5']) }
|
19
19
|
let(:parent_collections) { double(Object, documents: parent_docs, response: { "numFound" => parent_docs.size }, total_pages: 1) }
|
20
20
|
|
21
21
|
before do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
RSpec.describe 'hyrax/collections/_subcollection_list.html.erb', type: :view do
|
2
2
|
let(:subject) { render('subcollection_list.html.erb', collection: subcollection) }
|
3
|
-
let(:collection) {
|
3
|
+
let(:collection) { stub_model(Collection, id: '123') }
|
4
4
|
|
5
5
|
context 'when subcollection list is empty' do
|
6
6
|
let(:subcollection) { nil }
|
@@ -16,11 +16,12 @@ RSpec.describe 'hyrax/collections/show.html.erb', type: :view do
|
|
16
16
|
allow(view).to receive(:can?).with(:destroy, document).and_return(false)
|
17
17
|
allow(presenter).to receive(:collection_type_is_nestable?).and_return(true)
|
18
18
|
allow(presenter).to receive(:total_items).and_return(0)
|
19
|
+
allow(presenter).to receive(:total_viewable_items).and_return(0)
|
20
|
+
allow(presenter).to receive(:banner_file).and_return("banner.gif")
|
21
|
+
allow(presenter).to receive(:logo_record).and_return([{ linkurl: "logo link url", alttext: "logo alt text", file_location: "logo.gif" }])
|
19
22
|
assign(:subcollection_count, 0)
|
20
23
|
assign(:parent_collection_count, 0)
|
21
24
|
assign(:members_count, 0)
|
22
|
-
allow(presenter).to receive(:banner_file).and_return("banner.gif")
|
23
|
-
allow(presenter).to receive(:logo_record).and_return([{ linkurl: "logo link url", alttext: "logo alt text", file_location: "logo.gif" }])
|
24
25
|
allow(ability).to receive(:user_groups).and_return([])
|
25
26
|
allow(ability).to receive(:current_user).and_return(build(:user, id: nil, email: ""))
|
26
27
|
assign(:presenter, presenter)
|
@@ -6,7 +6,7 @@ RSpec.describe 'hyrax/dashboard/collections/_form_share.html.erb', type: :view d
|
|
6
6
|
to_key: template.to_key,
|
7
7
|
access_grants: template.access_grants)
|
8
8
|
end
|
9
|
-
let(:collection) {
|
9
|
+
let(:collection) { stub_model(Collection, share_applies_to_new_works?: false) }
|
10
10
|
|
11
11
|
before do
|
12
12
|
assign(:collection, collection)
|
@@ -2,7 +2,7 @@ RSpec.describe 'hyrax/dashboard/collections/_form_share_table.html.erb', type: :
|
|
2
2
|
let(:template) { stub_model(Hyrax::PermissionTemplate) }
|
3
3
|
let(:user) { create(:user) }
|
4
4
|
let(:access_grant) { stub_model(Hyrax::PermissionTemplateAccess) }
|
5
|
-
let(:collection) {
|
5
|
+
let(:collection) { stub_model(Collection, share_applies_to_new_works?: false) }
|
6
6
|
let(:pt_form) do
|
7
7
|
instance_double(Hyrax::Forms::PermissionTemplateForm,
|
8
8
|
model_name: template.model_name,
|
@@ -2,7 +2,12 @@ RSpec.describe 'hyrax/dashboard/collections/_show_document_list_row.html.erb', t
|
|
2
2
|
let(:user) { create(:user) }
|
3
3
|
|
4
4
|
let(:work) do
|
5
|
-
|
5
|
+
mock_model(GenericWork, label: 'One Hundred Years of Solitude', date_uploaded: '1999',
|
6
|
+
collection?: true, visibility: 'open',
|
7
|
+
title: ['One Hundred Years of Solitude'],
|
8
|
+
depositor: user,
|
9
|
+
edit_groups: [],
|
10
|
+
creator: ["ggm"])
|
6
11
|
end
|
7
12
|
|
8
13
|
let(:collection) { mock_model(Collection, title: 'My awesome collection', members: [work]) }
|