hyrax 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +5 -0
- data/.rubocop.yml +8 -1
- data/README.md +3 -11
- data/app/actors/hyrax/actors/file_set_actor.rb +6 -1
- data/app/assets/javascripts/hyrax.js +1 -1
- data/app/assets/javascripts/hyrax/editor.es6 +8 -0
- data/app/assets/javascripts/hyrax/save_work/save_work_control.es6 +20 -1
- data/app/assets/javascripts/hyrax/save_work/uploaded_files.es6 +1 -0
- data/app/assets/stylesheets/hyrax/_breadcrumbs.scss +25 -0
- data/app/assets/stylesheets/hyrax/_collections.scss +6 -0
- data/app/assets/stylesheets/hyrax/_file-listing.scss +5 -0
- data/app/assets/stylesheets/hyrax/_file_upload.scss +14 -0
- data/app/assets/stylesheets/hyrax/_form-progress.scss +6 -0
- data/app/assets/stylesheets/hyrax/_hyrax.scss +1 -1
- data/app/assets/stylesheets/hyrax/_styles.scss +6 -0
- data/app/assets/stylesheets/hyrax/dashboard.scss +4 -5
- data/app/builders/hyrax/bootstrap_breadcrumbs_builder.rb +10 -4
- data/app/controllers/concerns/hyrax/admin/stats_behavior.rb +25 -1
- data/app/controllers/concerns/hyrax/breadcrumbs_for_collections.rb +6 -2
- data/app/controllers/concerns/hyrax/controller.rb +1 -1
- data/app/controllers/concerns/hyrax/deny_access_override_behavior.rb +1 -1
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +1 -1
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +1 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +2 -2
- data/app/controllers/hyrax/downloads_controller.rb +1 -1
- data/app/controllers/hyrax/featured_works_controller.rb +1 -5
- data/app/controllers/hyrax/homepage_controller.rb +1 -1
- data/app/controllers/hyrax/single_use_links_controller.rb +1 -1
- data/app/controllers/hyrax/transfers_controller.rb +1 -1
- data/app/controllers/hyrax/users_controller.rb +1 -0
- data/app/helpers/hyrax/citations_behaviors/publication_behavior.rb +2 -2
- data/app/helpers/hyrax/collections_helper.rb +1 -1
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +2 -2
- data/app/jobs/characterize_job.rb +1 -1
- data/app/jobs/fixity_check_job.rb +1 -1
- data/app/jobs/import_url_job.rb +12 -1
- data/app/models/checksum_audit_log.rb +1 -1
- data/app/models/concerns/hyrax/ability.rb +1 -1
- data/app/models/hyrax/collection_type.rb +1 -1
- data/app/models/hyrax/operation.rb +4 -6
- data/app/models/hyrax/permission_template_access.rb +5 -5
- data/app/models/sipity/entity.rb +1 -1
- data/app/presenters/hyrax/admin_set_presenter.rb +9 -2
- data/app/presenters/hyrax/admin_stats_presenter.rb +52 -6
- data/app/presenters/hyrax/inspect_work_presenter.rb +1 -1
- data/app/presenters/hyrax/workflow_presenter.rb +1 -1
- data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +3 -5
- data/app/search_builders/hyrax/filter_suppressed_with_roles.rb +5 -1
- data/app/search_builders/hyrax/my/works_search_builder.rb +2 -1
- data/app/services/hyrax/collection_size_service.rb +12 -0
- data/app/services/hyrax/collections/nested_collection_query_service.rb +2 -2
- data/app/services/hyrax/graph_exporter.rb +6 -1
- data/app/services/hyrax/license_service.rb +1 -9
- data/app/services/hyrax/qa_select_service.rb +28 -0
- data/app/services/hyrax/rights_statement_service.rb +1 -1
- data/app/services/hyrax/tolerant_select_service.rb +23 -0
- data/app/services/hyrax/workflow/permission_query.rb +1 -1
- data/app/services/hyrax/workflow/sipity_actions_generator.rb +1 -1
- data/app/strategies/hyrax/strategies/yaml_strategy.rb +1 -1
- data/app/views/_logo.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/admin/workflow_roles/index.html.erb +4 -2
- data/app/views/hyrax/admin/workflows/index.html.erb +1 -1
- data/app/views/hyrax/base/_form_files.html.erb +7 -7
- data/app/views/hyrax/base/_form_progress.html.erb +10 -5
- data/app/views/hyrax/base/_share_with.html.erb +3 -11
- data/app/views/hyrax/base/_show_actions.html.erb +1 -3
- data/app/views/hyrax/batch_edits/_check_all.html.erb +15 -7
- data/app/views/hyrax/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/_index_partials/_transfers.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +7 -2
- data/app/views/hyrax/dashboard/collections/_edit_actions.html.erb +1 -2
- data/app/views/hyrax/dashboard/collections/_form.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +6 -6
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_actions.html.erb +1 -2
- data/app/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb +1 -2
- data/app/views/hyrax/dashboard/sidebar/_repository_content.html.erb +1 -2
- data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
- data/app/views/hyrax/file_sets/_actions.html.erb +1 -1
- data/app/views/hyrax/file_sets/_form.html.erb +3 -3
- data/app/views/hyrax/file_sets/_permission.html.erb +2 -2
- data/app/views/hyrax/file_sets/_permission_form.html.erb +10 -10
- data/app/views/hyrax/file_sets/_show_actions.html.erb +1 -4
- data/app/views/hyrax/file_sets/_single_use_links.html.erb +5 -0
- data/app/views/hyrax/file_sets/_versioning.html.erb +9 -7
- data/app/views/hyrax/file_sets/edit.html.erb +6 -6
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_image.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_office_document.html.erb +0 -1
- data/app/views/hyrax/file_sets/media_display/_pdf.html.erb +0 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +1 -1
- data/app/views/hyrax/my/collections/_default_group.html.erb +8 -3
- data/app/views/hyrax/my/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/my/works/_batch_actions.html.erb +1 -1
- data/app/views/hyrax/my/works/_tabs.html.erb +3 -3
- data/app/views/hyrax/single_use_links_viewer/show.html.erb +1 -1
- data/app/views/hyrax/uploads/_js_templates.html.erb +11 -11
- data/app/views/hyrax/uploads/_js_templates_branding.html.erb +2 -2
- data/app/views/layouts/_head_tag_content.html.erb +1 -1
- data/app/views/layouts/hyrax.html.erb +1 -1
- data/app/views/layouts/hyrax/dashboard.html.erb +1 -1
- data/app/views/records/edit_fields/_license.html.erb +1 -1
- data/app/views/records/edit_fields/_rights_statement.html.erb +2 -1
- data/config/features.rb +4 -0
- data/config/locales/hyrax.de.yml +1 -0
- data/config/locales/hyrax.en.yml +39 -1
- data/config/locales/hyrax.es.yml +1 -0
- data/config/locales/hyrax.fr.yml +1 -0
- data/config/locales/hyrax.it.yml +1 -0
- data/config/locales/hyrax.pt-BR.yml +1 -0
- data/config/locales/hyrax.zh.yml +1 -0
- data/hyrax.gemspec +5 -2
- data/lib/generators/hyrax/templates/mediated_deposit_workflow.json.erb +1 -0
- data/lib/hyrax.rb +7 -1
- data/lib/hyrax/arkivo/create_subscription_job.rb +1 -1
- data/lib/hyrax/redis_event_store.rb +1 -1
- data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/file_set_actor_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/stats_controller_spec.rb +31 -1
- data/spec/controllers/hyrax/collections_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +19 -3
- data/spec/controllers/hyrax/homepage_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/users_controller_spec.rb +58 -0
- data/spec/features/batch_create_spec.rb +1 -1
- data/spec/features/create_work_spec.rb +22 -2
- data/spec/features/dashboard/collection_spec.rb +3 -3
- data/spec/features/homepage_spec.rb +20 -4
- data/spec/javascripts/save_work_spec.js +50 -0
- data/spec/jobs/import_url_job_spec.rb +10 -8
- data/spec/lib/hyrax_spec.rb +9 -0
- data/spec/models/flipflop_spec.rb +8 -0
- data/spec/models/solr_document_spec.rb +2 -2
- data/spec/presenters/hyrax/admin_stats_presenter_spec.rb +73 -0
- data/spec/search_builders/hyrax/my/works_search_builder_spec.rb +0 -2
- data/spec/services/hyrax/graph_exporter_spec.rb +18 -0
- data/spec/services/hyrax/qa_select_service_spec.rb +40 -17
- data/spec/services/hyrax/tolerant_select_service_spec.rb +80 -0
- data/spec/support/fakes/fake_authority.rb +13 -0
- data/spec/support/logging_formatter.rb +1 -1
- data/spec/support/matchers/collection_type_property_matchers.rb +5 -5
- data/spec/views/hyrax/base/_form_progress.html.erb_spec.rb +11 -1
- data/spec/views/hyrax/file_sets/_show_actions.html.erb_spec.rb +0 -1
- data/spec/views/hyrax/file_sets/_single_use_links.html.erb_spec.rb +4 -0
- data/spec/views/hyrax/single_use_links_viewer/show.html.erb_spec.rb +0 -4
- data/template.rb +1 -1
- metadata +24 -11
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +0 -22
@@ -7,7 +7,7 @@ signed in %>
|
|
7
7
|
<%= tag :meta, name: 'current-user', data: { user_key: current_user.user_key } %>
|
8
8
|
<% end %>
|
9
9
|
<!-- added for use on small devices like phones -->
|
10
|
-
<meta name="viewport" content="width=device-width, initial-scale=1
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
11
11
|
<link rel="resourcesync" href="<%= hyrax.capability_list_url %>" />
|
12
12
|
|
13
13
|
<!-- Twitter card metadata -->
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
<body class="dashboard">
|
9
9
|
<div class="skip-to-content">
|
10
|
-
<%= link_to "Skip to Content", "#skip-to-content"
|
10
|
+
<%= link_to "Skip to Content", "#skip-to-content" %>
|
11
11
|
</div>
|
12
12
|
<%= render '/masthead' %>
|
13
13
|
<%= content_for(:navbar) %>
|
@@ -1,5 +1,6 @@
|
|
1
|
-
<% rights_statements = Hyrax
|
1
|
+
<% rights_statements = Hyrax.config.rights_statement_service_class.new %>
|
2
2
|
<%= f.input :rights_statement,
|
3
3
|
collection: rights_statements.select_active_options,
|
4
4
|
include_blank: true,
|
5
|
+
item_helper: rights_statements.method(:include_current_value),
|
5
6
|
input_html: { class: 'form-control' } %>
|
data/config/features.rb
CHANGED
data/config/locales/hyrax.de.yml
CHANGED
data/config/locales/hyrax.en.yml
CHANGED
@@ -314,6 +314,7 @@ en:
|
|
314
314
|
delete:
|
315
315
|
confirm: Are you sure?
|
316
316
|
header:
|
317
|
+
name: Name
|
317
318
|
roles: Roles
|
318
319
|
user: User
|
319
320
|
new_role: Assign Role
|
@@ -420,6 +421,11 @@ en:
|
|
420
421
|
header: Relationships
|
421
422
|
relationships_parent_row:
|
422
423
|
label: 'In %{type}:'
|
424
|
+
share_with:
|
425
|
+
definitions_html: "<strong>View/Download:</strong> this file (both contents and metadata) is accessible from within %{application_name}.<br />
|
426
|
+
<strong>Edit:</strong> this file (both contents and metadata) can be edited. You may only grant this permission to %{institution_name} users and/or groups."
|
427
|
+
definition_heading: "Permission Definitions"
|
428
|
+
share_with_html: "You may grant "View/Download" or "Edit" access for specific users and/or groups to files. Enter a valid %{account_name}, one at a time, select the access level for that user, and click +Add."
|
423
429
|
show:
|
424
430
|
last_modified: Last modified
|
425
431
|
social_media:
|
@@ -842,8 +848,39 @@ en:
|
|
842
848
|
header: Select an action
|
843
849
|
versions: Versions
|
844
850
|
versions_title: Display previous versions
|
851
|
+
edit:
|
852
|
+
header: "Edit %{file_set}"
|
853
|
+
descriptions: "Descriptions"
|
854
|
+
versions: "Versions"
|
855
|
+
permissions: "Permissions"
|
856
|
+
form:
|
857
|
+
attach_to: "Attach to %{parent}"
|
858
|
+
cancel: "Cancel"
|
859
|
+
save: "Save"
|
860
|
+
title: "Title"
|
845
861
|
groups_description:
|
846
862
|
description_html: The list of groups in the drop-down marked "Select a group" is a list of User Managed Groups that you are a member of. You may select a specific group and assign an access level for a file within %{application_name}, similarly to adding user access levels.
|
863
|
+
permission_form:
|
864
|
+
applied_to: "(applied to all files just uploaded)"
|
865
|
+
depositor: "Depositor"
|
866
|
+
enter: "Enter %{account_label} (one at a time)"
|
867
|
+
header: "Permissions"
|
868
|
+
optional: "(optional)"
|
869
|
+
save_note_html: "Permissions are <strong>not</strong> saved until the "Save" button is pressed at the bottom of the page."
|
870
|
+
select_group: "Select a group"
|
871
|
+
share_with: "Share With"
|
872
|
+
table_title_access: "Access Level"
|
873
|
+
table_title_user: "Person/Group"
|
874
|
+
user_search: "Search for a user"
|
875
|
+
permission:
|
876
|
+
save: "Save"
|
877
|
+
versioning:
|
878
|
+
current: "Current Version"
|
879
|
+
header: "Versions"
|
880
|
+
upload: "Upload New Version"
|
881
|
+
restore: "Restore Previous Version"
|
882
|
+
restore_from: "Restore From"
|
883
|
+
save: "Save Revision"
|
847
884
|
help:
|
848
885
|
header: User Support
|
849
886
|
override_text: Use app/views/static/help.html.erb to override this file.
|
@@ -984,7 +1021,7 @@ en:
|
|
984
1021
|
name: Work
|
985
1022
|
share_button: Share Your Work
|
986
1023
|
single_use_links:
|
987
|
-
button: Single-Use Link
|
1024
|
+
button: Create Single-Use Link
|
988
1025
|
copy:
|
989
1026
|
button: Copy
|
990
1027
|
tooltip: Copied!
|
@@ -1199,6 +1236,7 @@ en:
|
|
1199
1236
|
transfer_to: User
|
1200
1237
|
placeholders:
|
1201
1238
|
defaults:
|
1239
|
+
file: 'xxx'
|
1202
1240
|
find_child_work: Search for a work…
|
1203
1241
|
member_of_collection_ids: Select a collection…
|
1204
1242
|
required:
|
data/config/locales/hyrax.es.yml
CHANGED
data/config/locales/hyrax.fr.yml
CHANGED
data/config/locales/hyrax.it.yml
CHANGED
data/config/locales/hyrax.zh.yml
CHANGED
data/hyrax.gemspec
CHANGED
@@ -24,6 +24,8 @@ SUMMARY
|
|
24
24
|
spec.version = Hyrax::VERSION
|
25
25
|
spec.license = 'Apache-2.0'
|
26
26
|
|
27
|
+
spec.required_ruby_version = '>= 2.3'
|
28
|
+
|
27
29
|
# Note: rails does not follow sem-ver conventions, it's
|
28
30
|
# minor version releases can include breaking changes; see
|
29
31
|
# http://guides.rubyonrails.org/maintenance_policy.html
|
@@ -35,7 +37,8 @@ SUMMARY
|
|
35
37
|
spec.add_dependency 'blacklight', '~> 6.14'
|
36
38
|
spec.add_dependency 'blacklight-gallery', '~> 0.7'
|
37
39
|
spec.add_dependency 'breadcrumbs_on_rails', '~> 3.0'
|
38
|
-
|
40
|
+
# Pin browse-everything to stable version
|
41
|
+
spec.add_dependency 'browse-everything', '< 0.16'
|
39
42
|
spec.add_dependency 'carrierwave', '~> 1.0'
|
40
43
|
spec.add_dependency 'clipboard-rails', '~> 1.5'
|
41
44
|
spec.add_dependency 'dry-equalizer', '~> 0.2'
|
@@ -92,7 +95,7 @@ SUMMARY
|
|
92
95
|
spec.add_development_dependency 'rspec-its', '~> 1.1'
|
93
96
|
spec.add_development_dependency 'rspec-rails', '~> 3.1'
|
94
97
|
spec.add_development_dependency "selenium-webdriver"
|
95
|
-
spec.add_development_dependency 'solr_wrapper', '
|
98
|
+
spec.add_development_dependency 'solr_wrapper', '>= 1.1', '< 3.0'
|
96
99
|
spec.add_development_dependency 'i18n-debug' if ENV['I18N_DEBUG']
|
97
100
|
spec.add_development_dependency 'i18n_yaml_sorter' unless ENV['TRAVIS']
|
98
101
|
spec.add_development_dependency 'rails-controller-testing', '~> 1'
|
data/lib/hyrax.rb
CHANGED
@@ -46,7 +46,13 @@ module Hyrax
|
|
46
46
|
@config
|
47
47
|
end
|
48
48
|
|
49
|
+
##
|
50
|
+
# @return [Logger]
|
51
|
+
def self.logger
|
52
|
+
@logger ||= ActiveFedora::Base.logger
|
53
|
+
end
|
54
|
+
|
49
55
|
def self.primary_work_type
|
50
|
-
|
56
|
+
config.curation_concerns.first
|
51
57
|
end
|
52
58
|
end
|
@@ -8,8 +8,8 @@ module Hyrax
|
|
8
8
|
# lists and add a Change List Index to point to all of them.
|
9
9
|
class ChangeListWriter
|
10
10
|
attr_reader :resource_host, :capability_list_url
|
11
|
-
MODIFIED_DATE_FIELD = 'system_modified_dtsi'
|
12
|
-
BEGINNING_OF_TIME = '1970-01-01T00:00:00Z'
|
11
|
+
MODIFIED_DATE_FIELD = 'system_modified_dtsi'
|
12
|
+
BEGINNING_OF_TIME = '1970-01-01T00:00:00Z'
|
13
13
|
|
14
14
|
def initialize(resource_host:, capability_list_url:)
|
15
15
|
@resource_host = resource_host
|
data/lib/hyrax/version.rb
CHANGED
@@ -275,7 +275,7 @@ RSpec.describe Hyrax::Actors::FileSetActor do
|
|
275
275
|
actor.attach_to_work(work)
|
276
276
|
expect(work.representative).to eq(file_set)
|
277
277
|
expect(work.thumbnail).to eq(file_set)
|
278
|
-
expect { work.reload }.not_to change { [work.representative, work.thumbnail] }
|
278
|
+
expect { work.reload }.not_to change { [work.representative.id, work.thumbnail.id] }
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
@@ -21,10 +21,40 @@ RSpec.describe Hyrax::Admin::StatsController, type: :controller do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'allows an authorized user to view the page' do
|
24
|
-
expect(Hyrax::AdminStatsPresenter).to receive(:new).with(expected_params, 5).and_call_original
|
25
24
|
get :show
|
25
|
+
|
26
26
|
expect(response).to be_success
|
27
27
|
expect(assigns[:presenter]).to be_kind_of Hyrax::AdminStatsPresenter
|
28
|
+
expect(assigns[:presenter])
|
29
|
+
.to have_attributes(limit: 5, stats_filters: {})
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'with a custom presenter' do
|
33
|
+
let(:presenter_class) { Class.new(Hyrax::AdminStatsPresenter) }
|
34
|
+
|
35
|
+
before { described_class.admin_stats_presenter = presenter_class }
|
36
|
+
|
37
|
+
it 'allows an authorized user to view the page' do
|
38
|
+
get :show
|
39
|
+
|
40
|
+
expect(assigns[:presenter]).to be_kind_of presenter_class
|
41
|
+
expect(assigns[:presenter])
|
42
|
+
.to have_attributes(limit: 5, stats_filters: {})
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with custom stats services' do
|
47
|
+
let(:by_depositor_class) { Class.new(Hyrax::Statistics::Works::ByDepositor) }
|
48
|
+
let(:service_config) { { by_depositor: by_depositor_class } }
|
49
|
+
|
50
|
+
before { described_class.admin_stats_services = service_config }
|
51
|
+
|
52
|
+
it 'allows an authorized user to view the page' do
|
53
|
+
get :show
|
54
|
+
|
55
|
+
expect(assigns[:presenter])
|
56
|
+
.to have_attributes(by_depositor: by_depositor_class)
|
57
|
+
end
|
28
58
|
end
|
29
59
|
end
|
30
60
|
end
|
@@ -83,7 +83,7 @@ RSpec.describe Hyrax::CollectionsController do
|
|
83
83
|
expect(controller).to receive(:add_breadcrumb).with('Home', Hyrax::Engine.routes.url_helpers.root_path(locale: 'en'))
|
84
84
|
expect(controller).to receive(:add_breadcrumb).with('Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
85
85
|
expect(controller).to receive(:add_breadcrumb).with('Collections', Hyrax::Engine.routes.url_helpers.my_collections_path(locale: 'en'))
|
86
|
-
expect(controller).to receive(:add_breadcrumb).with('My collection', collection_path(collection.id, locale: 'en'))
|
86
|
+
expect(controller).to receive(:add_breadcrumb).with('My collection', collection_path(collection.id, locale: 'en'), "aria-current" => "page")
|
87
87
|
get :show, params: { id: collection }
|
88
88
|
expect(response).to be_successful
|
89
89
|
end
|
@@ -117,7 +117,7 @@ RSpec.describe Hyrax::CollectionsController do
|
|
117
117
|
it "sets breadcrumbs" do
|
118
118
|
expect(controller).not_to receive(:add_breadcrumb).with(I18n.t('hyrax.dashboard.title'), Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
119
119
|
expect(controller).not_to receive(:add_breadcrumb).with('Your Collections', Hyrax::Engine.routes.url_helpers.my_collections_path(locale: 'en'))
|
120
|
-
expect(controller).to receive(:add_breadcrumb).with('My collection', collection_path(collection.id, locale: 'en'))
|
120
|
+
expect(controller).to receive(:add_breadcrumb).with('My collection', collection_path(collection.id, locale: 'en'), "aria-current" => "page")
|
121
121
|
get :show, params: { id: collection }
|
122
122
|
expect(response).to be_successful
|
123
123
|
end
|
@@ -359,7 +359,7 @@ RSpec.describe Hyrax::Dashboard::CollectionsController, :clean_repo do
|
|
359
359
|
expect(controller).to receive(:add_breadcrumb).with('Home', Hyrax::Engine.routes.url_helpers.root_path(locale: 'en'))
|
360
360
|
expect(controller).to receive(:add_breadcrumb).with('Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
361
361
|
expect(controller).to receive(:add_breadcrumb).with('Collections', Hyrax::Engine.routes.url_helpers.my_collections_path(locale: 'en'))
|
362
|
-
expect(controller).to receive(:add_breadcrumb).with('My collection', collection_path(collection.id, locale: 'en'))
|
362
|
+
expect(controller).to receive(:add_breadcrumb).with('My collection', collection_path(collection.id, locale: 'en'), "aria-current" => "page")
|
363
363
|
get :show, params: { id: collection }
|
364
364
|
expect(response).to be_successful
|
365
365
|
end
|
@@ -457,7 +457,7 @@ RSpec.describe Hyrax::Dashboard::CollectionsController, :clean_repo do
|
|
457
457
|
expect(controller).to receive(:add_breadcrumb).with('Home', Hyrax::Engine.routes.url_helpers.root_path(locale: 'en'))
|
458
458
|
expect(controller).to receive(:add_breadcrumb).with('Dashboard', Hyrax::Engine.routes.url_helpers.dashboard_path(locale: 'en'))
|
459
459
|
expect(controller).to receive(:add_breadcrumb).with('Collections', Hyrax::Engine.routes.url_helpers.my_collections_path(locale: 'en'))
|
460
|
-
expect(controller).to receive(:add_breadcrumb).with(I18n.t("hyrax.collection.browse_view"), collection_path(collection.id, locale: 'en'))
|
460
|
+
expect(controller).to receive(:add_breadcrumb).with(I18n.t("hyrax.collection.browse_view"), collection_path(collection.id, locale: 'en'), "aria-current" => "page")
|
461
461
|
get :edit, params: { id: collection }
|
462
462
|
expect(response).to be_successful
|
463
463
|
end
|
@@ -199,9 +199,10 @@ RSpec.describe Hyrax::GenericWorksController do
|
|
199
199
|
end
|
200
200
|
let(:work) { instance_double(GenericWork, id: '99999', to_global_id: '99999') }
|
201
201
|
|
202
|
-
context 'with a user lacking workflow permission' do
|
202
|
+
context 'with a user lacking both workflow permission and read access' do
|
203
203
|
before do
|
204
204
|
allow(SolrDocument).to receive(:find).and_return(document)
|
205
|
+
allow(controller.current_ability).to receive(:can?).with(:read, document).and_return(false)
|
205
206
|
end
|
206
207
|
let(:document_list) { [] }
|
207
208
|
let(:document) { instance_double(SolrDocument, suppressed?: true) }
|
@@ -209,8 +210,23 @@ RSpec.describe Hyrax::GenericWorksController do
|
|
209
210
|
it 'shows the unauthorized message' do
|
210
211
|
get :show, params: { id: work.id }
|
211
212
|
expect(response.code).to eq '401'
|
212
|
-
expect(response).to render_template(:
|
213
|
-
|
213
|
+
expect(response).to render_template(:unauthorized)
|
214
|
+
end
|
215
|
+
|
216
|
+
context 'with a user who lacks workflow permission but has read access' do
|
217
|
+
before do
|
218
|
+
allow(SolrDocument).to receive(:find).and_return(document)
|
219
|
+
allow(controller.current_ability).to receive(:can?).with(:read, document).and_return(true)
|
220
|
+
end
|
221
|
+
let(:document_list) { [] }
|
222
|
+
let(:document) { instance_double(SolrDocument, suppressed?: true) }
|
223
|
+
|
224
|
+
it 'shows the unavailable message' do
|
225
|
+
get :show, params: { id: work.id }
|
226
|
+
expect(response.code).to eq '401'
|
227
|
+
expect(response).to render_template(:unavailable)
|
228
|
+
expect(flash[:notice]).to eq 'The work is not currently available because it has not yet completed the approval process'
|
229
|
+
end
|
214
230
|
end
|
215
231
|
end
|
216
232
|
|
@@ -70,7 +70,7 @@ RSpec.describe Hyrax::HomepageController, type: :controller do
|
|
70
70
|
get :index
|
71
71
|
expect(response).to be_success
|
72
72
|
expect(assigns(:recent_documents).length).to be <= 4
|
73
|
-
create_times = assigns(:recent_documents).map { |d| d['
|
73
|
+
create_times = assigns(:recent_documents).map { |d| d['date_uploaded_dtsi'] }
|
74
74
|
expect(create_times).to eq create_times.sort.reverse
|
75
75
|
end
|
76
76
|
end
|
@@ -21,6 +21,10 @@ RSpec.describe Hyrax::UsersController, type: :controller do
|
|
21
21
|
let!(:u1) { create(:user) }
|
22
22
|
let!(:u2) { create(:user) }
|
23
23
|
|
24
|
+
before do
|
25
|
+
allow(Flipflop).to receive(:hide_users_list?).and_return(false)
|
26
|
+
end
|
27
|
+
|
24
28
|
describe "requesting html" do
|
25
29
|
before do
|
26
30
|
# These user types are excluded:
|
@@ -90,4 +94,58 @@ RSpec.describe Hyrax::UsersController, type: :controller do
|
|
90
94
|
end
|
91
95
|
end
|
92
96
|
end
|
97
|
+
|
98
|
+
describe 'user list access' do
|
99
|
+
context 'with hide_users_list?=enabled' do
|
100
|
+
before do
|
101
|
+
allow(Flipflop).to receive(:hide_users_list?).and_return(true)
|
102
|
+
end
|
103
|
+
|
104
|
+
describe 'with registered user' do
|
105
|
+
it 'renders the user list' do
|
106
|
+
get :index
|
107
|
+
expect(response.code).to eq '200'
|
108
|
+
expect(response).to render_template(:index)
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'does return .json results' do
|
112
|
+
get :index, params: { format: :json }
|
113
|
+
expect(response).to be_successful
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe 'with unauthenticated user' do
|
118
|
+
before do
|
119
|
+
sign_out user
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'does not render the user list' do
|
123
|
+
get :index
|
124
|
+
expect(flash[:alert]).to eq 'You need to sign in or sign up before continuing.'
|
125
|
+
expect(response).to have_http_status(302)
|
126
|
+
expect(response).to redirect_to('/users/sign_in')
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'does not return .json results' do
|
130
|
+
get :index, params: { format: :json }
|
131
|
+
expect(response).not_to be_successful
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'with hide_users_list?=disabled' do
|
137
|
+
before do
|
138
|
+
sign_out user
|
139
|
+
allow(Flipflop).to receive(:hide_users_list?).and_return(false)
|
140
|
+
end
|
141
|
+
|
142
|
+
describe 'with unauthenticated user' do
|
143
|
+
it 'renders the user list' do
|
144
|
+
get :index
|
145
|
+
expect(response.code).to eq '200'
|
146
|
+
expect(response).to render_template(:index)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
93
151
|
end
|