hyrax 2.1.0.beta2 → 2.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODE_OF_CONDUCT.md +5 -5
- data/.github/CONTRIBUTING.md +2 -2
- data/.rubocop.yml +1 -0
- data/.rubocop_fixme.yml +2 -0
- data/Gemfile +1 -0
- data/README.md +3 -2
- data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -0
- data/app/actors/hyrax/actors/create_with_remote_files_actor.rb +4 -3
- data/app/actors/hyrax/actors/default_admin_set_actor.rb +9 -6
- data/app/assets/javascripts/hyrax.js +3 -0
- data/app/assets/javascripts/hyrax/app.js.erb +14 -0
- data/app/assets/javascripts/hyrax/batch_edit.js +2 -1
- data/app/assets/javascripts/hyrax/collection_types.es6 +97 -36
- data/app/assets/javascripts/hyrax/collections.js +15 -49
- data/app/assets/javascripts/hyrax/collections_utils.es6 +116 -0
- data/app/assets/javascripts/hyrax/collections_v2.es6 +57 -0
- data/app/assets/javascripts/hyrax/content_blocks.js +1 -13
- data/app/assets/javascripts/hyrax/nav_safety.js +41 -0
- data/app/assets/javascripts/hyrax/turbolinks_events.js +3 -0
- data/app/assets/stylesheets/hyrax/_collection_types.scss +46 -2
- data/app/assets/stylesheets/hyrax/_work-show.scss +6 -9
- data/app/assets/stylesheets/hyrax/dashboard.scss +2 -0
- data/app/assets/stylesheets/hyrax/sidebar.scss +4 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +10 -2
- data/app/controllers/hyrax/admin/admin_sets_controller.rb +2 -9
- data/app/controllers/hyrax/admin/collection_types_controller.rb +1 -1
- data/app/controllers/hyrax/batch_edits_controller.rb +30 -4
- data/app/controllers/hyrax/dashboard/collection_members_controller.rb +1 -0
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -1
- data/app/controllers/hyrax/downloads_controller.rb +7 -1
- data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -1
- data/app/indexers/hyrax/repository_reindexer.rb +1 -1
- data/app/jobs/attach_files_to_work_job.rb +8 -4
- data/app/jobs/import_url_job.rb +11 -5
- data/app/models/admin_set.rb +25 -3
- data/app/models/concerns/hyrax/collection_behavior.rb +23 -11
- data/app/models/concerns/hyrax/collection_nesting.rb +22 -3
- data/app/models/hyrax/permission_template_access.rb +7 -4
- data/app/presenters/hyrax/admin_set_presenter.rb +21 -0
- data/app/presenters/hyrax/collection_presenter.rb +23 -1
- data/app/presenters/hyrax/dashboard/user_presenter.rb +4 -0
- data/app/presenters/hyrax/presents_attributes.rb +6 -2
- data/app/presenters/hyrax/work_show_presenter.rb +4 -0
- data/app/renderers/hyrax/renderers/attribute_renderer.rb +14 -0
- data/app/services/hyrax/adapters/nesting_index_adapter.rb +19 -39
- data/app/services/hyrax/admin_set_create_service.rb +1 -1
- data/app/services/hyrax/collection_types/create_service.rb +4 -0
- data/app/services/hyrax/collections/migration_service.rb +25 -2
- data/app/services/hyrax/collections/nested_collection_persistence_service.rb +8 -3
- data/app/services/hyrax/collections/nested_collection_query_service.rb +3 -3
- data/app/services/hyrax/default_middleware_stack.rb +3 -3
- data/app/services/hyrax/multiple_membership_checker.rb +4 -2
- data/app/views/catalog/_index_header_list_collection.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +0 -4
- data/app/views/hyrax/admin/admin_sets/_show_actions.html.erb +27 -0
- data/app/views/hyrax/admin/admin_sets/show.html.erb +1 -25
- data/app/views/hyrax/admin/collection_types/_form.html.erb +17 -6
- data/app/views/hyrax/admin/collection_types/_form_appearance.html.erb +5 -0
- data/app/views/hyrax/admin/collection_types/_form_participant_table.html.erb +1 -1
- data/app/views/hyrax/admin/collection_types/_form_participants.html.erb +56 -52
- data/app/views/hyrax/admin/collection_types/edit.html.erb +9 -7
- data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
- data/app/views/hyrax/base/_attribute_rows.html.erb +15 -14
- data/app/views/hyrax/base/_form.html.erb +1 -0
- data/app/views/hyrax/base/_form_collections_error.html.erb +1 -0
- data/app/views/hyrax/base/_items.html.erb +3 -2
- data/app/views/hyrax/base/_metadata.html.erb +5 -7
- data/app/views/hyrax/base/_relationships.html.erb +3 -5
- data/app/views/hyrax/base/_relationships_parent_row.html.erb +4 -5
- data/app/views/hyrax/base/_relationships_parent_rows.html.erb +2 -1
- data/app/views/hyrax/base/_show_actions.html.erb +11 -1
- data/app/views/hyrax/batch_edits/edit.html.erb +57 -17
- data/app/views/hyrax/collections/_list_collections.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +1 -1
- data/app/views/hyrax/content_blocks/_form.html.erb +8 -7
- data/app/views/hyrax/dashboard/_index_partials/_current_proxy_rights.html.erb +17 -0
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -3
- data/app/views/hyrax/dashboard/collections/_default_group.html.erb +30 -0
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +13 -2
- data/app/views/hyrax/dashboard/show_user.html.erb +10 -9
- data/app/views/hyrax/my/collections/_list_collections.html.erb +10 -3
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_delete_collections_deny.html.erb +14 -0
- data/app/views/hyrax/my/collections/index.html.erb +1 -0
- data/app/views/shared/_nav_safety_modal.html.erb +12 -0
- data/config/features.rb +4 -0
- data/config/initializers/samvera-nesting_indexer_initializer.rb +1 -0
- data/config/locales/hyrax.de.yml +26 -11
- data/config/locales/hyrax.en.yml +21 -6
- data/config/locales/hyrax.es.yml +17 -2
- data/config/locales/hyrax.fr.yml +17 -2
- data/config/locales/hyrax.it.yml +17 -2
- data/config/locales/hyrax.pt-BR.yml +17 -2
- data/config/locales/hyrax.zh.yml +17 -2
- data/config/locales/simple_form.en.yml +6 -27
- data/hyrax.gemspec +2 -2
- data/lib/generators/hyrax/assets_generator.rb +4 -0
- data/lib/generators/hyrax/install_generator.rb +10 -0
- data/lib/generators/hyrax/templates/app/assets/images/unauthorized.png +0 -0
- data/lib/generators/hyrax/templates/config/locales/hyrax.en.yml +6 -5
- data/lib/generators/hyrax/templates/config/tinymce.yml +12 -7
- data/lib/generators/hyrax/templates/db/migrate/20180406202557_add_badge_color_to_collection_types.rb.erb +5 -0
- data/lib/hyrax/configuration.rb +1 -1
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/collections_membership_actor_spec.rb +24 -0
- data/spec/actors/hyrax/actors/create_with_remote_files_actor_spec.rb +19 -1
- data/spec/actors/hyrax/actors/default_admin_set_actor_spec.rb +41 -8
- data/spec/actors/hyrax/actors/file_set_actor_spec.rb +4 -12
- data/spec/actors/hyrax/actors/generic_work_actor_spec.rb +3 -7
- data/spec/controllers/hyrax/admin/strategies_controller_spec.rb +13 -2
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +83 -8
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +3 -0
- data/spec/controllers/hyrax/downloads_controller_spec.rb +26 -5
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +3 -6
- data/spec/controllers/hyrax/generic_works_controller_json_spec.rb +4 -4
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +3 -23
- data/spec/controllers/hyrax/transfers_controller_spec.rb +1 -1
- data/spec/factories/admin_sets_lw.rb +215 -0
- data/spec/factories/collections.rb +10 -10
- data/spec/factory_tests/adminsets_factory_spec.rb +132 -0
- data/spec/factory_tests/collections_factory_spec.rb +3 -3
- data/spec/features/batch_create_spec.rb +5 -8
- data/spec/features/batch_edit_spec.rb +49 -2
- data/spec/features/collection_multi_membership_spec.rb +29 -14
- data/spec/features/collection_type_spec.rb +9 -2
- data/spec/features/create_work_admin_spec.rb +1 -1
- data/spec/features/create_work_spec.rb +1 -1
- data/spec/features/dashboard/collection_spec.rb +16 -12
- data/spec/features/edit_content_block_admin_spec.rb +29 -12
- data/spec/features/embargo_spec.rb +55 -0
- data/spec/features/proxy_spec.rb +3 -1
- data/spec/features/work_show_spec.rb +20 -4
- data/spec/forms/hyrax/forms/admin/collection_type_form_spec.rb +1 -0
- data/spec/indexers/hyrax/repository_reindexer_spec.rb +1 -1
- data/spec/jobs/attach_files_to_work_job_spec.rb +15 -3
- data/spec/jobs/batch_create_job_spec.rb +6 -6
- data/spec/jobs/create_work_job_spec.rb +1 -1
- data/spec/models/admin_set_spec.rb +10 -8
- data/spec/models/collection_spec.rb +1 -1
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +6 -3
- data/spec/models/flipflop_spec.rb +8 -0
- data/spec/models/hyrax/work_behavior_spec.rb +1 -1
- data/spec/presenters/hyrax/admin_set_presenter_spec.rb +70 -0
- data/spec/presenters/hyrax/collection_presenter_spec.rb +66 -0
- data/spec/renderers/hyrax/renderers/attribute_renderer_spec.rb +19 -0
- data/spec/services/hyrax/adapters/nesting_index_adapter_spec.rb +31 -21
- data/spec/services/hyrax/collection_types/create_service_spec.rb +7 -4
- data/spec/services/hyrax/collections/migration_service_spec.rb +204 -17
- data/spec/services/hyrax/collections/nested_collection_persistence_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/permissions_create_service_spec.rb +1 -1
- data/spec/services/hyrax/collections/permissions_service_spec.rb +4 -0
- data/spec/services/hyrax/default_middleware_stack_spec.rb +1 -1
- data/spec/services/hyrax/multiple_membership_checker_spec.rb +4 -4
- data/spec/services/hyrax/workflow/grant_edit_to_depositor_spec.rb +1 -1
- data/spec/services/hyrax/workflow/grant_read_to_depositor_spec.rb +1 -1
- data/spec/services/hyrax/workflow/revoke_edit_from_depositor_spec.rb +1 -1
- data/spec/spec_helper.rb +35 -2
- data/spec/support/features/batch_edit_actions.rb +1 -1
- data/spec/support/selectors.rb +15 -0
- data/spec/views/hyrax/admin/admin_sets/_show_actions.html.erb_spec.rb +66 -0
- data/spec/views/hyrax/admin/admin_sets/show.html.erb_spec.rb +5 -34
- data/spec/views/hyrax/admin/collection_types/_form.html.erb_spec.rb +3 -1
- data/spec/views/hyrax/admin/collection_types/_form_appearance.html.erb_spec.rb +22 -0
- data/spec/views/hyrax/admin/collection_types/_form_participants.html.erb_spec.rb +11 -3
- data/spec/views/hyrax/base/_items.html.erb_spec.rb +46 -0
- data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +4 -2
- data/spec/views/hyrax/dashboard/collections/_default_group.html.erb_spec.rb +43 -0
- data/spec/views/hyrax/dashboard/collections/_list_collections.html.erb_spec.rb +51 -0
- data/spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/dashboard/show_user_spec.rb +5 -2
- data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +2 -0
- data/template.rb +1 -1
- metadata +30 -13
- data/app/views/hyrax/content_blocks/_modal_content_block.html.erb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7758e362b3ead3c21f48bf9cf6763565ea0304fb
|
4
|
+
data.tar.gz: 3788d88af39d4ab5b81a17bb94bf90d39e2852fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c1e3c4e80619330f7e5dd1d624a38296618d2dc40e371485d70039e52068af1dbb9593cea59a5aac0a6951b392b82800426d530a13825523517637ce9cac7e7
|
7
|
+
data.tar.gz: 02d3518cccfd2c631cda0e27b1dfa200bbbec739c184d211da2d9ec215f663d19f13623009bd5bc96fef967152244729acb9def82aa67d320543d44c12907636
|
data/.github/CODE_OF_CONDUCT.md
CHANGED
@@ -22,15 +22,15 @@ mutual respect and reasoned argument.
|
|
22
22
|
Community members work together to promote a respectful and safe
|
23
23
|
community. In the event that someone’s conduct is causing offence or
|
24
24
|
distress, Samvera has a detailed
|
25
|
-
[Anti-Harassment Policy and Protocol](https://wiki.duraspace.org/display/
|
25
|
+
[Anti-Harassment Policy and Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
|
26
26
|
which can be applied to address the problem. The first step in dealing
|
27
27
|
with any serious misconduct is to contact a local meeting organizer,
|
28
28
|
the
|
29
|
-
[Samvera community helpers](https://wiki.duraspace.org/display/
|
30
|
-
([email](mailto:helpers@
|
29
|
+
[Samvera community helpers](https://wiki.duraspace.org/display/samvera/Samvera+Community+Helpers)
|
30
|
+
([email](mailto:helpers@samvera.org)), a community member you
|
31
31
|
trust, or the
|
32
|
-
[Samvera Steering Group](https://wiki.duraspace.org/display/
|
32
|
+
[Samvera Steering Group](https://wiki.duraspace.org/display/samvera/Samvera+Steering+Group+membership)
|
33
33
|
immediately; at Samvera events, these people can be identified by
|
34
34
|
distinctive name badges. The
|
35
|
-
[Policy and Protocol](https://wiki.duraspace.org/display/
|
35
|
+
[Policy and Protocol](https://wiki.duraspace.org/display/samvera/Anti-Harassment+Policy)
|
36
36
|
should be consulted for fuller details.
|
data/.github/CONTRIBUTING.md
CHANGED
@@ -18,7 +18,7 @@ All code contributors must have an Individual Contributor License Agreement
|
|
18
18
|
an institution, the institution must have a Corporate Contributor License
|
19
19
|
Agreement (cCLA) on file.
|
20
20
|
|
21
|
-
https://wiki.duraspace.org/display/
|
21
|
+
https://wiki.duraspace.org/display/samvera/Samvera+Community+Intellectual+Property+Licensing+and+Ownership
|
22
22
|
|
23
23
|
You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
|
24
24
|
|
@@ -164,6 +164,6 @@ If you are uncertain, bring other contributors into the conversation by assignin
|
|
164
164
|
# Additional Resources
|
165
165
|
|
166
166
|
* [General GitHub documentation](http://help.github.com/)
|
167
|
-
* [GitHub pull request documentation](
|
167
|
+
* [GitHub pull request documentation](https://help.github.com/articles/about-pull-requests/)
|
168
168
|
* [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
|
169
169
|
* [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
|
data/.rubocop.yml
CHANGED
@@ -24,6 +24,7 @@ Metrics/BlockLength:
|
|
24
24
|
- 'app/models/concerns/hyrax/content_block_behavior.rb'
|
25
25
|
- 'app/services/hyrax/workflow/workflow_schema.rb'
|
26
26
|
- 'config/initializers/simple_form.rb'
|
27
|
+
- 'config/features.rb'
|
27
28
|
- 'config/routes.rb'
|
28
29
|
- 'lib/generators/hyrax/templates/catalog_controller.rb'
|
29
30
|
- 'lib/generators/hyrax/templates/config/initializers/simple_form_bootstrap.rb'
|
data/.rubocop_fixme.yml
CHANGED
@@ -6,6 +6,7 @@ Metrics/ClassLength:
|
|
6
6
|
Exclude:
|
7
7
|
- 'app/controllers/hyrax/dashboard/collections_controller.rb'
|
8
8
|
- 'app/controllers/hyrax/admin/admin_sets_controller.rb'
|
9
|
+
- 'app/controllers/hyrax/batch_edits_controller.rb'
|
9
10
|
- 'app/controllers/hyrax/downloads_controller.rb'
|
10
11
|
- 'app/controllers/hyrax/file_sets_controller.rb'
|
11
12
|
- 'app/forms/hyrax/forms/permission_template_form.rb'
|
@@ -83,6 +84,7 @@ RSpec/ExampleLength:
|
|
83
84
|
- 'spec/actors/hyrax/actors/file_set_actor_spec.rb'
|
84
85
|
- 'spec/actors/hyrax/actors/generic_work_actor_spec.rb'
|
85
86
|
- 'spec/controllers/hyrax/api/items_controller_spec.rb'
|
87
|
+
- 'spec/controllers/hyrax/batch_edits_controller_spec.rb'
|
86
88
|
- 'spec/controllers/hyrax/batch_uploads_controller_spec.rb'
|
87
89
|
- 'spec/controllers/hyrax/file_sets_controller_spec.rb'
|
88
90
|
- 'spec/controllers/hyrax/generic_works_controller_spec.rb'
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -63,7 +63,7 @@ The Samvera community is here to help. Please see our [support guide](./.github/
|
|
63
63
|
# Getting started
|
64
64
|
|
65
65
|
This document contains instructions specific to setting up an app with __Hyrax
|
66
|
-
v2.1.0.
|
66
|
+
v2.1.0.rc1__. If you are looking for instructions on installing a different
|
67
67
|
version, be sure to select the appropriate branch or tag from the drop-down
|
68
68
|
menu above.
|
69
69
|
|
@@ -162,7 +162,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
|
|
162
162
|
Generate a new Rails application using the template.
|
163
163
|
|
164
164
|
```
|
165
|
-
rails _5.0.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.1.0.
|
165
|
+
rails _5.0.6_ new my_app -m https://raw.githubusercontent.com/samvera/hyrax/v2.1.0.rc1/template.rb
|
166
166
|
```
|
167
167
|
|
168
168
|
Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
|
@@ -172,6 +172,7 @@ Generating a new Rails application using Hyrax's template above takes cares of a
|
|
172
172
|
* Running Hyrax's install generator, to add a number of files that Hyrax requires within your Rails app, including e.g. database migrations
|
173
173
|
* Loading all of Hyrax's database migrations into your application's database
|
174
174
|
* Loading Hyrax's default workflows into your application's database
|
175
|
+
* Create default collection types (e.g. Admin Set, User Collection)
|
175
176
|
|
176
177
|
## Start servers
|
177
178
|
|
@@ -79,6 +79,7 @@ module Hyrax
|
|
79
79
|
Deprecation.warn(self, ':member_of_collection_ids has been deprecated for removal in Hyrax 3.0. ' \
|
80
80
|
'use :member_of_collections_attributes instead.')
|
81
81
|
|
82
|
+
collection_ids = [] if collection_ids.empty?
|
82
83
|
other_collections = collections_without_edit_access(env)
|
83
84
|
|
84
85
|
collections = ::Collection.find(collection_ids)
|
@@ -102,6 +103,8 @@ module Hyrax
|
|
102
103
|
# along side the FileSets on the show page
|
103
104
|
def add(env, id)
|
104
105
|
collection = Collection.find(id)
|
106
|
+
collection.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX
|
107
|
+
|
105
108
|
return unless env.current_ability.can?(:deposit, collection)
|
106
109
|
env.curation_concern.member_of_collections << collection
|
107
110
|
end
|
@@ -55,14 +55,15 @@ module Hyrax
|
|
55
55
|
Rails.logger.error "User #{env.user.user_key} attempted to ingest file from url #{file_info[:url]}, which doesn't pass validation"
|
56
56
|
return false
|
57
57
|
end
|
58
|
-
|
58
|
+
auth_header = file_info.fetch(:auth_header, {})
|
59
|
+
create_file_from_url(env, uri, file_info[:file_name], auth_header)
|
59
60
|
end
|
60
61
|
true
|
61
62
|
end
|
62
63
|
|
63
64
|
# Generic utility for creating FileSet from a URL
|
64
65
|
# Used in to import files using URLs from a file picker like browse_everything
|
65
|
-
def create_file_from_url(env, uri, file_name)
|
66
|
+
def create_file_from_url(env, uri, file_name, auth_header = {})
|
66
67
|
::FileSet.new(import_url: uri.to_s, label: file_name) do |fs|
|
67
68
|
actor = Hyrax::Actors::FileSetActor.new(fs, env.user)
|
68
69
|
actor.create_metadata(visibility: env.curation_concern.visibility)
|
@@ -73,7 +74,7 @@ module Hyrax
|
|
73
74
|
file_path = CGI.unescape(uri.path)
|
74
75
|
IngestLocalFileJob.perform_later(fs, file_path, env.user)
|
75
76
|
else
|
76
|
-
ImportUrlJob.perform_later(fs, operation_for(user: actor.user))
|
77
|
+
ImportUrlJob.perform_later(fs, operation_for(user: actor.user), auth_header)
|
77
78
|
end
|
78
79
|
end
|
79
80
|
end
|
@@ -10,24 +10,27 @@ module Hyrax
|
|
10
10
|
# @param [Hyrax::Actors::Environment] env
|
11
11
|
# @return [Boolean] true if create was successful
|
12
12
|
def create(env)
|
13
|
-
ensure_admin_set_attribute!(env
|
13
|
+
ensure_admin_set_attribute!(env)
|
14
14
|
next_actor.create(env)
|
15
15
|
end
|
16
16
|
|
17
17
|
# @param [Hyrax::Actors::Environment] env
|
18
18
|
# @return [Boolean] true if update was successful
|
19
19
|
def update(env)
|
20
|
-
ensure_admin_set_attribute!(env
|
20
|
+
ensure_admin_set_attribute!(env)
|
21
21
|
next_actor.update(env)
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def ensure_admin_set_attribute!(
|
27
|
-
if attributes[:admin_set_id].present?
|
28
|
-
ensure_permission_template!(admin_set_id: attributes[:admin_set_id])
|
26
|
+
def ensure_admin_set_attribute!(env)
|
27
|
+
if env.attributes[:admin_set_id].present?
|
28
|
+
ensure_permission_template!(admin_set_id: env.attributes[:admin_set_id])
|
29
|
+
elsif env.curation_concern.admin_set_id.present?
|
30
|
+
env.attributes[:admin_set_id] = env.curation_concern.admin_set_id
|
31
|
+
ensure_permission_template!(admin_set_id: env.attributes[:admin_set_id])
|
29
32
|
else
|
30
|
-
attributes[:admin_set_id] = default_admin_set_id
|
33
|
+
env.attributes[:admin_set_id] = default_admin_set_id
|
31
34
|
end
|
32
35
|
end
|
33
36
|
|
@@ -54,6 +54,7 @@
|
|
54
54
|
//= require hyrax/browse_everything
|
55
55
|
//= require hyrax/search
|
56
56
|
//= require hyrax/content_blocks
|
57
|
+
//= require hyrax/nav_safety
|
57
58
|
//= require hyrax/ga_events
|
58
59
|
//= require hyrax/select_submit
|
59
60
|
//= require hyrax/tabs
|
@@ -86,7 +87,9 @@
|
|
86
87
|
//= require hyrax/relationships
|
87
88
|
//= require hyrax/select_work_type
|
88
89
|
//= require hyrax/collections
|
90
|
+
//= require hyrax/collections_v2
|
89
91
|
//= require hyrax/collection_types
|
92
|
+
//= require hyrax/collections_utils
|
90
93
|
//= require hyrax/select_collection_type
|
91
94
|
//= require hydra-editor/hydra-editor
|
92
95
|
//= require nestable
|
@@ -13,8 +13,10 @@ Hyrax = {
|
|
13
13
|
this.datatable();
|
14
14
|
this.adminSetEditor();
|
15
15
|
this.collectionEditor();
|
16
|
+
this.collectionsV2();
|
16
17
|
this.collectionTypes();
|
17
18
|
this.collectionTypeEditor();
|
19
|
+
this.collectionUtilities();
|
18
20
|
this.adminStatisticsGraphs();
|
19
21
|
this.tinyMCE();
|
20
22
|
this.sortAndPerPage();
|
@@ -49,12 +51,24 @@ Hyrax = {
|
|
49
51
|
var controls = new CollectionControls($('#collection_permissions'));
|
50
52
|
},
|
51
53
|
|
54
|
+
// Collections v2 - collections related js should (over time) be moved here
|
55
|
+
// from 'collections.js' to take advantage of shared modules
|
56
|
+
collectionsV2: function() {
|
57
|
+
var CollectionsV2 = require('hyrax/collections_v2');
|
58
|
+
new CollectionsV2();
|
59
|
+
},
|
60
|
+
|
52
61
|
// Collection types
|
53
62
|
collectionTypes: function() {
|
54
63
|
var CollectionTypes = require('hyrax/collection_types');
|
55
64
|
var collection_types = new CollectionTypes($('.collection-types-wrapper'))
|
56
65
|
},
|
57
66
|
|
67
|
+
collectionUtilities: function() {
|
68
|
+
var CollectionUtilities = require('hyrax/collections_utils');
|
69
|
+
new CollectionUtilities();
|
70
|
+
},
|
71
|
+
|
58
72
|
// Pretty graphs on the dashboard page
|
59
73
|
adminStatisticsGraphs: function() {
|
60
74
|
var AdminGraphs = require('hyrax/admin/graphs');
|
@@ -159,7 +159,8 @@ function batch_edit_init () {
|
|
159
159
|
setTimeout(ajaxManager.runNow(), 100);
|
160
160
|
}
|
161
161
|
|
162
|
-
$("#
|
162
|
+
$("#permissions_visibility_save").click(runSave);
|
163
|
+
$("#permissions_roles_save").click(runSave);
|
163
164
|
$(".field-save").click(runSave);
|
164
165
|
}
|
165
166
|
|
@@ -1,65 +1,126 @@
|
|
1
|
-
|
1
|
+
import CollectionUtilities from 'hyrax/collections_utils';
|
2
2
|
|
3
|
+
export default class CollectionTypes {
|
3
4
|
constructor(element) {
|
5
|
+
this.collectionUtilities = new CollectionUtilities();
|
6
|
+
|
4
7
|
if (element.length > 0) {
|
5
|
-
this.handleCollapseToggle()
|
6
|
-
this.handleDelete()
|
8
|
+
this.handleCollapseToggle();
|
9
|
+
this.handleDelete();
|
10
|
+
|
11
|
+
// Edit Collection Type
|
12
|
+
this.setupAddParticipantsHandler();
|
13
|
+
this.participantsAddButtonDisabler();
|
7
14
|
}
|
8
15
|
}
|
9
16
|
|
17
|
+
setupAddParticipantsHandler() {
|
18
|
+
const { addParticipants } = this.collectionUtilities;
|
19
|
+
const wrapEl = '.form-add-participants-wrapper';
|
20
|
+
const url = '/admin/collection_type_participants?locale=en';
|
21
|
+
|
22
|
+
$('#participants')
|
23
|
+
.find('.add-participants-form input[type="submit"]')
|
24
|
+
.on(
|
25
|
+
'click',
|
26
|
+
{
|
27
|
+
wrapEl,
|
28
|
+
// This is a callback (seems odd here because just passing in a string value),
|
29
|
+
// because other urls need to be calculated with an id or other param only truly
|
30
|
+
// known from when we know the clicked element's place in DOM.
|
31
|
+
urlFn: e => url
|
32
|
+
},
|
33
|
+
addParticipants.handleAddParticipants.bind(addParticipants)
|
34
|
+
);
|
35
|
+
}
|
36
|
+
|
10
37
|
handleCollapseToggle() {
|
11
|
-
let $collapseHeader = $('a.collapse-header')
|
12
|
-
let $collapseHeaderSpan = $('a.collapse-header').find('span')
|
38
|
+
let $collapseHeader = $('a.collapse-header');
|
39
|
+
let $collapseHeaderSpan = $('a.collapse-header').find('span');
|
40
|
+
const collapseText = $collapseHeader.data('collapseText');
|
41
|
+
const expandText = $collapseHeader.data('expandText');
|
13
42
|
|
14
43
|
// Toggle show/hide of collapsible content on bootstrap toggle events
|
15
44
|
$('#collapseAbout').on('show.bs.collapse', () => {
|
16
|
-
$collapseHeader.addClass('open')
|
17
|
-
$collapseHeaderSpan.html(
|
18
|
-
})
|
45
|
+
$collapseHeader.addClass('open');
|
46
|
+
$collapseHeaderSpan.html(collapseText);
|
47
|
+
});
|
19
48
|
$('#collapseAbout').on('hide.bs.collapse', () => {
|
20
|
-
$collapseHeader.removeClass('open')
|
21
|
-
$collapseHeaderSpan.html(
|
22
|
-
})
|
49
|
+
$collapseHeader.removeClass('open');
|
50
|
+
$collapseHeaderSpan.html(expandText);
|
51
|
+
});
|
23
52
|
}
|
24
53
|
|
25
54
|
handleDelete() {
|
26
|
-
let trData = null
|
55
|
+
let trData = null;
|
27
56
|
|
28
57
|
// Click delete collections type button in the table row
|
29
|
-
$('.delete-collection-type').on('click',
|
30
|
-
let dataset = event.target.dataset
|
31
|
-
let collectionType = JSON.parse(dataset.collectionType) || null
|
32
|
-
let hasCollections = dataset.hasCollections === 'true'
|
58
|
+
$('.delete-collection-type').on('click', event => {
|
59
|
+
let dataset = event.target.dataset;
|
60
|
+
let collectionType = JSON.parse(dataset.collectionType) || null;
|
61
|
+
let hasCollections = dataset.hasCollections === 'true';
|
33
62
|
this.handleDelete_event_target = event.target;
|
34
63
|
this.collectionType_id = collectionType.id;
|
35
64
|
|
36
65
|
if (hasCollections === true) {
|
37
|
-
$('.view-collections-of-this-type').attr(
|
38
|
-
|
66
|
+
$('.view-collections-of-this-type').attr(
|
67
|
+
'href',
|
68
|
+
dataset.collectionTypeIndex
|
69
|
+
);
|
70
|
+
$('#deleteDenyModal').modal();
|
39
71
|
} else {
|
40
|
-
$('#deleteModal').modal()
|
72
|
+
$('#deleteModal').modal();
|
41
73
|
}
|
42
|
-
})
|
74
|
+
});
|
43
75
|
|
44
76
|
// Confirm delete collection type
|
45
|
-
$('.confirm-delete-collection-type').on('click',
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
77
|
+
$('.confirm-delete-collection-type').on('click', event => {
|
78
|
+
event.preventDefault();
|
79
|
+
$.ajax({
|
80
|
+
url: window.location.pathname + '/' + this.collectionType_id,
|
81
|
+
type: 'DELETE',
|
82
|
+
done: function(e) {
|
83
|
+
$(this.handleDelete_event_target)
|
84
|
+
.parent('td')
|
85
|
+
.parent('tr')
|
86
|
+
.remove();
|
87
|
+
let defaultButton = $(event.target)
|
88
|
+
.parent('div')
|
89
|
+
.find('.btn-default');
|
90
|
+
defaultButton.trigger('click');
|
91
|
+
}
|
92
|
+
});
|
93
|
+
});
|
57
94
|
|
58
95
|
// Confirm delete collection type
|
59
|
-
$('.view-collections-of-this-type').on('click',
|
60
|
-
|
61
|
-
})
|
62
|
-
|
96
|
+
$('.view-collections-of-this-type').on('click', event => {
|
97
|
+
$('#deleteDenyModal').modal('hide');
|
98
|
+
});
|
63
99
|
}
|
64
100
|
|
101
|
+
/**
|
102
|
+
* Set up enabling/disabling "Add" button for adding groups and/or users in
|
103
|
+
* Edit Collection Type > Participants tab
|
104
|
+
* @return {void}
|
105
|
+
*/
|
106
|
+
participantsAddButtonDisabler() {
|
107
|
+
const { addParticipantsInputValidator } = this.collectionUtilities;
|
108
|
+
// Selector for the button to enable/disable
|
109
|
+
const buttonSelector = '.add-participants-form input[type="submit"]';
|
110
|
+
const inputsWrapper = '.form-add-participants-wrapper';
|
111
|
+
|
112
|
+
$('#participants')
|
113
|
+
.find(inputsWrapper)
|
114
|
+
.on(
|
115
|
+
'change',
|
116
|
+
// custom data we need passed into the event handler
|
117
|
+
{
|
118
|
+
buttonSelector,
|
119
|
+
inputsWrapper
|
120
|
+
},
|
121
|
+
addParticipantsInputValidator.handleWrapperContentsChange.bind(
|
122
|
+
addParticipantsInputValidator
|
123
|
+
)
|
124
|
+
);
|
125
|
+
}
|
65
126
|
}
|
@@ -240,27 +240,29 @@ Blacklight.onLoad(function () {
|
|
240
240
|
};
|
241
241
|
var $deleteWordingTarget = $('#selected-collections-delete-modal .pluralized');
|
242
242
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
});
|
243
|
+
var canDeleteAll = true;
|
244
|
+
var selectedInputs = $('#documents table.collections-list-table tbody tr')
|
245
|
+
// Get all inputs in the table
|
246
|
+
.find('td:first input[type=checkbox]')
|
247
|
+
// Filter to those that are checked
|
248
|
+
.filter(function(i, checkbox) { return checkbox.checked; });
|
249
|
+
|
250
|
+
var cannotDeleteInputs = selectedInputs.filter(function(i, checkbox) { return checkbox.dataset.hasaccess === "false"; });
|
251
|
+
if(cannotDeleteInputs.length > 0) {
|
252
|
+
// TODO: Can we pass data to this modal to be more specific about which ones they cannot delete?
|
253
|
+
$('#collections-to-delete-deny-modal').modal('show');
|
254
|
+
return;
|
255
|
+
}
|
251
256
|
|
252
|
-
if (
|
257
|
+
if (selectedInputs.length > 0) {
|
253
258
|
// Collections are selected
|
254
259
|
// Update singular / plural text in delete modal
|
255
|
-
if (
|
260
|
+
if (selectedInputs.length > 1) {
|
256
261
|
$deleteWordingTarget.text(deleteWording.plural);
|
257
262
|
} else {
|
258
263
|
$deleteWordingTarget.text(deleteWording.singular);
|
259
264
|
}
|
260
265
|
$('#selected-collections-delete-modal').modal('show');
|
261
|
-
} else {
|
262
|
-
// No collections are selected
|
263
|
-
$('#collections-to-delete-deny-modal').modal('show');
|
264
266
|
}
|
265
267
|
});
|
266
268
|
|
@@ -317,40 +319,4 @@ Blacklight.onLoad(function () {
|
|
317
319
|
$('#add-subcollection-modal-' + $(this).data('presenterId')).modal('show');
|
318
320
|
});
|
319
321
|
|
320
|
-
|
321
|
-
// Edit Collection: Sharing tab: Add Sharing section click handlers
|
322
|
-
/*
|
323
|
-
Notes:
|
324
|
-
This is a workaround for a scoping issue with 'simple_form' and nested forms in the
|
325
|
-
'Edit Collections' partials. All tabs were wrapped in a 'simple_form'. Nested forms, for example inside a tab partial,
|
326
|
-
have behaved erratically, so the pattern has been to remove nested form instances for relatively non-complex forms
|
327
|
-
and replace with AJAX requests. For this instance of Add Sharing > Add user and Add group, seem more complex in how
|
328
|
-
the form is built from '@form.permission_template', so since it's not working, but the form is already built, this
|
329
|
-
code listens for a click event on the nested form submit button, prevents Default submit behavior, and manually makes
|
330
|
-
the form post.
|
331
|
-
*/
|
332
|
-
$('#participants').find('.edit-collection-add-sharing-button').on('click', function(e) {
|
333
|
-
e.preventDefault();
|
334
|
-
var $wrapEl = $(e.target).parents('.form-add-sharing-wrapper');
|
335
|
-
if ($wrapEl.length === 0) {
|
336
|
-
return;
|
337
|
-
}
|
338
|
-
var serialized = $wrapEl.find(':input').serialize(),
|
339
|
-
url = '/dashboard/collections/' + $wrapEl.data('id') + '/permission_template?locale=en';
|
340
|
-
|
341
|
-
if (serialized.length === 0) {
|
342
|
-
return;
|
343
|
-
}
|
344
|
-
|
345
|
-
$.ajax({
|
346
|
-
type: 'POST',
|
347
|
-
url: url,
|
348
|
-
data: serialized
|
349
|
-
}).done(function(response) {
|
350
|
-
// Success handler here, possibly show alert success if page didn't reload?
|
351
|
-
}).fail(function(err) {
|
352
|
-
console.error(err);
|
353
|
-
});
|
354
|
-
|
355
|
-
});
|
356
322
|
});
|