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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 22ddfe8e8c1460fde698f49262a96de5ed83e1e6123dca1c9fdc202936b04e4e
|
4
|
+
data.tar.gz: 0e8ebfc5c1f48013d9c5513edee21abe45d019794f278cec0e2a42480e05075e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eb864d6b6bba16982ac67c2121324861b8a7b64ed17d64d8bf145554494509bf886aff95102f6d8b96893380723d81d740140e7dfbe2a6ba650cd09dd39ddfb
|
7
|
+
data.tar.gz: a8c02242bd7627bb2d04a694fe2405fe5927acd39d8c41939cae76043948d4b4d7caeec8f142d4c3d14b5969fcb8c10cd24644b8d77ab296585052b2e5a8c2a4
|
data/.github/ISSUE_TEMPLATE.md
CHANGED
data/.rubocop.yml
CHANGED
@@ -4,7 +4,7 @@ inherit_gem:
|
|
4
4
|
inherit_from: .rubocop_fixme.yml
|
5
5
|
|
6
6
|
AllCops:
|
7
|
-
TargetRubyVersion: 2.
|
7
|
+
TargetRubyVersion: 2.3
|
8
8
|
DisplayCopNames: true
|
9
9
|
Exclude:
|
10
10
|
- 'db/**/*'
|
@@ -47,6 +47,13 @@ Style/CollectionMethods:
|
|
47
47
|
detect: 'find'
|
48
48
|
find_all: 'select'
|
49
49
|
|
50
|
+
# disable frozen string literal comment. We can't safely introduce this
|
51
|
+
# system-wide until a major version because it freezes strings that downstream
|
52
|
+
# users might be mutating. Please use the frozen string literal pragma on new
|
53
|
+
# files
|
54
|
+
Style/FrozenStringLiteralComment:
|
55
|
+
Enabled: false
|
56
|
+
|
50
57
|
Style/MethodMissing:
|
51
58
|
Exclude:
|
52
59
|
- 'app/models/concerns/hyrax/file_set/characterization.rb'
|
data/README.md
CHANGED
@@ -4,7 +4,6 @@ Code: [![Version](https://badge.fury.io/rb/hyrax.png)](http://badge.fury.io/rb/h
|
|
4
4
|
[![Build Status](https://travis-ci.org/samvera/hyrax.png?branch=master)](https://travis-ci.org/samvera/hyrax)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/github/samvera/hyrax/badge.svg?branch=master)](https://coveralls.io/github/samvera/hyrax?branch=master)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/samvera/hyrax/badges/gpa.svg)](https://codeclimate.com/github/samvera/hyrax)
|
7
|
-
[![Dependency Update Status](https://gemnasium.com/samvera/hyrax.png)](https://gemnasium.com/samvera/hyrax)
|
8
7
|
[![Dependency Maintenance Status](https://dependencyci.com/github/samvera/hyrax/badge)](https://dependencyci.com/github/samvera/hyrax)
|
9
8
|
|
10
9
|
Docs: [![Documentation Status](https://inch-ci.org/github/samvera/hyrax.svg?branch=master)](https://inch-ci.org/github/samvera/hyrax)
|
@@ -63,7 +62,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
|
|
63
62
|
# Getting started
|
64
63
|
|
65
64
|
This document contains instructions specific to setting up an app with __Hyrax
|
66
|
-
v2.
|
65
|
+
v2.2.0__. If you are looking for instructions on installing a different
|
67
66
|
version, be sure to select the appropriate branch or tag from the drop-down
|
68
67
|
menu above.
|
69
68
|
|
@@ -132,7 +131,7 @@ Note here that the following commands assume you're setting up Hyrax in a develo
|
|
132
131
|
|
133
132
|
First, you'll need a working Ruby installation. You can install this via your operating system's package manager -- you are likely to get farther with OSX, Linux, or UNIX than Windows but your mileage may vary -- but we recommend using a Ruby version manager such as [RVM](https://rvm.io/) or [rbenv](https://github.com/sstephenson/rbenv).
|
134
133
|
|
135
|
-
|
134
|
+
Hyrax supports Ruby 2.3, 2.4 and 2.5. When starting a new project, we recommend using the latest Ruby 2.5 version.
|
136
135
|
|
137
136
|
## Redis
|
138
137
|
|
@@ -162,7 +161,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
|
|
162
161
|
Generate a new Rails application using the template.
|
163
162
|
|
164
163
|
```
|
165
|
-
rails _5.1.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.
|
164
|
+
rails _5.1.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.2.0/template.rb
|
166
165
|
```
|
167
166
|
|
168
167
|
Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
|
@@ -188,13 +187,6 @@ Notes:
|
|
188
187
|
* This web server is purely for development purposes. You will want to use a more fully featured [web server](#web-server) for production-like environments.
|
189
188
|
* You have the option to start each of these services individually. More information on [solr_wrapper](https://github.com/cbeer/solr_wrapper) and [fcrepo_wrapper](https://github.com/cbeer/fcrepo_wrapper) will help you set this up. Start rails with `rails s`.
|
190
189
|
|
191
|
-
### Avoid Performance Issues with solr-suggest
|
192
|
-
|
193
|
-
*Recommended for all Hyrax apps.*
|
194
|
-
|
195
|
-
It is strongly suggested that you turn off solr-suggest. Details on why and how to do this are in
|
196
|
-
[Fix performance issue caused by solr-suggest](https://github.com/samvera/hyrax/wiki/Troubleshooting-Migration-from-2.0.x-to-2.1.0#fix-performance-issue-caused-by-solr-suggest-after-200-objects-are-in-the-repository).
|
197
|
-
|
198
190
|
## Start background workers
|
199
191
|
|
200
192
|
Many of the services performed by Hyrax are resource intensive, and therefore are well suited to running as background jobs that can be managed and executed by a message queuing system. Examples include:
|
@@ -54,7 +54,7 @@ module Hyrax
|
|
54
54
|
# @param [Hash] file_set_params specifying the visibility, lease and/or embargo of the file set.
|
55
55
|
# Without visibility, embargo_release_date or lease_expiration_date, visibility will be copied from the parent.
|
56
56
|
def create_metadata(file_set_params = {})
|
57
|
-
file_set.
|
57
|
+
file_set.depositor = depositor_id(user)
|
58
58
|
now = TimeService.time_in_utc
|
59
59
|
file_set.date_uploaded = now
|
60
60
|
file_set.date_modified = now
|
@@ -144,6 +144,11 @@ module Hyrax
|
|
144
144
|
!((file_set_params || {}).keys.map(&:to_s) & %w[visibility embargo_release_date lease_expiration_date]).empty?
|
145
145
|
end
|
146
146
|
|
147
|
+
# replaces file_set.apply_depositor_metadata(user)from hydra-access-controls so depositor doesn't automatically get edit access
|
148
|
+
def depositor_id(depositor)
|
149
|
+
depositor.respond_to?(:user_key) ? depositor.user_key : depositor
|
150
|
+
end
|
151
|
+
|
147
152
|
# Must clear the fileset from the thumbnail_id, representative_id and rendering_ids fields on the work
|
148
153
|
# and force it to be re-solrized.
|
149
154
|
# Although ActiveFedora clears the children nodes it leaves those fields in Solr populated.
|
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
//= require clipboard
|
33
33
|
|
34
|
-
//
|
34
|
+
// This is required for Jasmine tests, specifically to polyfill the Symbol() function
|
35
35
|
//= require babel/polyfill
|
36
36
|
// CustomElements polyfill is a dependency of time-elements
|
37
37
|
//= require webcomponentsjs/0.5.4/CustomElements.min
|
@@ -25,8 +25,16 @@ export default class {
|
|
25
25
|
this.saveWorkControl()
|
26
26
|
this.saveWorkFixed()
|
27
27
|
this.authoritySelect()
|
28
|
+
this.formInProgress()
|
28
29
|
}
|
29
30
|
|
31
|
+
// Immediate feedback after work creation, editing.
|
32
|
+
formInProgress() {
|
33
|
+
$('[data-behavior~=work-form]').on('submit', function(event){
|
34
|
+
$('.panel-footer').toggleClass('hidden');
|
35
|
+
});
|
36
|
+
}
|
37
|
+
|
30
38
|
// Used when you have a linked data field that can have terms from multiple
|
31
39
|
// authorities.
|
32
40
|
authoritySelect() {
|
@@ -92,6 +92,20 @@ export default class SaveWorkControl {
|
|
92
92
|
this.preventSubmit()
|
93
93
|
this.watchMultivaluedFields()
|
94
94
|
this.formChanged()
|
95
|
+
this.addFileUploadEventListeners();
|
96
|
+
}
|
97
|
+
|
98
|
+
addFileUploadEventListeners() {
|
99
|
+
let $uploadsEl = this.uploads.element;
|
100
|
+
const $cancelBtn = this.uploads.form.find('#file-upload-cancel-btn');
|
101
|
+
|
102
|
+
$uploadsEl.bind('fileuploadstart', () => {
|
103
|
+
$cancelBtn.removeClass('hidden');
|
104
|
+
});
|
105
|
+
|
106
|
+
$uploadsEl.bind('fileuploadstop', () => {
|
107
|
+
$cancelBtn.addClass('hidden');
|
108
|
+
});
|
95
109
|
}
|
96
110
|
|
97
111
|
preventSubmit() {
|
@@ -108,7 +122,7 @@ export default class SaveWorkControl {
|
|
108
122
|
|
109
123
|
// Called when a file has been uploaded, the deposit agreement is clicked or a form field has had text entered.
|
110
124
|
formStateChanged() {
|
111
|
-
this.saveButton.prop("disabled", !this.
|
125
|
+
this.saveButton.prop("disabled", !this.isSaveButtonEnabled);
|
112
126
|
}
|
113
127
|
|
114
128
|
// called when a new field has been added to the form.
|
@@ -117,6 +131,11 @@ export default class SaveWorkControl {
|
|
117
131
|
this.formStateChanged();
|
118
132
|
}
|
119
133
|
|
134
|
+
// Indicates whether the "Save" button should be enabled: a valid form and no uploads in progress
|
135
|
+
get isSaveButtonEnabled() {
|
136
|
+
return this.isValid() && !this.uploads.inProgress;
|
137
|
+
}
|
138
|
+
|
120
139
|
isValid() {
|
121
140
|
// avoid short circuit evaluation. The checkboxes should be independent.
|
122
141
|
let metadataValid = this.validateMetadata()
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.breadcrumb {
|
2
|
+
border: 1px solid $admin-panel-border-color;
|
3
|
+
border-radius: 3px;
|
4
|
+
margin-top: 0.5em;
|
5
|
+
padding: 0.8em 1em;
|
6
|
+
|
7
|
+
ol {
|
8
|
+
list-style: none;
|
9
|
+
margin: 0;
|
10
|
+
padding-left: 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
li {
|
14
|
+
display: inline;
|
15
|
+
|
16
|
+
+::before {
|
17
|
+
border-right: 0.1em solid #ccc;
|
18
|
+
content: '';
|
19
|
+
display: inline-block;
|
20
|
+
height: 0.8em;
|
21
|
+
margin: 0 0.5em;
|
22
|
+
transform: rotate(15deg);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -154,12 +154,18 @@ button.branding-banner-remove:hover {
|
|
154
154
|
td {
|
155
155
|
text-align: center;
|
156
156
|
vertical-align: top;
|
157
|
+
padding: 8px 2px;
|
157
158
|
|
159
|
+
&:nth-child(1),
|
158
160
|
&:nth-child(2) {
|
159
161
|
text-align: left;
|
160
162
|
}
|
161
163
|
}
|
162
164
|
|
165
|
+
.check-all-checkbox {
|
166
|
+
margin-right: 5px !important;
|
167
|
+
}
|
168
|
+
|
163
169
|
.modal {
|
164
170
|
text-align: left;
|
165
171
|
}
|
@@ -20,3 +20,17 @@
|
|
20
20
|
}
|
21
21
|
|
22
22
|
.files .name span { word-break: break-all; }
|
23
|
+
|
24
|
+
.add-batch-work-file-wrapper {
|
25
|
+
.add-batch-work-file-row {
|
26
|
+
padding-bottom: 10px;
|
27
|
+
}
|
28
|
+
|
29
|
+
.resource_type_dropdown {
|
30
|
+
margin-bottom: 10px;
|
31
|
+
}
|
32
|
+
|
33
|
+
.padding-bottom {
|
34
|
+
padding-bottom: 10px;
|
35
|
+
}
|
36
|
+
}
|
@@ -9,7 +9,7 @@
|
|
9
9
|
'hyrax/fixedsticky', 'hyrax/file_upload', 'hyrax/representative-media',
|
10
10
|
'hyrax/footer', 'hyrax/select_work_type', 'hyrax/users', 'hyrax/dashboard',
|
11
11
|
'hyrax/sidebar', 'hyrax/controlled_vocabulary', 'hyrax/accessibility',
|
12
|
-
'hyrax/recent', 'hyrax/viewer';
|
12
|
+
'hyrax/recent', 'hyrax/viewer', 'hyrax/breadcrumbs';
|
13
13
|
@import 'typeahead';
|
14
14
|
@import 'sharing_buttons';
|
15
15
|
|
@@ -29,6 +29,10 @@ $admin-panel-border-color: #dedede !default;
|
|
29
29
|
.media-body {
|
30
30
|
width: 18vw;
|
31
31
|
}
|
32
|
+
|
33
|
+
.works-list-batch-checkbox-label-text {
|
34
|
+
margin: 0 5px;
|
35
|
+
}
|
32
36
|
}
|
33
37
|
|
34
38
|
body.dashboard {
|
@@ -41,11 +45,6 @@ body.dashboard {
|
|
41
45
|
}
|
42
46
|
|
43
47
|
.dashboard {
|
44
|
-
.breadcrumb {
|
45
|
-
border: 1px solid $admin-panel-border-color;
|
46
|
-
margin-top: 0.5em;
|
47
|
-
}
|
48
|
-
|
49
48
|
.count-display {
|
50
49
|
font-size: 1.1em;
|
51
50
|
}
|
@@ -11,16 +11,22 @@ class Hyrax::BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Buil
|
|
11
11
|
def render
|
12
12
|
return "" if @elements.blank?
|
13
13
|
|
14
|
-
@context.content_tag(:
|
15
|
-
|
14
|
+
@context.content_tag(:nav, breadcrumbs_options) do
|
15
|
+
@context.content_tag(:ol) do
|
16
|
+
safe_join(@elements.uniq.collect { |e| render_element(e) })
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
19
21
|
def render_element(element)
|
20
|
-
html_class = 'active' if @context.current_page?(compute_path(element))
|
22
|
+
html_class = 'active' if @context.current_page?(compute_path(element)) || element.options["aria-current"] == "page"
|
21
23
|
|
22
24
|
@context.content_tag(:li, class: html_class) do
|
23
|
-
@context.
|
25
|
+
@context.link_to_unless(html_class == 'active', @context.truncate(compute_name(element), length: 30, separator: ' '), compute_path(element), element.options)
|
24
26
|
end
|
25
27
|
end
|
28
|
+
|
29
|
+
def breadcrumbs_options
|
30
|
+
{ class: 'breadcrumb', role: "region", "aria-label" => "Breadcrumb" }
|
31
|
+
end
|
26
32
|
end
|
@@ -1,20 +1,44 @@
|
|
1
1
|
module Hyrax
|
2
2
|
module Admin
|
3
|
+
##
|
4
|
+
# @example using a custom presenter and stats services
|
5
|
+
# class MyStatsController < ApplicationController
|
6
|
+
# include Hyrax::Admin::StatsBehavior
|
7
|
+
#
|
8
|
+
# self.admin_stats_presenter = MyCustomStatsPresenter
|
9
|
+
# self.admin_stats_services = { by_depositor: CustomDepositorService,
|
10
|
+
# depositor_summary: CustomSummaryService }
|
11
|
+
# # see AdminStatsPresenter#initialize for supported services
|
12
|
+
# end
|
13
|
+
#
|
3
14
|
module StatsBehavior
|
4
15
|
extend ActiveSupport::Concern
|
5
16
|
included do
|
6
17
|
with_themed_layout 'dashboard'
|
18
|
+
|
19
|
+
class_attribute :admin_stats_presenter, :admin_stats_services
|
20
|
+
self.admin_stats_presenter = AdminStatsPresenter
|
21
|
+
self.admin_stats_services = {}
|
7
22
|
end
|
8
23
|
|
9
24
|
def show
|
10
25
|
authorize! :read, Hyrax::Statistics
|
11
26
|
stats_filters = params.fetch(:stats_filters, {})
|
12
27
|
limit = params.fetch(:limit, "5").to_i
|
13
|
-
@presenter =
|
28
|
+
@presenter = build_presenter(stats_filters, limit)
|
14
29
|
add_breadcrumb t(:'hyrax.controls.home'), root_path
|
15
30
|
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
|
16
31
|
add_breadcrumb t(:'hyrax.admin.sidebar.statistics'), hyrax.admin_stats_path
|
17
32
|
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def build_presenter(stats_filters, limit)
|
37
|
+
presenter_class = self.class.admin_stats_presenter
|
38
|
+
services_opts = self.class.admin_stats_services
|
39
|
+
|
40
|
+
presenter_class.new(stats_filters, limit, **services_opts)
|
41
|
+
end
|
18
42
|
end
|
19
43
|
end
|
20
44
|
end
|
@@ -14,10 +14,14 @@ module Hyrax
|
|
14
14
|
def add_breadcrumb_for_action
|
15
15
|
case action_name
|
16
16
|
when 'edit'.freeze
|
17
|
-
add_breadcrumb I18n.t("hyrax.collection.browse_view"), collection_path(params["id"])
|
17
|
+
add_breadcrumb I18n.t("hyrax.collection.browse_view"), collection_path(params["id"]), mark_active_action
|
18
18
|
when 'show'.freeze
|
19
|
-
add_breadcrumb presenter.to_s, polymorphic_path(presenter)
|
19
|
+
add_breadcrumb presenter.to_s, polymorphic_path(presenter), mark_active_action
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
def mark_active_action
|
24
|
+
{ "aria-current" => "page" }
|
25
|
+
end
|
22
26
|
end
|
23
27
|
end
|
@@ -52,7 +52,7 @@ module Hyrax::Controller
|
|
52
52
|
# For the JSON message, we don't want to display the default CanCan messages,
|
53
53
|
# just custom Hydra messages such as "This item is under embargo.", etc.
|
54
54
|
json_message = exception.message if exception.is_a? Hydra::AccessDenied
|
55
|
-
if current_user
|
55
|
+
if current_user&.persisted?
|
56
56
|
deny_access_for_current_user(exception, json_message)
|
57
57
|
else
|
58
58
|
deny_access_for_anonymous_user(exception, json_message)
|
@@ -2,7 +2,7 @@ module Hyrax
|
|
2
2
|
module DenyAccessOverrideBehavior
|
3
3
|
# Overriding the default behavior from Hydra::Core::ControllerBehavior
|
4
4
|
def deny_access(exception)
|
5
|
-
if current_user
|
5
|
+
if current_user&.persisted?
|
6
6
|
redirect_to root_path, alert: exception.message
|
7
7
|
else
|
8
8
|
session['user_return_to'.freeze] = request.url
|