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
@@ -0,0 +1,116 @@
|
|
1
|
+
/**
|
2
|
+
* Generic helper utilities for processing Collection and Collection Type editing
|
3
|
+
* @type {Class}
|
4
|
+
*/
|
5
|
+
export default class CollectionUtilities {
|
6
|
+
constructor() {
|
7
|
+
this.addParticipantsInputValidator = new AddParticipantsInputValidator();
|
8
|
+
this.addParticipants = new AddParticipants();
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
class AddParticipants {
|
13
|
+
/**
|
14
|
+
* Notes:
|
15
|
+
This is a workaround for a scoping issue with 'simple_form' and nested forms in the
|
16
|
+
'Edit Collections' partials. All tabs were wrapped in a 'simple_form'. Nested forms, for example inside a tab partial,
|
17
|
+
have behaved erratically, so the pattern has been to remove nested form instances for relatively non-complex forms
|
18
|
+
and replace with AJAX requests. For this instance of Add Sharing > Add user and Add group, seem more complex in how
|
19
|
+
the form is built from '@form.permission_template', so since it's not working, but the form is already built, this
|
20
|
+
code listens for a click event on the nested form submit button, prevents Default submit behavior, and manually makes
|
21
|
+
the form post.
|
22
|
+
* @param {jQuery event} e jQuery event object
|
23
|
+
* @return {void}
|
24
|
+
*/
|
25
|
+
handleAddParticipants(e) {
|
26
|
+
e.preventDefault();
|
27
|
+
const { wrapEl, urlFn } = e.data;
|
28
|
+
// This is a callback, because some POST urls might depend on dynamic id variables
|
29
|
+
// Send the e event object back and construct any values needed
|
30
|
+
const url = urlFn(e);
|
31
|
+
const $wrapEl = $(e.target).parents(wrapEl);
|
32
|
+
|
33
|
+
if ($wrapEl.length === 0) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
// Get all input values to send in the upcoming POST
|
37
|
+
const serialized = $wrapEl.find(':input').serialize();
|
38
|
+
if (serialized.length === 0) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
|
42
|
+
$.ajax({
|
43
|
+
type: 'POST',
|
44
|
+
url: url,
|
45
|
+
data: serialized
|
46
|
+
})
|
47
|
+
.done(function(response) {
|
48
|
+
// Success handler here, possibly show alert success if page didn't reload?
|
49
|
+
})
|
50
|
+
.fail(function(err) {
|
51
|
+
console.error(err);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Handle enabling/disabling "Add" button for adding a user or group when editing a Collection
|
58
|
+
* or Collection Type. Determines whether editable inputs have been filled out or not, then sets button state.
|
59
|
+
* @type: {Class}
|
60
|
+
*/
|
61
|
+
class AddParticipantsInputValidator {
|
62
|
+
/**
|
63
|
+
* Check that regular inputs have a non-empty input value
|
64
|
+
* @param {jQuery object} $inputs Inputs which are editable by the user
|
65
|
+
* @return {boolean} Do all inputs passed in have values?
|
66
|
+
*/
|
67
|
+
checkInputsPass($inputs) {
|
68
|
+
let inputsPass = true;
|
69
|
+
|
70
|
+
$inputs.each(function(i) {
|
71
|
+
if ($(this).val() === '') {
|
72
|
+
inputsPass = false;
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
});
|
76
|
+
return inputsPass;
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Checks that the select2 input (if it exists) has a non-default value
|
81
|
+
* @param {object} context jQuery $(this) context object
|
82
|
+
* @return {boolean} Whether a select2 input has a non-default value, or doesn't exist
|
83
|
+
*/
|
84
|
+
checkSelect2Pass(context) {
|
85
|
+
const $select2 = context.find('.select2-container');
|
86
|
+
// No select2 element present, so it passes by default
|
87
|
+
if ($select2.length === 0) {
|
88
|
+
return true;
|
89
|
+
}
|
90
|
+
const $placeholder = $select2.siblings('[placeholder]');
|
91
|
+
const placeholderValue = $placeholder.attr('placeholder');
|
92
|
+
const chosenValue = $select2.find('.select2-chosen').text();
|
93
|
+
|
94
|
+
return placeholderValue !== chosenValue;
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Handle disabled button state for the 'Add' button for Collections or
|
99
|
+
* Collection Type > Edit > Sharing or Participants tab Add Sharing or Add Partipants section
|
100
|
+
* @param {object} event jQuery event object
|
101
|
+
* @param {string} event.data.buttonSelector jQuery selector string for row's button
|
102
|
+
* @param {string} event.data.inputsWrapper jQuery selector string for the wrapping selector class which holds inputs
|
103
|
+
* @return {void}
|
104
|
+
*/
|
105
|
+
handleWrapperContentsChange(event) {
|
106
|
+
const { buttonSelector, inputsWrapper } = event.data;
|
107
|
+
const $inputsWrapper = $(event.target).parents(inputsWrapper);
|
108
|
+
// Get regular inputs for the row
|
109
|
+
const $inputs = $inputsWrapper.find('.form-control');
|
110
|
+
const $addButton = $inputsWrapper.find(buttonSelector);
|
111
|
+
const inputsPass = this.checkInputsPass($inputs);
|
112
|
+
const select2Pass = this.checkSelect2Pass($inputsWrapper);
|
113
|
+
|
114
|
+
$addButton.prop('disabled', !(inputsPass && select2Pass));
|
115
|
+
}
|
116
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import CollectionUtilities from 'hyrax/collections_utils';
|
2
|
+
|
3
|
+
export default class CollectionsV2 {
|
4
|
+
constructor() {
|
5
|
+
this.collectionUtilities = new CollectionUtilities();
|
6
|
+
this.setupAddSharingHandler();
|
7
|
+
this.sharingAddButtonDisabler();
|
8
|
+
}
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Set up the handler for adding groups or users via AJAX POSTS at the following location:
|
12
|
+
* Collection > Edit > Sharing tab; or
|
13
|
+
* Collection Types > Edit > Participants tab
|
14
|
+
* @return {void}
|
15
|
+
*/
|
16
|
+
setupAddSharingHandler() {
|
17
|
+
const { addParticipants } = this.collectionUtilities;
|
18
|
+
const wrapEl = '.form-add-sharing-wrapper';
|
19
|
+
|
20
|
+
$('#participants')
|
21
|
+
.find('.edit-collection-add-sharing-button')
|
22
|
+
.on('click', {
|
23
|
+
wrapEl,
|
24
|
+
urlFn: (e) => {
|
25
|
+
const $wrapEl = $(e.target).parents(wrapEl);
|
26
|
+
return '/dashboard/collections/' + $wrapEl.data('id') + '/permission_template?locale=en';
|
27
|
+
}
|
28
|
+
},
|
29
|
+
addParticipants.handleAddParticipants.bind(addParticipants));
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Set up enabling/disabling "Add" button for adding groups and/or users in
|
34
|
+
* Edit Collection > Sharing tab
|
35
|
+
* @return {void}
|
36
|
+
*/
|
37
|
+
sharingAddButtonDisabler() {
|
38
|
+
const { addParticipantsInputValidator } = this.collectionUtilities;
|
39
|
+
// Selector for the button to enable/disable
|
40
|
+
const buttonSelector = '.edit-collection-add-sharing-button';
|
41
|
+
const inputsWrapper = '.form-add-sharing-wrapper';
|
42
|
+
|
43
|
+
$('#participants')
|
44
|
+
.find(inputsWrapper)
|
45
|
+
.on(
|
46
|
+
'change',
|
47
|
+
// custom data we need passed into the event handler
|
48
|
+
{
|
49
|
+
buttonSelector: '.edit-collection-add-sharing-button',
|
50
|
+
inputsWrapper
|
51
|
+
},
|
52
|
+
addParticipantsInputValidator.handleWrapperContentsChange.bind(
|
53
|
+
addParticipantsInputValidator
|
54
|
+
)
|
55
|
+
);
|
56
|
+
}
|
57
|
+
}
|
@@ -9,16 +9,4 @@ Blacklight.onLoad(function() {
|
|
9
9
|
$this.parent().hide();
|
10
10
|
$($this.data('target')).show();
|
11
11
|
});
|
12
|
-
|
13
|
-
$('.show-confirm').on('click', function(evt) {
|
14
|
-
evt.preventDefault();
|
15
|
-
evt.stopPropagation();
|
16
|
-
$('#change-tab-content-block').modal('show');
|
17
|
-
});
|
18
|
-
|
19
|
-
$('#change-tab-btn').on('click', function(evt) {
|
20
|
-
evt.preventDefault();
|
21
|
-
$('#change-tab-content-block').modal('hide');
|
22
|
-
$('.nav-tabs a[href="' + location.hash + '"]').tab('show');
|
23
|
-
});
|
24
|
-
});
|
12
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// To enable nav safety on a form:
|
2
|
+
// - Render the shared/nav-safety partial on the page.
|
3
|
+
// - Add the nav-safety-confirm class to the tab anchor element.
|
4
|
+
// - Add the nav-safety class to the form element.
|
5
|
+
|
6
|
+
Blacklight.onLoad(function() {
|
7
|
+
$('.nav-safety-confirm').on('click', function(evt) {
|
8
|
+
var dirtyData = $('#nav-safety-modal[dirtyData=true]');
|
9
|
+
if (dirtyData.length > 0) {
|
10
|
+
evt.preventDefault();
|
11
|
+
evt.stopPropagation();
|
12
|
+
$('#nav-safety-modal').modal('show');
|
13
|
+
}
|
14
|
+
});
|
15
|
+
|
16
|
+
$('#nav-safety-dismiss').on('click', function(evt) {
|
17
|
+
// evt.preventDefault();
|
18
|
+
nav_safety_off();
|
19
|
+
// $('#nav-safety-change-tab').modal('hide');
|
20
|
+
});
|
21
|
+
|
22
|
+
$('form.nav-safety').on('change', function(evt) {
|
23
|
+
nav_safety_on();
|
24
|
+
});
|
25
|
+
$('form.nav-safety').on('reset', function(evt) {
|
26
|
+
nav_safety_off();
|
27
|
+
});
|
28
|
+
});
|
29
|
+
|
30
|
+
function nav_safety_on() {
|
31
|
+
$('#nav-safety-modal')[0].setAttribute('dirtyData', true);
|
32
|
+
}
|
33
|
+
|
34
|
+
function nav_safety_off() {
|
35
|
+
$('#nav-safety-modal')[0].setAttribute('dirtyData', false);
|
36
|
+
}
|
37
|
+
|
38
|
+
function tinymce_nav_safety(editor) {editor.on('Change', function (e) {
|
39
|
+
$(e.target.targetElm).parents('form.nav-safety').change();
|
40
|
+
});
|
41
|
+
}
|
@@ -2,4 +2,7 @@
|
|
2
2
|
// See https://github.com/rails/jquery-ujs/issues/456
|
3
3
|
$(document).on('turbolinks:load', function() {
|
4
4
|
$.rails.refreshCSRFTokens();
|
5
|
+
// Explicitly set flag to false to force loading of UV
|
6
|
+
// See https://github.com/samvera/hyrax/issues/2906
|
7
|
+
window.embedScriptIncluded = false;
|
5
8
|
});
|
@@ -9,8 +9,8 @@
|
|
9
9
|
.collection-types-wrapper {
|
10
10
|
@media (min-width: 900px) {
|
11
11
|
.collection-types-table {
|
12
|
-
|
13
|
-
|
12
|
+
td:last-child,
|
13
|
+
th:last-child {
|
14
14
|
width: 20%;
|
15
15
|
}
|
16
16
|
}
|
@@ -48,6 +48,50 @@
|
|
48
48
|
}
|
49
49
|
}
|
50
50
|
|
51
|
+
// Edit Collection Types - Participants Tab
|
52
|
+
.collection-types-edit-participants-tab {
|
53
|
+
.section-participants {
|
54
|
+
padding-bottom: 40px;
|
55
|
+
|
56
|
+
.form-inline {
|
57
|
+
label {
|
58
|
+
padding-right: 5px;
|
59
|
+
text-align: right;
|
60
|
+
width: 100px;
|
61
|
+
}
|
62
|
+
|
63
|
+
.select2-container,
|
64
|
+
input,
|
65
|
+
select {
|
66
|
+
width: 200px;
|
67
|
+
}
|
68
|
+
|
69
|
+
.btn {
|
70
|
+
width: 75px;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
.section-current-participants {
|
76
|
+
legend {
|
77
|
+
margin-bottom: 0;
|
78
|
+
}
|
79
|
+
|
80
|
+
.share-status {
|
81
|
+
td,
|
82
|
+
th {
|
83
|
+
width: 40%;
|
84
|
+
}
|
85
|
+
|
86
|
+
th:last-of-type,
|
87
|
+
td:last-of-type {
|
88
|
+
text-align: center;
|
89
|
+
width: 20%;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
51
95
|
.collection-type-share-applies-to {
|
52
96
|
margin-left: 3em;
|
53
97
|
}
|
@@ -35,16 +35,13 @@ ul.tabular {
|
|
35
35
|
// text-align: center;
|
36
36
|
}
|
37
37
|
|
38
|
-
.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
padding: 8px;
|
43
|
-
vertical-align: top;
|
38
|
+
.work-show {
|
39
|
+
dt,
|
40
|
+
dd {
|
41
|
+
padding: 2px;
|
44
42
|
}
|
45
|
-
|
46
|
-
|
47
|
-
text-align: right;
|
43
|
+
dd {
|
44
|
+
margin-left: 6px;
|
48
45
|
}
|
49
46
|
}
|
50
47
|
|
@@ -56,7 +56,6 @@ module Hyrax
|
|
56
56
|
else
|
57
57
|
respond_to do |wants|
|
58
58
|
wants.html do
|
59
|
-
flash[:error] = curation_concern.errors.messages[:collections].to_sentence
|
60
59
|
build_form
|
61
60
|
render 'new', status: :unprocessable_entity
|
62
61
|
end
|
@@ -68,6 +67,8 @@ module Hyrax
|
|
68
67
|
# Finds a solr document matching the id and sets @presenter
|
69
68
|
# @raise CanCan::AccessDenied if the document is not found or the user doesn't have access to it.
|
70
69
|
def show
|
70
|
+
@user_collections = user_collections
|
71
|
+
|
71
72
|
respond_to do |wants|
|
72
73
|
wants.html { presenter && parent_presenter }
|
73
74
|
wants.json do
|
@@ -99,7 +100,6 @@ module Hyrax
|
|
99
100
|
else
|
100
101
|
respond_to do |wants|
|
101
102
|
wants.html do
|
102
|
-
flash[:error] = curation_concern.errors.messages[:collections].to_sentence
|
103
103
|
build_form
|
104
104
|
render 'edit', status: :unprocessable_entity
|
105
105
|
end
|
@@ -132,6 +132,14 @@ module Hyrax
|
|
132
132
|
|
133
133
|
private
|
134
134
|
|
135
|
+
def user_collections
|
136
|
+
collections_service.search_results(:deposit) if presenter.editor?
|
137
|
+
end
|
138
|
+
|
139
|
+
def collections_service
|
140
|
+
Hyrax::CollectionsService.new(self)
|
141
|
+
end
|
142
|
+
|
135
143
|
def admin_set_id_for_new
|
136
144
|
# admin_set_id is required on the client, otherwise simple_form renders a blank option.
|
137
145
|
# however it isn't a required field for someone to submit via json.
|
@@ -20,8 +20,9 @@ module Hyrax
|
|
20
20
|
self.admin_set_create_service = AdminSetCreateService
|
21
21
|
|
22
22
|
def show
|
23
|
+
add_breadcrumb I18n.t('hyrax.controls.home'), hyrax.root_path
|
23
24
|
add_breadcrumb t(:'hyrax.dashboard.title'), hyrax.dashboard_path
|
24
|
-
add_breadcrumb t(:'hyrax.dashboard.my.collections'), hyrax.
|
25
|
+
add_breadcrumb t(:'hyrax.dashboard.my.collections'), hyrax.my_collections_path
|
25
26
|
add_breadcrumb @admin_set.title.first
|
26
27
|
super
|
27
28
|
end
|
@@ -113,14 +114,6 @@ module Hyrax
|
|
113
114
|
@form ||= form_class.new(@admin_set, current_ability, repository)
|
114
115
|
end
|
115
116
|
|
116
|
-
# Overrides the parent implementation so that the returned search builder
|
117
|
-
# searches for edit access
|
118
|
-
# Instantiates the search builder that builds a query for a single item
|
119
|
-
# this is useful in the show view.
|
120
|
-
def single_item_search_builder
|
121
|
-
single_item_search_builder_class.new(self, :edit).with(params.except(:q, :page))
|
122
|
-
end
|
123
|
-
|
124
117
|
def action_breadcrumb
|
125
118
|
case action_name
|
126
119
|
when 'edit', 'update'
|
@@ -101,7 +101,7 @@ module Hyrax
|
|
101
101
|
|
102
102
|
def collection_type_params
|
103
103
|
params.require(:collection_type).permit(:title, :description, :nestable, :brandable, :discoverable, :sharable, :share_applies_to_new_works,
|
104
|
-
:allow_multiple_membership, :require_membership, :assigns_workflow, :assigns_visibility)
|
104
|
+
:allow_multiple_membership, :require_membership, :assigns_workflow, :assigns_visibility, :badge_color)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -46,9 +46,16 @@ module Hyrax
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def update_document(obj)
|
49
|
-
obj
|
49
|
+
interpret_visiblity_params(obj)
|
50
|
+
obj.attributes = work_params(admin_set_id: obj.admin_set_id).except(*visibility_params)
|
50
51
|
obj.date_modified = Time.current.ctime
|
51
|
-
|
52
|
+
|
53
|
+
if params[:visibility]
|
54
|
+
Deprecation.warn(self, "visibility is not submitted by the Hyrax UI and is deprecated " \
|
55
|
+
"for removal in Hyrax 3.0. Please use " \
|
56
|
+
"#{form_class.model_name.param_key}[visibility] instead.")
|
57
|
+
obj.visibility = params[:visibility]
|
58
|
+
end
|
52
59
|
|
53
60
|
InheritPermissionsJob.perform_now(obj)
|
54
61
|
VisibilityCopyJob.perform_now(obj)
|
@@ -94,9 +101,28 @@ module Hyrax
|
|
94
101
|
form_class.terms
|
95
102
|
end
|
96
103
|
|
97
|
-
def work_params
|
104
|
+
def work_params(extra_params = {})
|
98
105
|
work_params = params[form_class.model_name.param_key] || ActionController::Parameters.new
|
99
|
-
form_class.model_attributes(work_params)
|
106
|
+
form_class.model_attributes(work_params.merge(extra_params))
|
107
|
+
end
|
108
|
+
|
109
|
+
def interpret_visiblity_params(obj)
|
110
|
+
stack = ActionDispatch::MiddlewareStack.new.tap do |middleware|
|
111
|
+
middleware.use Hyrax::Actors::InterpretVisibilityActor
|
112
|
+
end
|
113
|
+
env = Hyrax::Actors::Environment.new(obj, current_ability, work_params(admin_set_id: obj.admin_set_id))
|
114
|
+
last_actor = Hyrax::Actors::Terminator.new
|
115
|
+
stack.build(last_actor).update(env)
|
116
|
+
end
|
117
|
+
|
118
|
+
def visibility_params
|
119
|
+
['visibility',
|
120
|
+
'lease_expiration_date',
|
121
|
+
'visibility_during_lease',
|
122
|
+
'visibility_after_lease',
|
123
|
+
'embargo_release_date',
|
124
|
+
'visibility_during_embargo',
|
125
|
+
'visibility_after_embargo']
|
100
126
|
end
|
101
127
|
|
102
128
|
def redirect_to_return_controller
|