hyrax 2.1.0.beta1 → 2.1.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -49
- data/.rubocop_fixme.yml +1 -0
- data/.travis.yml +1 -1
- data/Gemfile +3 -3
- data/README.md +4 -2
- data/app/actors/hyrax/actors/file_set_actor.rb +0 -1
- data/app/actors/hyrax/actors/interpret_visibility_actor.rb +1 -3
- data/app/actors/hyrax/actors/model_actor.rb +4 -0
- data/app/assets/javascripts/hyrax.js +1 -1
- data/app/assets/javascripts/hyrax/app.js.erb +1 -1
- data/app/assets/javascripts/hyrax/authority_select.es6 +15 -7
- data/app/assets/javascripts/hyrax/collections.js +188 -9
- data/app/assets/javascripts/hyrax/content_blocks.js +13 -1
- data/app/assets/javascripts/hyrax/editor.es6 +2 -1
- data/app/assets/javascripts/hyrax/proxy_rights.js +2 -2
- data/app/assets/javascripts/hyrax/turbolinks_events.js +5 -0
- data/app/assets/stylesheets/hyrax/_accessibility.scss +21 -0
- data/app/assets/stylesheets/hyrax/_catalog.scss +21 -16
- data/app/assets/stylesheets/hyrax/_collections.scss +48 -7
- data/app/assets/stylesheets/hyrax/_modal.scss +4 -0
- data/app/assets/stylesheets/hyrax/_settings.scss +1 -1
- data/app/assets/stylesheets/hyrax/dashboard.scss +0 -1
- data/app/controllers/concerns/hyrax/breadcrumbs.rb +3 -1
- data/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +17 -1
- data/app/controllers/concerns/hyrax/leases_controller_behavior.rb +10 -0
- data/app/controllers/concerns/hyrax/local_file_downloads_controller_behavior.rb +86 -0
- data/app/controllers/concerns/hyrax/works_controller_behavior.rb +14 -11
- data/app/controllers/hyrax/admin/collection_types_controller.rb +11 -1
- data/app/controllers/hyrax/api/items_controller.rb +2 -6
- data/app/controllers/hyrax/batch_edits_controller.rb +6 -0
- data/app/controllers/hyrax/batch_uploads_controller.rb +1 -1
- data/app/controllers/hyrax/dashboard/collections_controller.rb +4 -7
- data/app/controllers/hyrax/dashboard/profiles_controller.rb +2 -0
- data/app/controllers/hyrax/dashboard_controller.rb +2 -2
- data/app/controllers/hyrax/depositors_controller.rb +19 -0
- data/app/controllers/hyrax/downloads_controller.rb +3 -4
- data/app/controllers/hyrax/embargoes_controller.rb +2 -0
- data/app/controllers/hyrax/file_sets_controller.rb +12 -0
- data/app/controllers/hyrax/leases_controller.rb +2 -0
- data/app/controllers/hyrax/my/works_controller.rb +9 -0
- data/app/controllers/hyrax/my_controller.rb +0 -1
- data/app/controllers/hyrax/transfers_controller.rb +1 -3
- data/app/controllers/hyrax/users_controller.rb +1 -3
- data/app/forms/hyrax/forms/admin/collection_type_form.rb +1 -1
- data/app/forms/hyrax/forms/permission_template_form.rb +1 -4
- data/app/forms/hyrax/forms/work_form.rb +1 -3
- data/app/helpers/hyrax/citations_behaviors/common_behavior.rb +1 -3
- data/app/helpers/hyrax/citations_behaviors/formatters/chicago_formatter.rb +1 -5
- data/app/helpers/hyrax/collections_helper.rb +7 -4
- data/app/helpers/hyrax/file_set_helper.rb +0 -1
- data/app/helpers/hyrax/hyrax_helper_behavior.rb +0 -1
- data/app/helpers/hyrax/trophy_helper.rb +0 -1
- data/app/indexers/hyrax/admin_set_indexer.rb +2 -0
- data/app/inputs/multi_value_select_input.rb +1 -3
- data/app/jobs/attach_files_to_work_job.rb +5 -1
- data/app/jobs/import_url_job.rb +9 -8
- data/app/models/admin_set.rb +1 -5
- data/app/models/concerns/hyrax/ability.rb +3 -4
- data/app/models/concerns/hyrax/collection_behavior.rb +0 -4
- data/app/models/concerns/hyrax/collection_nesting.rb +12 -0
- data/app/models/concerns/hyrax/suppressible.rb +1 -5
- data/app/models/featured_work_list.rb +1 -3
- data/app/models/hyrax/collection_type.rb +3 -2
- data/app/models/hyrax/permission_template_access.rb +6 -4
- data/app/models/proxy_deposit_request.rb +1 -1
- data/app/presenters/hyrax/collection_presenter.rb +0 -24
- data/app/presenters/hyrax/displays_image.rb +1 -1
- data/app/presenters/hyrax/file_set_presenter.rb +1 -1
- data/app/presenters/hyrax/menu_presenter.rb +1 -1
- data/app/presenters/hyrax/work_show_presenter.rb +15 -10
- data/app/search_builders/hyrax/abstract_type_relation.rb +2 -1
- data/app/search_builders/hyrax/collection_member_search_builder.rb +1 -1
- data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +3 -1
- data/app/search_builders/hyrax/parent_collection_search_builder.rb +2 -2
- data/app/services/hyrax/admin_set_create_service.rb +1 -3
- data/app/services/hyrax/analytics.rb +1 -3
- data/app/services/hyrax/collection_member_service.rb +6 -5
- data/app/services/hyrax/collection_types/create_service.rb +37 -10
- data/app/services/hyrax/collections/permissions_create_service.rb +1 -3
- data/app/services/hyrax/collections/permissions_service.rb +6 -4
- data/app/views/catalog/_index_header_list_collection.html.erb +1 -1
- data/app/views/catalog/_index_header_list_default.html.erb +1 -1
- data/app/views/catalog/_index_list_default.html.erb +6 -10
- data/app/views/catalog/_search_form.html.erb +10 -11
- data/app/views/catalog/_thumbnail_list_collection.html.erb +1 -1
- data/app/views/catalog/_thumbnail_list_default.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +1 -1
- data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +3 -3
- data/app/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb +2 -2
- data/app/views/hyrax/admin/admin_sets/index.html.erb +1 -1
- data/app/views/hyrax/admin/appearances/show.html.erb +4 -4
- data/app/views/hyrax/admin/collection_types/_form_settings.html.erb +3 -2
- data/app/views/hyrax/admin/collection_types/index.html.erb +2 -2
- data/app/views/hyrax/admin/features/index.html.erb +2 -4
- data/app/views/hyrax/admin/stats/_date_form.html.erb +3 -3
- data/app/views/hyrax/admin/stats/_top_data.html.erb +1 -1
- data/app/views/hyrax/admin/stats/show.html.erb +1 -1
- data/app/views/hyrax/admin/workflows/index.html.erb +0 -1
- data/app/views/hyrax/base/_file_manager_actions.html.erb +2 -2
- data/app/views/hyrax/base/_file_manager_member.html.erb +1 -1
- data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -2
- data/app/views/hyrax/base/_form_files.html.erb +3 -3
- data/app/views/hyrax/base/_form_member_of_collections.html.erb +1 -2
- data/app/views/hyrax/base/_form_progress.html.erb +3 -3
- data/app/views/hyrax/base/_form_relationships.html.erb +2 -3
- data/app/views/hyrax/base/_form_representative.html.erb +0 -1
- data/app/views/hyrax/base/_form_share.html.erb +1 -3
- data/app/views/hyrax/base/_form_thumbnail.html.erb +0 -1
- data/app/views/hyrax/base/_form_visibility_component.html.erb +6 -6
- data/app/views/hyrax/base/_relationships_parent_rows.html.erb +3 -1
- data/app/views/hyrax/base/_representative_media.html.erb +1 -1
- data/app/views/hyrax/base/_share_with.html.erb +3 -3
- data/app/views/hyrax/base/_show_actions.html.erb +14 -1
- data/app/views/hyrax/base/_social_media.html.erb +5 -5
- data/app/views/hyrax/base/_work_title.erb +3 -1
- data/app/views/hyrax/base/_workflow_actions.html.erb +1 -1
- data/app/views/hyrax/base/inspect_work.html.erb +1 -1
- data/app/views/hyrax/base/show.html.erb +2 -2
- data/app/views/hyrax/batch_edits/_check_all.html.erb +2 -2
- data/app/views/hyrax/batch_edits/edit.html.erb +47 -44
- data/app/views/hyrax/batch_select/_add_button.html.erb +2 -2
- data/app/views/hyrax/citations/work.html.erb +3 -3
- data/app/views/hyrax/collections/_collection.html.erb +1 -1
- data/app/views/hyrax/collections/_default_group.html.erb +1 -1
- data/app/views/hyrax/collections/_list_collections.html.erb +2 -2
- data/app/views/hyrax/collections/_list_works.html.erb +1 -1
- data/app/views/hyrax/collections/_show_descriptions.html.erb +6 -6
- data/app/views/hyrax/collections/_show_document_list_row.html.erb +2 -2
- data/app/views/hyrax/collections/_show_parent_collections.html.erb +11 -38
- data/app/views/hyrax/collections/_sort_and_per_page.html.erb +13 -13
- data/app/views/hyrax/collections/_subcollection_list.html.erb +1 -1
- data/app/views/hyrax/collections/_view_type_group.html.erb +1 -1
- data/app/views/hyrax/collections/show.html.erb +122 -122
- data/app/views/hyrax/content_blocks/_form.html.erb +13 -12
- data/app/views/hyrax/content_blocks/_modal_content_block.html.erb +15 -0
- data/app/views/hyrax/dashboard/_index_partials/_proxy_rights.html.erb +25 -19
- data/app/views/hyrax/dashboard/_sidebar.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_button_for_remove_selected_from_collection.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +16 -16
- data/app/views/hyrax/dashboard/collections/_form.html.erb +3 -1
- data/app/views/hyrax/dashboard/collections/_form_branding.html.erb +11 -11
- data/app/views/hyrax/dashboard/collections/_form_default_group_delt.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_form_for_select_collection.html.erb +4 -4
- data/app/views/hyrax/dashboard/collections/_form_share.html.erb +51 -44
- data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +4 -4
- data/app/views/hyrax/dashboard/collections/_list_works.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_modal_remove_from_collection.html.erb +10 -5
- data/app/views/hyrax/dashboard/collections/_modal_remove_sub_collection.html.erb +10 -5
- data/app/views/hyrax/dashboard/collections/_show_actions.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_show_add_items_actions.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_show_document_list_row.html.erb +2 -2
- data/app/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb +10 -5
- data/app/views/hyrax/dashboard/collections/_show_parent_collections.html.erb +11 -34
- data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
- data/app/views/hyrax/dashboard/collections/_subcollection_list.html.erb +23 -17
- data/app/views/hyrax/dashboard/collections/show.html.erb +6 -6
- data/app/views/hyrax/dashboard/profiles/_edit_primary.html.erb +0 -4
- data/app/views/hyrax/dashboard/profiles/_trophy_edit.html.erb +16 -14
- data/app/views/hyrax/dashboard/profiles/show.html.erb +6 -0
- data/app/views/hyrax/dashboard/show_admin.html.erb +19 -3
- data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +6 -0
- data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
- data/app/views/hyrax/depositors/index.html.erb +13 -0
- data/app/views/hyrax/embargoes/_list_expired_active_embargoes.html.erb +1 -1
- data/app/views/hyrax/embargoes/edit.html.erb +47 -35
- data/app/views/hyrax/embargoes/index.html.erb +6 -7
- data/app/views/hyrax/file_sets/_actions.html.erb +6 -2
- data/app/views/hyrax/file_sets/_extra_fields_modal.html.erb +3 -3
- data/app/views/hyrax/file_sets/_groups_description.html.erb +0 -1
- data/app/views/hyrax/file_sets/_permission_form.html.erb +3 -3
- data/app/views/hyrax/file_sets/edit.html.erb +24 -20
- data/app/views/hyrax/file_sets/media_display/_audio.html.erb +23 -6
- data/app/views/hyrax/file_sets/media_display/_default.html.erb +1 -1
- data/app/views/hyrax/file_sets/media_display/_video.html.erb +23 -6
- data/app/views/hyrax/leases/_list_expired_active_leases.html.erb +1 -1
- data/app/views/hyrax/leases/edit.html.erb +47 -35
- data/app/views/hyrax/leases/index.html.erb +6 -6
- data/app/views/hyrax/my/_collection_action_menu.html.erb +1 -1
- data/app/views/hyrax/my/_facet_limit.html.erb +1 -2
- data/app/views/hyrax/my/_facet_pagination.html.erb +6 -6
- data/app/views/hyrax/my/_facet_pivot.html.erb +1 -1
- data/app/views/hyrax/my/_results_pagination.html.erb +1 -1
- data/app/views/hyrax/my/collections/_facets.html.erb +1 -1
- data/app/views/hyrax/my/collections/_list_collections.html.erb +5 -5
- data/app/views/hyrax/my/collections/_modal_add_subcollection.html.erb +3 -2
- data/app/views/hyrax/my/collections/_modal_add_to_collection.html.erb +3 -1
- data/app/views/hyrax/my/collections/_modal_add_to_collection_permission_deny.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +2 -2
- data/app/views/hyrax/my/collections/_modal_delete_collection.html.erb +1 -2
- data/app/views/hyrax/my/collections/_modal_delete_deny.html.erb +1 -1
- data/app/views/hyrax/my/collections/_modal_delete_selected_collections.html.erb +2 -2
- data/app/views/hyrax/my/collections/_tabs.html.erb +2 -2
- data/app/views/hyrax/my/collections/index.html.erb +7 -3
- data/app/views/hyrax/my/facet.html.erb +1 -1
- data/app/views/hyrax/my/index.html.erb +6 -2
- data/app/views/hyrax/my/works/_facets.html.erb +1 -1
- data/app/views/hyrax/my/works/_list_works.html.erb +1 -1
- data/app/views/hyrax/my/works/_tabs.html.erb +2 -2
- data/app/views/hyrax/my/works/index.html.erb +6 -2
- data/app/views/hyrax/notifications/_notifications.html.erb +1 -1
- data/app/views/hyrax/pages/_form.html.erb +12 -12
- data/app/views/hyrax/pages/show.html.erb +1 -1
- data/app/views/hyrax/single_use_links_viewer/show.html.erb +1 -1
- data/app/views/hyrax/stats/file.html.erb +6 -2
- data/app/views/hyrax/stats/work.html.erb +6 -2
- data/app/views/hyrax/transfers/_received.html.erb +6 -6
- data/app/views/hyrax/transfers/_sent.html.erb +2 -2
- data/app/views/hyrax/transfers/new.html.erb +0 -1
- data/app/views/hyrax/users/_activity_log.html.erb +2 -2
- data/app/views/hyrax/users/_profile_tabs.html.erb +1 -1
- data/app/views/hyrax/users/_search_form.html.erb +1 -1
- data/app/views/hyrax/users/_user.html.erb +0 -1
- data/app/views/hyrax/users/index.html.erb +1 -1
- data/app/views/kaminari/blacklight_compact/_paginator.html.erb +1 -2
- data/app/views/layouts/_head_tag_content.html.erb +2 -2
- data/app/views/layouts/error.html.erb +1 -1
- data/app/views/layouts/hyrax.html.erb +6 -3
- data/app/views/layouts/hyrax/dashboard.html.erb +6 -3
- data/app/views/records/show_fields/_based_near.html.erb +0 -1
- data/app/views/records/show_fields/_contributor.html.erb +0 -1
- data/app/views/records/show_fields/_date_created.html.erb +0 -1
- data/app/views/records/show_fields/_description.html.erb +1 -1
- data/app/views/records/show_fields/_identifier.html.erb +0 -1
- data/app/views/records/show_fields/_language.html.erb +0 -1
- data/app/views/records/show_fields/_publisher.html.erb +0 -1
- data/app/views/records/show_fields/_related_url.html.erb +0 -1
- data/app/views/records/show_fields/_resource_type.html.erb +0 -1
- data/app/views/records/show_fields/_subject.html.erb +0 -1
- data/app/views/shared/_citations.html.erb +17 -17
- data/app/views/shared/_select_work_type_modal.html.erb +2 -2
- data/config/locales/hyrax.de.yml +198 -189
- data/config/locales/hyrax.en.yml +21 -14
- data/config/locales/hyrax.es.yml +9 -0
- data/config/locales/hyrax.fr.yml +9 -0
- data/config/locales/hyrax.it.yml +9 -0
- data/config/locales/hyrax.pt-BR.yml +9 -0
- data/config/locales/hyrax.zh.yml +9 -0
- data/config/routes.rb +1 -0
- data/hyrax.gemspec +7 -18
- data/lib/generators/hyrax/models_generator.rb +0 -1
- data/lib/generators/hyrax/templates/db/migrate/20180302200051_add_branding_to_collection_type.rb.erb +5 -0
- data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +1 -1
- data/lib/hyrax/configuration.rb +2 -4
- data/lib/hyrax/engine.rb +22 -4
- data/lib/hyrax/version.rb +1 -1
- data/spec/actors/hyrax/actors/lease_actor_spec.rb +16 -0
- data/spec/controllers/hyrax/admin/appearances_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/collection_types_controller_spec.rb +2 -0
- data/spec/controllers/hyrax/admin/features_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/workflow_roles_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/admin/workflows_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/batch_edits_controller_spec.rb +14 -1
- data/spec/controllers/hyrax/batch_uploads_controller_spec.rb +2 -2
- data/spec/controllers/hyrax/citations_controller_spec.rb +4 -2
- data/spec/controllers/hyrax/collections_controller_spec.rb +32 -4
- data/spec/controllers/hyrax/content_blocks_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/dashboard/collections_controller_spec.rb +11 -6
- data/spec/controllers/hyrax/depositors_controller_spec.rb +11 -0
- data/spec/controllers/hyrax/downloads_controller_spec.rb +42 -0
- data/spec/controllers/hyrax/embargoes_controller_spec.rb +40 -1
- data/spec/controllers/hyrax/file_sets_controller_spec.rb +10 -2
- data/spec/controllers/hyrax/generic_works_controller_spec.rb +38 -6
- data/spec/controllers/hyrax/leases_controller_spec.rb +11 -0
- data/spec/controllers/hyrax/my/collections_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/my/works_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/pages_controller_spec.rb +1 -1
- data/spec/controllers/hyrax/stats_controller_spec.rb +2 -0
- data/spec/controllers/hyrax/transfers_controller_spec.rb +1 -1
- data/spec/factories/collection_types.rb +10 -1
- data/spec/factories/collections.rb +5 -3
- data/spec/factories/collections_factory.rb +3 -3
- data/spec/factories/file_sets.rb +2 -6
- data/spec/factories/generic_works.rb +68 -4
- data/spec/factory_tests/collections_factory_spec.rb +2 -1
- data/spec/features/batch_create_spec.rb +60 -0
- data/spec/features/batch_edit_spec.rb +1 -0
- data/spec/features/browse_dashboard_works_spec.rb +1 -0
- data/spec/features/collection_multi_membership_spec.rb +9 -6
- data/spec/features/collection_spec.rb +1 -1
- data/spec/features/collection_type_spec.rb +49 -1
- data/spec/features/create_work_admin_spec.rb +2 -2
- data/spec/features/create_work_spec.rb +1 -0
- data/spec/features/dashboard/all_works.rb +10 -2
- data/spec/features/dashboard/collection_spec.rb +38 -17
- data/spec/features/dashboard/display_admin_dashboard_spec.rb +29 -0
- data/spec/features/dashboard/display_dashboard_spec.rb +1 -1
- data/spec/features/edit_content_block_admin_spec.rb +45 -0
- data/spec/features/edit_work_spec.rb +40 -2
- data/spec/features/ownership_transfer_spec.rb +1 -0
- data/spec/features/proxy_spec.rb +2 -2
- data/spec/features/search_spec.rb +2 -5
- data/spec/features/work_show_spec.rb +14 -4
- data/spec/forms/hyrax/forms/admin/collection_type_form_spec.rb +1 -0
- data/spec/forms/hyrax/forms/collection_form_spec.rb +1 -1
- data/spec/helpers/hyrax/ability_helper_spec.rb +2 -2
- data/spec/helpers/hyrax/collections_helper_spec.rb +12 -4
- data/spec/javascripts/authority_select_spec.js +1 -1
- data/spec/javascripts/settings_spec.js +1 -0
- data/spec/jobs/attach_files_to_work_job_spec.rb +13 -0
- data/spec/jobs/import_url_job_spec.rb +14 -0
- data/spec/models/collection_spec.rb +1 -0
- data/spec/models/concerns/hyrax/collection_nesting_spec.rb +16 -0
- data/spec/models/hyrax/collection_type_spec.rb +1 -0
- data/spec/presenters/hyrax/collection_presenter_spec.rb +1 -100
- data/spec/presenters/hyrax/file_set_presenter_spec.rb +17 -2
- data/spec/presenters/hyrax/menu_presenter_spec.rb +6 -0
- data/spec/presenters/hyrax/work_show_presenter_spec.rb +15 -3
- data/spec/search_builders/hyrax/abstract_type_relation_spec.rb +18 -0
- data/spec/search_builders/hyrax/dashboard/collections_search_builder_spec.rb +30 -19
- data/spec/search_builders/hyrax/parent_collection_search_builder_spec.rb +15 -0
- data/spec/services/hyrax/collection_member_service_spec.rb +10 -19
- data/spec/services/hyrax/collection_types/create_service_spec.rb +35 -2
- data/spec/services/hyrax/collections/collection_member_service_spec.rb +1 -1
- data/spec/services/hyrax/qa_select_service_spec.rb +0 -1
- data/spec/support/selectors.rb +15 -0
- data/spec/views/hyrax/admin/admin_sets/_show_document_list_row.html.erb_spec.rb +2 -0
- data/spec/views/hyrax/admin/collection_types/_form_settings.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/admin/stats/show.html.erb_spec.rb +9 -0
- data/spec/views/hyrax/base/_attributes.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/base/_relationships.html.erb_spec.rb +13 -1
- data/spec/views/hyrax/base/_show_actions.html.erb_spec.rb +10 -0
- data/spec/views/hyrax/base/show.html.erb_spec.rb +8 -0
- data/spec/views/hyrax/collections/_show_parent_collections.html.erb_spec.rb +3 -53
- data/spec/views/hyrax/dashboard/_sidebar.html.erb_spec.rb +22 -0
- data/spec/views/hyrax/dashboard/collections/_form_share.erb_spec.rb +2 -1
- data/spec/views/hyrax/dashboard/collections/_show_actions.html.erb_spec.rb +13 -0
- data/spec/views/hyrax/dashboard/collections/_show_parent_collection_row.html.erb_spec.rb +26 -8
- data/spec/views/hyrax/dashboard/collections/_show_parent_collections.html.erb_spec.rb +7 -43
- data/spec/views/hyrax/dashboard/collections/_subcollection_list.html.erb_spec.rb +13 -1
- data/spec/views/hyrax/dashboard/collections/show.html.erb_spec.rb +1 -0
- data/spec/views/hyrax/dashboard/profiles/_trophy_edit.html.erb_spec.rb +36 -0
- data/spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb +0 -38
- data/spec/views/hyrax/dashboard/profiles/show.html.erb_spec.rb +37 -0
- data/spec/views/hyrax/depositors/index.html.erb_spec.rb +13 -0
- data/spec/views/hyrax/file_sets/_actions.html.erb_spec.rb +15 -0
- data/spec/views/hyrax/file_sets/media_display/_audio.html.erb_spec.rb +29 -0
- data/spec/views/hyrax/file_sets/media_display/_default.html.erb_spec.rb +1 -1
- data/spec/views/hyrax/file_sets/media_display/_video.html.erb_spec.rb +29 -0
- data/spec/views/hyrax/my/collections/_list_collections.html.erb_spec.rb +6 -2
- data/tasks/hyrax_dev.rake +1 -3
- data/template.rb +1 -1
- metadata +49 -41
- data/app/assets/javascripts/hyrax/collections_forms.js +0 -108
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be1e8653f1cbe02d0084c4e9d5ad3ae86452030c
|
|
4
|
+
data.tar.gz: 3195a5f77e3b68b97ad86b0d441340037f2c5617
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eca96b7e93e799c6540995b8607f0c696350e125030475c7e15ac567f1c048ed05a851f656b04c2a72c258e26d1c95cf08e52f79f87c1446269e055d626e8de4
|
|
7
|
+
data.tar.gz: 155ac39bca91ca478e0856b27a6487ff9976e7dddee5b22a4ed6b3323f109e3dc1310bdd82fb529a542cb9603926d571df8e23b65f73c9a14323025ed502d159
|
data/.rubocop.yml
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
inherit_gem:
|
|
2
|
+
bixby: bixby_default.yml
|
|
3
|
+
|
|
2
4
|
inherit_from: .rubocop_fixme.yml
|
|
3
5
|
|
|
4
6
|
AllCops:
|
|
5
7
|
TargetRubyVersion: 2.1
|
|
6
8
|
DisplayCopNames: true
|
|
7
|
-
Include:
|
|
8
|
-
- '**/Rakefile'
|
|
9
|
-
- '**/config.ru'
|
|
10
9
|
Exclude:
|
|
11
10
|
- 'db/**/*'
|
|
12
11
|
- 'script/**/*'
|
|
@@ -14,25 +13,10 @@ AllCops:
|
|
|
14
13
|
- 'vendor/**/*'
|
|
15
14
|
- 'lib/hyrax/specs/**/*'
|
|
16
15
|
|
|
17
|
-
Bundler/DuplicatedGem: # This doesn't work with engine_cart
|
|
18
|
-
Enabled: false
|
|
19
|
-
|
|
20
|
-
Layout/IndentationConsistency:
|
|
21
|
-
EnforcedStyle: rails
|
|
22
|
-
|
|
23
16
|
Lint/ImplicitStringConcatenation:
|
|
24
17
|
Exclude:
|
|
25
18
|
- 'lib/generators/hyrax/**/*'
|
|
26
19
|
|
|
27
|
-
Lint/AmbiguousBlockAssociation:
|
|
28
|
-
Enabled: false
|
|
29
|
-
|
|
30
|
-
Metrics/LineLength:
|
|
31
|
-
Max: 200
|
|
32
|
-
|
|
33
|
-
Metrics/AbcSize:
|
|
34
|
-
Max: 26
|
|
35
|
-
|
|
36
20
|
Metrics/BlockLength:
|
|
37
21
|
ExcludedMethods: ['included']
|
|
38
22
|
Exclude:
|
|
@@ -47,12 +31,9 @@ Metrics/BlockLength:
|
|
|
47
31
|
- 'lib/tasks/*.rake'
|
|
48
32
|
- 'spec/**/*.rb'
|
|
49
33
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Naming/FileName: # https://github.com/bbatsov/rubocop/issues/2973
|
|
54
|
-
Exclude:
|
|
55
|
-
- 'Gemfile'
|
|
34
|
+
# Naming/FileName: # https://github.com/bbatsov/rubocop/issues/2973
|
|
35
|
+
# Exclude:
|
|
36
|
+
# - 'Gemfile'
|
|
56
37
|
|
|
57
38
|
Style/AsciiComments:
|
|
58
39
|
Enabled: false
|
|
@@ -76,21 +57,9 @@ Style/NumericPredicate:
|
|
|
76
57
|
Style/SymbolArray:
|
|
77
58
|
Enabled: false
|
|
78
59
|
|
|
79
|
-
Style/WordArray:
|
|
80
|
-
Enabled: false
|
|
81
|
-
|
|
82
|
-
Style/RegexpLiteral:
|
|
83
|
-
Enabled: false
|
|
84
|
-
|
|
85
|
-
Style/StringLiterals:
|
|
86
|
-
Enabled: false
|
|
87
|
-
|
|
88
60
|
Style/ClassAndModuleChildren:
|
|
89
61
|
Enabled: false
|
|
90
62
|
|
|
91
|
-
Style/Documentation:
|
|
92
|
-
Enabled: false
|
|
93
|
-
|
|
94
63
|
Style/SingleLineBlockParams:
|
|
95
64
|
Enabled: false
|
|
96
65
|
|
|
@@ -98,9 +67,6 @@ Style/ZeroLengthPredicate:
|
|
|
98
67
|
Exclude:
|
|
99
68
|
- 'app/controllers/hyrax/file_sets_controller.rb'
|
|
100
69
|
|
|
101
|
-
Rails:
|
|
102
|
-
Enabled: true
|
|
103
|
-
|
|
104
70
|
Rails/ApplicationJob:
|
|
105
71
|
Enabled: false
|
|
106
72
|
|
|
@@ -141,12 +107,9 @@ RSpec/DescribeClass:
|
|
|
141
107
|
- 'spec/tasks/rake_spec.rb'
|
|
142
108
|
- 'spec/views/**/*'
|
|
143
109
|
|
|
144
|
-
RSpec/
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
# By default RSpec/MessageSpies has the following:
|
|
148
|
-
# Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
|
|
149
|
-
# The default assumes EnforcedStyle is 'have_received'. Most of our specs are 'receive'
|
|
110
|
+
# # By default RSpec/MessageSpies has the following:
|
|
111
|
+
# # Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
|
|
112
|
+
# # The default assumes EnforcedStyle is 'have_received'. Most of our specs are 'receive'
|
|
150
113
|
RSpec/MessageSpies:
|
|
151
114
|
Enabled: false
|
|
152
115
|
|
|
@@ -163,9 +126,6 @@ RSpec/LetSetup:
|
|
|
163
126
|
RSpec/MessageExpectation:
|
|
164
127
|
Enabled: false
|
|
165
128
|
|
|
166
|
-
RSpec/MultipleExpectations:
|
|
167
|
-
Enabled: false
|
|
168
|
-
|
|
169
129
|
RSpec/NestedGroups:
|
|
170
130
|
Enabled: false
|
|
171
131
|
|
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/downloads_controller.rb'
|
|
9
10
|
- 'app/controllers/hyrax/file_sets_controller.rb'
|
|
10
11
|
- 'app/forms/hyrax/forms/permission_template_form.rb'
|
|
11
12
|
- 'app/presenters/hyrax/work_show_presenter.rb'
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
|
@@ -10,6 +10,7 @@ group :development, :test do
|
|
|
10
10
|
gem "simplecov", require: false
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
# rubocop:disable Bundler/DuplicatedGem
|
|
13
14
|
# BEGIN ENGINE_CART BLOCK
|
|
14
15
|
# engine_cart: 1.1.0
|
|
15
16
|
# engine_cart stanza: 0.10.0
|
|
@@ -44,7 +45,6 @@ else
|
|
|
44
45
|
end
|
|
45
46
|
end
|
|
46
47
|
# END ENGINE_CART BLOCK
|
|
48
|
+
# rubocop:enable Bundler/DuplicatedGem
|
|
47
49
|
|
|
48
|
-
unless File.exist?(file)
|
|
49
|
-
eval_gemfile File.expand_path('spec/test_app_templates/Gemfile.extra', File.dirname(__FILE__))
|
|
50
|
-
end
|
|
50
|
+
eval_gemfile File.expand_path('spec/test_app_templates/Gemfile.extra', File.dirname(__FILE__)) unless File.exist?(file)
|
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.beta2__. 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
|
|
|
@@ -122,6 +122,8 @@ On OSX, you can use Homebrew to install ffmpeg:
|
|
|
122
122
|
|
|
123
123
|
Otherwise, to compile ffmpeg yourself, see the [ffmpeg compilation guide](https://trac.ffmpeg.org/wiki/CompilationGuide).
|
|
124
124
|
|
|
125
|
+
Once ffmpeg has been installed, enable transcoding by setting `config.enable_ffmpeg = true` in `config/initializers/hyrax.rb`. You may also configure the location of ffmpeg using `config.ffmpeg_path`.
|
|
126
|
+
|
|
125
127
|
## Environments
|
|
126
128
|
|
|
127
129
|
Note here that the following commands assume you're setting up Hyrax in a development environment (using the Rails built-in development environment). If you're setting up a production or production-like environment, you may wish to tell Rails that by prepending `RAILS_ENV=production` to the commands that follow, e.g., `rails`, `rake`, `bundle`, and so on.
|
|
@@ -160,7 +162,7 @@ NOTE: The steps need to be done in order to create a new Hyrax based app.
|
|
|
160
162
|
Generate a new Rails application using the template.
|
|
161
163
|
|
|
162
164
|
```
|
|
163
|
-
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.beta2/template.rb
|
|
164
166
|
```
|
|
165
167
|
|
|
166
168
|
Generating a new Rails application using Hyrax's template above takes cares of a number of steps for you, including:
|
|
@@ -147,7 +147,6 @@ module Hyrax
|
|
|
147
147
|
# Must clear the fileset from the thumbnail_id, representative_id and rendering_ids fields on the work
|
|
148
148
|
# and force it to be re-solrized.
|
|
149
149
|
# Although ActiveFedora clears the children nodes it leaves those fields in Solr populated.
|
|
150
|
-
# rubocop:disable Metrics/AbcSize
|
|
151
150
|
# rubocop:disable Metrics/CyclomaticComplexity
|
|
152
151
|
def unlink_from_work
|
|
153
152
|
work = file_set.parent
|
|
@@ -114,9 +114,7 @@ module Hyrax
|
|
|
114
114
|
|
|
115
115
|
def apply_visibility(env, intention)
|
|
116
116
|
result = apply_lease(env, intention) && apply_embargo(env, intention)
|
|
117
|
-
if env.attributes[:visibility]
|
|
118
|
-
env.curation_concern.visibility = env.attributes[:visibility]
|
|
119
|
-
end
|
|
117
|
+
env.curation_concern.visibility = env.attributes[:visibility] if env.attributes[:visibility]
|
|
120
118
|
result
|
|
121
119
|
end
|
|
122
120
|
|
|
@@ -2,6 +2,9 @@ module Hyrax
|
|
|
2
2
|
module Actors
|
|
3
3
|
# This is a proxy for the model specific actor
|
|
4
4
|
class ModelActor < AbstractActor
|
|
5
|
+
# See: https://github.com/bbatsov/rubocop/issues/5393
|
|
6
|
+
# rubocop:disable Rails/Delegate
|
|
7
|
+
|
|
5
8
|
# @param [Hyrax::Actors::Environment] env
|
|
6
9
|
# @return [Boolean] true if update was successful
|
|
7
10
|
def update(env)
|
|
@@ -19,6 +22,7 @@ module Hyrax
|
|
|
19
22
|
def destroy(env)
|
|
20
23
|
model_actor(env).destroy(env)
|
|
21
24
|
end
|
|
25
|
+
# rubocop:enable Rails/Delegate
|
|
22
26
|
|
|
23
27
|
private
|
|
24
28
|
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
//= require hyrax/relationships
|
|
87
87
|
//= require hyrax/select_work_type
|
|
88
88
|
//= require hyrax/collections
|
|
89
|
-
//= require hyrax/collections_forms
|
|
90
89
|
//= require hyrax/collection_types
|
|
91
90
|
//= require hyrax/select_collection_type
|
|
92
91
|
//= require hydra-editor/hydra-editor
|
|
@@ -100,6 +99,7 @@
|
|
|
100
99
|
//= require hyrax/thumbnail_select
|
|
101
100
|
//= require hyrax/batch_select
|
|
102
101
|
//= require hyrax/tabbed_form
|
|
102
|
+
//= require hyrax/turbolinks_events
|
|
103
103
|
|
|
104
104
|
// this needs to be after batch_select so that the form ids get setup correctly
|
|
105
105
|
//= require hyrax/batch_edit
|
|
@@ -46,7 +46,7 @@ Hyrax = {
|
|
|
46
46
|
// The Collection edit page
|
|
47
47
|
collectionEditor: function() {
|
|
48
48
|
var CollectionControls = require('hyrax/collections/editor');
|
|
49
|
-
var controls = new CollectionControls($('#
|
|
49
|
+
var controls = new CollectionControls($('#collection_permissions'));
|
|
50
50
|
},
|
|
51
51
|
|
|
52
52
|
// Collection types
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Autocomplete from 'hyrax/autocomplete'
|
|
2
|
+
|
|
1
3
|
/** Class for authority selection on an input field */
|
|
2
4
|
export default class AuthoritySelect {
|
|
3
5
|
/**
|
|
@@ -6,8 +8,7 @@ export default class AuthoritySelect {
|
|
|
6
8
|
* @param {string} selectBox - The selector for the select box
|
|
7
9
|
* @param {string} inputField - The selector for the input field
|
|
8
10
|
*/
|
|
9
|
-
constructor(
|
|
10
|
-
this.editor = editor
|
|
11
|
+
constructor(options) {
|
|
11
12
|
this.selectBox = options.selectBox
|
|
12
13
|
this.inputField = options.inputField
|
|
13
14
|
this.selectBoxChange();
|
|
@@ -24,8 +25,10 @@ export default class AuthoritySelect {
|
|
|
24
25
|
var _this2 = this
|
|
25
26
|
$(selectBox).on('change', function(data) {
|
|
26
27
|
var selectBoxValue = $(this).val();
|
|
27
|
-
$(inputField).each(function (data) {
|
|
28
|
-
|
|
28
|
+
$(inputField).each(function (data) {
|
|
29
|
+
$(this).data('autocomplete-url', selectBoxValue);
|
|
30
|
+
_this2.setupAutocomplete()
|
|
31
|
+
});
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
34
|
|
|
@@ -35,11 +38,14 @@ export default class AuthoritySelect {
|
|
|
35
38
|
observeAddedElement() {
|
|
36
39
|
var selectBox = this.selectBox;
|
|
37
40
|
var inputField = this.inputField;
|
|
41
|
+
var _this2 = this
|
|
38
42
|
|
|
39
43
|
var observer = new MutationObserver((mutations) => {
|
|
40
44
|
mutations.forEach((mutation) => {
|
|
41
|
-
$(inputField).each(function (data) {
|
|
42
|
-
|
|
45
|
+
$(inputField).each(function (data) {
|
|
46
|
+
$(this).data('autocomplete-url', $(selectBox).val())
|
|
47
|
+
_this2.setupAutocomplete();
|
|
48
|
+
});
|
|
43
49
|
});
|
|
44
50
|
});
|
|
45
51
|
|
|
@@ -51,6 +57,8 @@ export default class AuthoritySelect {
|
|
|
51
57
|
* intialize the Hyrax autocomplete with the fields that you are using
|
|
52
58
|
*/
|
|
53
59
|
setupAutocomplete() {
|
|
54
|
-
this.
|
|
60
|
+
var inputField = $(this.inputField);
|
|
61
|
+
var autocomplete = new Autocomplete()
|
|
62
|
+
autocomplete.setup(inputField, inputField.data('autocomplete'), inputField.data('autocompleteUrl'))
|
|
55
63
|
}
|
|
56
64
|
}
|
|
@@ -1,11 +1,59 @@
|
|
|
1
1
|
Blacklight.onLoad(function () {
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Post modal data via Ajax to avoid nesting <forms> in edit collections tabs screen
|
|
5
|
+
* @param {string} url URL where to submit the AJAX request
|
|
6
|
+
* @param {string} type The type of network request: 'POST', 'DELETE', etc.
|
|
7
|
+
* @param {object} data Data object to send with network request. Should default to {}
|
|
8
|
+
* @param {jQuery object} $self Reference to the jQuery context ie. $(this) of calling statemnt
|
|
9
|
+
* @return {void}
|
|
10
|
+
*/
|
|
11
|
+
function submitModalAjax(url, type, data, $self) {
|
|
12
|
+
$.ajax({
|
|
13
|
+
type: type,
|
|
14
|
+
url: url,
|
|
15
|
+
data: data
|
|
16
|
+
}).done(function(response) {
|
|
17
|
+
}).fail(function(err) {
|
|
18
|
+
var alertNode = buildModalErrorAlert(err);
|
|
19
|
+
var $alert = $self.closest('.modal').find('.modal-ajax-alert');
|
|
20
|
+
$alert.html(alertNode);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* HTML for ajax error alert message, in case the AJAX request fails
|
|
26
|
+
* @param {object} err AJAX response object
|
|
27
|
+
* @return {string} The constructed HTML alert string
|
|
28
|
+
*/
|
|
29
|
+
function buildModalErrorAlert(err) {
|
|
30
|
+
var message = (err.responseText ? err.responseText : 'An unknown error has occurred');
|
|
31
|
+
var elHtml = '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><span class="message">' + message + '</span></div>';
|
|
32
|
+
return elHtml;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Handle delete collection submit button click from within a generic modal
|
|
37
|
+
* @return {void}
|
|
38
|
+
*/
|
|
39
|
+
function handleModalDeleteCollection() {
|
|
40
|
+
var $self = $(this),
|
|
41
|
+
$modal = $self.closest('.modal'),
|
|
42
|
+
url = $modal.data('postDeleteUrl'),
|
|
43
|
+
data = {};
|
|
44
|
+
if (url.length === 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
$self.prop('disabled', true);
|
|
48
|
+
submitModalAjax(url, 'DELETE', data, $self);
|
|
49
|
+
}
|
|
50
|
+
|
|
3
51
|
/**
|
|
4
52
|
* Sync collection data attributes to the singular instance of the modal so it knows what data to post
|
|
5
53
|
* @param {string} modalId - The id of modal to target, ie. #add_collection_modal
|
|
6
54
|
* @param {[string]} dataAttributes - An string array of "data-xyz" data attributes WITHOUT
|
|
7
55
|
* the "data-" prefix. ie. ['id', 'some-var']
|
|
8
|
-
* @param {jquery Object} $
|
|
56
|
+
* @param {jquery Object} $dataEl - jQuery object reference which has values of data attributes we're copying over
|
|
9
57
|
* @return {void}
|
|
10
58
|
*/
|
|
11
59
|
function addDataAttributesToModal(modalId, dataAttributes, $dataEl) {
|
|
@@ -24,7 +72,7 @@ Blacklight.onLoad(function () {
|
|
|
24
72
|
var options = collsHash.map(function(col) {
|
|
25
73
|
return '<option value="' + col.id + '">' + col.title_first + '</option>';
|
|
26
74
|
});
|
|
27
|
-
markup = options.join('');
|
|
75
|
+
var markup = options.join('');
|
|
28
76
|
return markup;
|
|
29
77
|
}
|
|
30
78
|
|
|
@@ -66,7 +114,7 @@ Blacklight.onLoad(function () {
|
|
|
66
114
|
|
|
67
115
|
// Disable the submit button in modal by default
|
|
68
116
|
$('#add-to-collection-modal').find('.modal-submit-button').prop('disabled', true);
|
|
69
|
-
|
|
117
|
+
|
|
70
118
|
// Show modal
|
|
71
119
|
$('#add-to-collection-modal').modal('show');
|
|
72
120
|
}
|
|
@@ -104,6 +152,31 @@ Blacklight.onLoad(function () {
|
|
|
104
152
|
$(modalId).modal('show');
|
|
105
153
|
}
|
|
106
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Generically disable modal submit buttons unless their select element
|
|
157
|
+
* has a valid value.
|
|
158
|
+
*
|
|
159
|
+
* To Use:
|
|
160
|
+
* 1.) Put the '.disable-unless-selected' class on the '.modal' element you wish to protect.
|
|
161
|
+
* 2.) Add the 'disabled' attribute to your protected submit button ie. <button disabled ...>.
|
|
162
|
+
* 3.) Put the '.modal-submit-button' class on whichever button you wish to disable for an invalid
|
|
163
|
+
* <select> value ie. <button disabled class="... modal-submit-button" ...>
|
|
164
|
+
*
|
|
165
|
+
* @return {void}
|
|
166
|
+
*/
|
|
167
|
+
$('.modal.disable-unless-selected select').on('change', function() {
|
|
168
|
+
var selectValue = $(this).val(),
|
|
169
|
+
emptyValues = ['', 'none'],
|
|
170
|
+
selectHasAValue = emptyValues.indexOf(selectValue) === -1,
|
|
171
|
+
$submitButton = $(this).parents('.modal').find('.modal-submit-button');
|
|
172
|
+
|
|
173
|
+
$submitButton.prop('disabled', !selectHasAValue);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Add click listeners for collections buttons which initiate modal action windows
|
|
177
|
+
$('.add-to-collection').on('click', handleAddToCollection);
|
|
178
|
+
$('.delete-collection-button').on('click', handleDeleteCollection);
|
|
179
|
+
|
|
107
180
|
// change the action based which collection is selected
|
|
108
181
|
// This expects the form to have a path that includes the string 'collection_replace_id'
|
|
109
182
|
$('[data-behavior="updates-collection"]').on('click', function() {
|
|
@@ -115,18 +188,46 @@ Blacklight.onLoad(function () {
|
|
|
115
188
|
form.append('<input type="hidden" value="add" name="collection[members]"></input>');
|
|
116
189
|
});
|
|
117
190
|
|
|
118
|
-
|
|
119
|
-
// Set up click listeners for collections buttons which initiate modal action windows
|
|
120
|
-
$('.add-to-collection').on('click', handleAddToCollection);
|
|
121
|
-
$('.delete-collection-button').on('click', handleDeleteCollection);
|
|
122
|
-
|
|
123
|
-
|
|
124
191
|
// Display access deny for edit request.
|
|
125
192
|
$('#documents').find('.edit-collection-deny-button').on('click', function (e) {
|
|
126
193
|
e.preventDefault();
|
|
127
194
|
$('#collections-to-edit-deny-modal').modal('show');
|
|
128
195
|
});
|
|
129
196
|
|
|
197
|
+
// Remove this parent collection list button clicked
|
|
198
|
+
$('#parent-collections-wrapper')
|
|
199
|
+
.find('.remove-from-collection-button')
|
|
200
|
+
.on('click', function (e) {
|
|
201
|
+
var $dataEl = $(this).closest('li'),
|
|
202
|
+
modalId = '#collection-remove-from-collection-modal';
|
|
203
|
+
|
|
204
|
+
addDataAttributesToModal(modalId, ['id', 'parent-id', 'post-url'], $dataEl);
|
|
205
|
+
$(modalId).modal('show');
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// Remove this sub-collection list button clicked
|
|
209
|
+
$('#sub-collections-wrapper')
|
|
210
|
+
.find('.remove-subcollection-button')
|
|
211
|
+
.on('click', function (e) {
|
|
212
|
+
var $dataEl = $(this).closest('li'),
|
|
213
|
+
modalId = '#collection-remove-subcollection-modal';
|
|
214
|
+
|
|
215
|
+
addDataAttributesToModal(modalId, ['id', 'parent-id', 'post-url'], $dataEl);
|
|
216
|
+
$(modalId).modal('show');
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// Remove collection from list modal "Submit/Remove" button clicked
|
|
220
|
+
$('.modal-button-remove-collection').on('click', function(e) {
|
|
221
|
+
var $self = $(this),
|
|
222
|
+
$modal = $self.closest('.modal'),
|
|
223
|
+
url = $modal.data('postUrl'),
|
|
224
|
+
data = {};
|
|
225
|
+
if (url.length === 0) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
$self.prop('disabled', true);
|
|
229
|
+
submitModalAjax(url, 'POST', data, $self);
|
|
230
|
+
});
|
|
130
231
|
|
|
131
232
|
// Delete selected collections button click
|
|
132
233
|
$('#delete-collections-button').on('click', function () {
|
|
@@ -174,4 +275,82 @@ Blacklight.onLoad(function () {
|
|
|
174
275
|
$("#more-parent-collections").hide();
|
|
175
276
|
$("#show-more-parent-collections").show();
|
|
176
277
|
});
|
|
278
|
+
|
|
279
|
+
// Add to collection modal form post
|
|
280
|
+
$('#add-to-collection-modal').find('.modal-add-button').on('click', function (e) {
|
|
281
|
+
var $self = $(this),
|
|
282
|
+
$modal = $self.closest('.modal'),
|
|
283
|
+
url = $modal.data('postUrl'),
|
|
284
|
+
parentId = $modal.find('[name="parent_id"]').val(),
|
|
285
|
+
data = {
|
|
286
|
+
parent_id: parentId,
|
|
287
|
+
source: $self.data('source')
|
|
288
|
+
};
|
|
289
|
+
if (url.length === 0) {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
submitModalAjax(url, 'POST', data, $self);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// Handle delete collection modal submit button click event
|
|
296
|
+
['#collection-to-delete-modal', '#collection-empty-to-delete-modal'].forEach(function(id) {
|
|
297
|
+
$(id).find('.modal-delete-button').on('click', handleModalDeleteCollection);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// Add sub collection to collection form post
|
|
301
|
+
$('[id^="add-subcollection-modal-"]').find('.modal-add-button').on('click', function (e) {
|
|
302
|
+
var url = $(this).data('postUrl'),
|
|
303
|
+
childId = $(this).closest('.modal').find('[name="child_id"]').val(),
|
|
304
|
+
data = {
|
|
305
|
+
child_id: childId,
|
|
306
|
+
source: $(this).data('source')
|
|
307
|
+
};
|
|
308
|
+
if (url.length === 0) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
submitModalAjax(url, 'POST', data, $(this));
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
// Handle add a subcollection button click on the collections show page
|
|
316
|
+
$('.sub-collections-wrapper button.add-subcollection').on('click', function (e) {
|
|
317
|
+
$('#add-subcollection-modal-' + $(this).data('presenterId')).modal('show');
|
|
318
|
+
});
|
|
319
|
+
|
|
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
|
+
});
|
|
177
356
|
});
|