curation_concerns 0.1.0
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 +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +18 -0
- data/Gemfile +31 -0
- data/LICENSE.txt +15 -0
- data/README.md +46 -0
- data/RELEASING.md +2 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/app/assets/images/default.png +0 -0
- data/app/assets/images/nope.png +0 -0
- data/app/assets/javascripts/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/.gitkeep +0 -0
- data/app/assets/javascripts/curation_concerns/application.js +18 -0
- data/app/assets/javascripts/curation_concerns/browse_everything_implement.js +7 -0
- data/app/assets/javascripts/curation_concerns/curation_concerns.js +28 -0
- data/app/assets/javascripts/curation_concerns/embargoes.js +17 -0
- data/app/assets/javascripts/curation_concerns/facet_mine.js +22 -0
- data/app/assets/javascripts/curation_concerns/help_modal.js +36 -0
- data/app/assets/javascripts/curation_concerns/link_groups.js.coffee +123 -0
- data/app/assets/javascripts/curation_concerns/link_users.js.coffee +126 -0
- data/app/assets/javascripts/curation_concerns/proxy_rights.js.coffee +95 -0
- data/app/assets/javascripts/curation_concerns/proxy_submission.js +23 -0
- data/app/assets/javascripts/curation_concerns/select_works.js.coffee +20 -0
- data/app/assets/javascripts/modernizr.js +3 -0
- data/app/assets/stylesheets/curation_concerns/_curation_concerns.scss +9 -0
- data/app/assets/stylesheets/curation_concerns/_global-variables.scss +5 -0
- data/app/assets/stylesheets/curation_concerns/_modules.scss +13 -0
- data/app/assets/stylesheets/curation_concerns/_positioning.scss +138 -0
- data/app/assets/stylesheets/curation_concerns/_theme.scss +46 -0
- data/app/assets/stylesheets/curation_concerns/_typography.scss +137 -0
- data/app/assets/stylesheets/curation_concerns/_variables_bootstrap.scss +7 -0
- data/app/assets/stylesheets/curation_concerns/downloads.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/help_requests.scss +3 -0
- data/app/assets/stylesheets/curation_concerns/modules/accessibility.scss +50 -0
- data/app/assets/stylesheets/curation_concerns/modules/accordion.scss +33 -0
- data/app/assets/stylesheets/curation_concerns/modules/attributes.scss +31 -0
- data/app/assets/stylesheets/curation_concerns/modules/classify_work.scss +100 -0
- data/app/assets/stylesheets/curation_concerns/modules/embargoes.scss +15 -0
- data/app/assets/stylesheets/curation_concerns/modules/emphatic_action_area.scss +14 -0
- data/app/assets/stylesheets/curation_concerns/modules/forms.scss +116 -0
- data/app/assets/stylesheets/curation_concerns/modules/multi_value_fields.scss +52 -0
- data/app/assets/stylesheets/curation_concerns/modules/pagination.scss +4 -0
- data/app/assets/stylesheets/curation_concerns/modules/search_results.scss +55 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_actions.scss +53 -0
- data/app/assets/stylesheets/curation_concerns/modules/site_search.scss +46 -0
- data/app/controllers/catalog_controller.rb +3 -0
- data/app/controllers/collections_controller.rb +3 -0
- data/app/controllers/concerns/curation_concerns/application_controller_behavior.rb +28 -0
- data/app/controllers/concerns/curation_concerns/catalog_controller.rb +321 -0
- data/app/controllers/concerns/curation_concerns/collections_controller_behavior.rb +76 -0
- data/app/controllers/concerns/curation_concerns/curation_concern_controller.rb +125 -0
- data/app/controllers/concerns/curation_concerns/download_behavior.rb +60 -0
- data/app/controllers/concerns/curation_concerns/embargoes_controller_behavior.rb +44 -0
- data/app/controllers/concerns/curation_concerns/generic_files_controller_behavior.rb +149 -0
- data/app/controllers/concerns/curation_concerns/leases_controller_behavior.rb +36 -0
- data/app/controllers/concerns/curation_concerns/manages_embargoes.rb +26 -0
- data/app/controllers/concerns/curation_concerns/parent_container.rb +33 -0
- data/app/controllers/concerns/curation_concerns/themed_layout_controller.rb +31 -0
- data/app/controllers/concerns/curation_concerns/without_namespace.rb +15 -0
- data/app/controllers/curation_concerns/application_controller.rb +7 -0
- data/app/controllers/curation_concerns/classify_concerns_controller.rb +35 -0
- data/app/controllers/curation_concerns/generic_files_controller.rb +13 -0
- data/app/controllers/curation_concerns/permissions_controller.rb +19 -0
- data/app/controllers/downloads_controller.rb +4 -0
- data/app/controllers/embargoes_controller.rb +5 -0
- data/app/controllers/leases_controller.rb +5 -0
- data/app/controllers/registrations_controller.rb +20 -0
- data/app/controllers/sessions_controller.rb +4 -0
- data/app/datastreams/curation_concerns/generic_work_rdf_properties.rb +57 -0
- data/app/datastreams/generic_work_metadata.rb +3 -0
- data/app/forms/curation_concerns/forms/collection_edit_form.rb +17 -0
- data/app/forms/curation_concerns/forms/generic_file_edit_form.rb +15 -0
- data/app/forms/curation_concerns/forms/generic_work_edit_form.rb +9 -0
- data/app/helpers/curation_concerns/ability_helper.rb +46 -0
- data/app/helpers/curation_concerns/attribute_helper.rb +67 -0
- data/app/helpers/curation_concerns/catalog_helper.rb +38 -0
- data/app/helpers/curation_concerns/collections_helper.rb +63 -0
- data/app/helpers/curation_concerns/embargo_helper.rb +17 -0
- data/app/helpers/curation_concerns/generic_file_helper.rb +19 -0
- data/app/helpers/curation_concerns/lease_helper.rb +18 -0
- data/app/helpers/curation_concerns/main_app_helpers.rb +13 -0
- data/app/helpers/curation_concerns/render_constraints_helper.rb +42 -0
- data/app/helpers/curation_concerns/search_paths_helper.rb +13 -0
- data/app/helpers/curation_concerns/thumbnail_helper.rb +11 -0
- data/app/helpers/curation_concerns/title_helper.rb +23 -0
- data/app/helpers/curation_concerns/url_helper.rb +29 -0
- data/app/presenters/curation_concerns/collection_presenter.rb +40 -0
- data/app/presenters/curation_concerns/generic_file_presenter.rb +14 -0
- data/app/presenters/curation_concerns/generic_work_presenter.rb +13 -0
- data/app/search_builders/curation_concerns/search_builder.rb +49 -0
- data/app/services/curation_concerns/curation_concern.rb +14 -0
- data/app/services/curation_concerns/embargo_service.rb +26 -0
- data/app/services/curation_concerns/lease_service.rb +23 -0
- data/app/views/catalog/_action_menu_partials/_collection.html.erb +27 -0
- data/app/views/catalog/_action_menu_partials/_default.html.erb +27 -0
- data/app/views/catalog/_document.html.erb +3 -0
- data/app/views/catalog/_document_list.html.erb +5 -0
- data/app/views/catalog/_home_text.html.erb +8 -0
- data/app/views/catalog/_index_default.html.erb +17 -0
- data/app/views/catalog/_index_header_list_default.html.erb +8 -0
- data/app/views/catalog/_navbar.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +22 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/index.html.erb +47 -0
- data/app/views/collections/_add_to_collection_modal.html.erb +15 -0
- data/app/views/collections/_batch_edits_actions.html.erb +3 -0
- data/app/views/collections/_button_for_creating_empty_collection.html.erb +3 -0
- data/app/views/collections/_collection.html.erb +1 -0
- data/app/views/collections/_dashboard_document_list.html.erb +6 -0
- data/app/views/collections/_document_list.html.erb +7 -0
- data/app/views/collections/_edit_actions.html.erb +5 -0
- data/app/views/collections/_edit_descriptions.html.erb +20 -0
- data/app/views/collections/_form.html.erb +26 -0
- data/app/views/collections/_form_additional_information.html.erb +6 -0
- data/app/views/collections/_form_for_select_collection.html.erb +34 -0
- data/app/views/collections/_form_permission.html.erb +36 -0
- data/app/views/collections/_form_representative_image.html.erb +13 -0
- data/app/views/collections/_form_required_information.html.erb +11 -0
- data/app/views/collections/_form_to_add_member.html.erb +21 -0
- data/app/views/collections/_identifier_and_action.html.erb +15 -0
- data/app/views/collections/_media_display.html.erb +1 -0
- data/app/views/collections/_paginate.html.erb +6 -0
- data/app/views/collections/_search_collection_dashboard_form.html.erb +10 -0
- data/app/views/collections/_show_actions.html.erb +8 -0
- data/app/views/collections/_show_descriptions.html.erb +10 -0
- data/app/views/collections/_show_fields.html.erb +0 -0
- data/app/views/collections/_single_item_action_fields.html.erb +6 -0
- data/app/views/collections/_sort_and_per_page.html.erb +29 -0
- data/app/views/collections/_view_type_group.html.erb +13 -0
- data/app/views/collections/edit.html.erb +17 -0
- data/app/views/collections/show.html.erb +24 -0
- data/app/views/curation_concerns/base/_attributes.html.erb +25 -0
- data/app/views/curation_concerns/base/_collections.html.erb +26 -0
- data/app/views/curation_concerns/base/_form.html.erb +25 -0
- data/app/views/curation_concerns/base/_form_additional_information.html.erb +7 -0
- data/app/views/curation_concerns/base/_form_content_license.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_descriptive_fields.erb +11 -0
- data/app/views/curation_concerns/base/_form_editors.html.erb +15 -0
- data/app/views/curation_concerns/base/_form_files_and_links.html.erb +23 -0
- data/app/views/curation_concerns/base/_form_permission.html.erb +52 -0
- data/app/views/curation_concerns/base/_form_permission_embargo.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_lease.html.erb +6 -0
- data/app/views/curation_concerns/base/_form_permission_under_embargo.html.erb +16 -0
- data/app/views/curation_concerns/base/_form_permission_under_lease.html.erb +18 -0
- data/app/views/curation_concerns/base/_form_representative_image.html.erb +13 -0
- data/app/views/curation_concerns/base/_form_required_information.html.erb +11 -0
- data/app/views/curation_concerns/base/_form_supplementary_fields.html.erb +15 -0
- data/app/views/curation_concerns/base/_legally_binding_text.html.erb +33 -0
- data/app/views/curation_concerns/base/_related_files.html.erb +24 -0
- data/app/views/curation_concerns/base/_representative_media.html.erb +8 -0
- data/app/views/curation_concerns/base/edit.html.erb +13 -0
- data/app/views/curation_concerns/base/new.html.erb +12 -0
- data/app/views/curation_concerns/base/show.html.erb +21 -0
- data/app/views/curation_concerns/base/unauthorized.html.erb +3 -0
- data/app/views/curation_concerns/classify_concerns/new.html.erb +25 -0
- data/app/views/curation_concerns/collections/_form_additional_information.html.erb +6 -0
- data/app/views/curation_concerns/generic_files/_actions.html.erb +16 -0
- data/app/views/curation_concerns/generic_files/_form.html.erb +35 -0
- data/app/views/curation_concerns/generic_files/_generic_file.html.erb +12 -0
- data/app/views/curation_concerns/generic_files/_media_display.html.erb +19 -0
- data/app/views/curation_concerns/generic_files/edit.html.erb +5 -0
- data/app/views/curation_concerns/generic_files/jq_upload.json.jbuilder +8 -0
- data/app/views/curation_concerns/generic_files/show.html.erb +15 -0
- data/app/views/curation_concerns/permissions/confirm.html.erb +21 -0
- data/app/views/embargoes/_embargo_history.html.erb +7 -0
- data/app/views/embargoes/_list_active_embargoes.html.erb +16 -0
- data/app/views/embargoes/_list_deactivated_embargoes.html.erb +10 -0
- data/app/views/embargoes/_list_expired_active_embargoes.html.erb +44 -0
- data/app/views/embargoes/edit.html.erb +43 -0
- data/app/views/embargoes/index.html.erb +18 -0
- data/app/views/layouts/boilerplate.html.erb +22 -0
- data/app/views/layouts/curation_concerns/1_column.html.erb +11 -0
- data/app/views/layouts/curation_concerns/catalog.html.erb +37 -0
- data/app/views/layouts/curation_concerns.html.erb +22 -0
- data/app/views/leases/_lease_history.html.erb +7 -0
- data/app/views/leases/_list_active_leases.html.erb +16 -0
- data/app/views/leases/_list_deactivated_leases.html.erb +4 -0
- data/app/views/leases/_list_expired_active_leases.html.erb +38 -0
- data/app/views/leases/edit.html.erb +43 -0
- data/app/views/leases/index.html.erb +18 -0
- data/app/views/shared/_add_content.html.erb +32 -0
- data/app/views/shared/_brand_bar.html.erb +10 -0
- data/app/views/shared/_flash_message.html.erb +17 -0
- data/app/views/shared/_footer.html.erb +10 -0
- data/app/views/shared/_ga.html.erb +6 -0
- data/app/views/shared/_header.html.erb +12 -0
- data/app/views/shared/_my_actions.html.erb +21 -0
- data/app/views/shared/_site_actions.html.erb +7 -0
- data/app/views/shared/_site_search.html.erb +12 -0
- data/app/views/shared/_title_bar.html.erb +16 -0
- data/app/workers/visibility_copy_worker.rb +30 -0
- data/config/initializers/simple_form.rb +31 -0
- data/config/locales/curation_concerns.en.yml +96 -0
- data/config/routes.rb +4 -0
- data/curation_concerns-models/.gitignore +17 -0
- data/curation_concerns-models/Gemfile +4 -0
- data/curation_concerns-models/LICENSE.md +177 -0
- data/curation_concerns-models/README.md +42 -0
- data/curation_concerns-models/Rakefile +1 -0
- data/curation_concerns-models/app/actors/concerns/curation_concerns/manages_embargoes_actor.rb +99 -0
- data/curation_concerns-models/app/actors/curation_concerns/base_actor.rb +90 -0
- data/curation_concerns-models/app/actors/curation_concerns/generic_file_actor.rb +150 -0
- data/curation_concerns-models/app/actors/curation_concerns/work_actor_behavior.rb +88 -0
- data/curation_concerns-models/app/jobs/active_fedora_id_based_job.rb +22 -0
- data/curation_concerns-models/app/jobs/active_fedora_pid_based_job.rb +6 -0
- data/curation_concerns-models/app/jobs/audit_job.rb +58 -0
- data/curation_concerns-models/app/jobs/characterize_job.rb +11 -0
- data/curation_concerns-models/app/jobs/copy_permissions_job.rb +24 -0
- data/curation_concerns-models/app/jobs/create_derivatives_job.rb +15 -0
- data/curation_concerns-models/app/jobs/import_url_job.rb +56 -0
- data/curation_concerns-models/app/jobs/ingest_local_file_job.rb +48 -0
- data/curation_concerns-models/app/jobs/resolrize_job.rb +9 -0
- data/curation_concerns-models/app/models/checksum_audit_log.rb +21 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/ability.rb +34 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/basic_metadata.rb +87 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/collection_behavior.rb +47 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/belongs_to_works.rb +53 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/characterization.rb +89 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/content.rb +8 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/export.rb +343 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/full_text_indexing.rb +12 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/indexing.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file/versions.rb +16 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file.rb +5 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_file_behavior.rb +44 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/generic_work_behavior.rb +38 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/has_representative.rb +14 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/human_readable_type.rb +23 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/readable.rb +19 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions/writable.rb +75 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/permissions.rb +7 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/serializers.rb +15 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/solr_document_behavior.rb +135 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/user.rb +65 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_basic_metadata.rb +98 -0
- data/curation_concerns-models/app/models/concerns/curation_concerns/with_generic_files.rb +29 -0
- data/curation_concerns-models/app/models/curation_concerns/classify_concern.rb +47 -0
- data/curation_concerns-models/app/models/curation_concerns/quick_classification_query.rb +31 -0
- data/curation_concerns-models/app/models/datastreams/fits_datastream.rb +148 -0
- data/curation_concerns-models/app/models/version_committer.rb +2 -0
- data/curation_concerns-models/app/services/curation_concerns/characterization_service.rb +71 -0
- data/curation_concerns-models/app/services/curation_concerns/full_text_extraction_service.rb +38 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_audit_service.rb +85 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_file_indexing_service.rb +14 -0
- data/curation_concerns-models/app/services/curation_concerns/generic_work_indexing_service.rb +16 -0
- data/curation_concerns-models/app/services/curation_concerns/noid.rb +23 -0
- data/curation_concerns-models/app/services/curation_concerns/repository_audit_service.rb +9 -0
- data/curation_concerns-models/app/services/curation_concerns/versioning_service.rb +27 -0
- data/curation_concerns-models/config/locales/curation_concerns.en.yml +6 -0
- data/curation_concerns-models/curation_concerns-models.gemspec +34 -0
- data/curation_concerns-models/lib/curation_concerns/messages.rb +66 -0
- data/curation_concerns-models/lib/curation_concerns/models/engine.rb +61 -0
- data/curation_concerns-models/lib/curation_concerns/models/resque.rb +36 -0
- data/curation_concerns-models/lib/curation_concerns/models/utils.rb +22 -0
- data/curation_concerns-models/lib/curation_concerns/models/version.rb +5 -0
- data/curation_concerns-models/lib/curation_concerns/models.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/abstract_migration_generator.rb +30 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/clamav_generator.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/fulltext_generator.rb +28 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/install_generator.rb +70 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/collection.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/app/models/generic_file.rb +4 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/clamav.rb +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/curation_concerns.rb +123 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/mime_types.rb +6 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis.yml +9 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/redis_config.rb +32 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque-pool.yml +1 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_admin.rb +10 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/config/resque_config.rb +5 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_checksum_audit_logs.rb +19 -0
- data/curation_concerns-models/lib/generators/curation_concerns/models/templates/migrations/create_version_committers.rb +15 -0
- data/curation_concerns-models/lib/tasks/curation_concerns-models_tasks.rake +75 -0
- data/curation_concerns-models/lib/tasks/migrate.rake +13 -0
- data/curation_concerns-models/lib/tasks/resque.rake +13 -0
- data/curation_concerns-models/lib/tasks/solr_reindex.rake +8 -0
- data/curation_concerns.gemspec +46 -0
- data/lib/curation_concerns/configuration.rb +74 -0
- data/lib/curation_concerns/controller_resource.rb +10 -0
- data/lib/curation_concerns/engine.rb +20 -0
- data/lib/curation_concerns/rails/routes.rb +76 -0
- data/lib/curation_concerns/spec_support.rb +10 -0
- data/lib/curation_concerns/version.rb +3 -0
- data/lib/curation_concerns.rb +8 -0
- data/lib/generators/curation_concerns/install_generator.rb +103 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.css.scss +3 -0
- data/lib/generators/curation_concerns/templates/curation_concerns.js +1 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_config.rb +2 -0
- data/lib/generators/curation_concerns/templates/curation_concerns_helper.rb +4 -0
- data/lib/generators/curation_concerns/work/USAGE +19 -0
- data/lib/generators/curation_concerns/work/templates/README +13 -0
- data/lib/generators/curation_concerns/work/templates/actor.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/actor_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/controller.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/controller_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/templates/model.rb.erb +7 -0
- data/lib/generators/curation_concerns/work/templates/model_spec.rb.erb +9 -0
- data/lib/generators/curation_concerns/work/work_generator.rb +78 -0
- data/solr_conf/conf/solrconfig.xml +223 -0
- data/spec/abilities/collection_abilities_spec.rb +48 -0
- data/spec/abilities/generic_file_abilities_spec.rb +62 -0
- data/spec/abilities/generic_work_abilities_spec.rb +58 -0
- data/spec/actors/curation_concerns/generic_file_actor_spec.rb +116 -0
- data/spec/actors/curation_concerns/manages_embargoes_actor_spec.rb +95 -0
- data/spec/actors/curation_concerns/work_actor_spec.rb +203 -0
- data/spec/controllers/catalog_controller_spec.rb +115 -0
- data/spec/controllers/curation_concerns/classify_concerns_controller_spec.rb +43 -0
- data/spec/controllers/curation_concerns/collections_controller_spec.rb +171 -0
- data/spec/controllers/curation_concerns/generic_files_controller_spec.rb +251 -0
- data/spec/controllers/curation_concerns/generic_works_controller_spec.rb +167 -0
- data/spec/controllers/curation_concerns/permissions_controller_spec.rb +29 -0
- data/spec/controllers/downloads_controller_spec.rb +51 -0
- data/spec/controllers/embargoes_controller_spec.rb +114 -0
- data/spec/controllers/leases_controller_spec.rb +94 -0
- data/spec/factories/collections.rb +15 -0
- data/spec/factories/create_curation_concern.rb +3 -0
- data/spec/factories/generic_files.rb +31 -0
- data/spec/factories/generic_works.rb +54 -0
- data/spec/factories/users.rb +28 -0
- data/spec/features/add_file_spec.rb +30 -0
- data/spec/features/collection_spec.rb +222 -0
- data/spec/features/create_work_spec.rb +43 -0
- data/spec/features/embargo_spec.rb +51 -0
- data/spec/features/lease_spec.rb +49 -0
- data/spec/features/update_file_spec.rb +32 -0
- data/spec/features/work_generator_spec.rb +58 -0
- data/spec/fixtures/Example.ogg +0 -0
- data/spec/fixtures/charter.docx +0 -0
- data/spec/fixtures/countdown.avi +0 -0
- data/spec/fixtures/curation_concerns_generic_stub.txt +1 -0
- data/spec/fixtures/files/image.png +0 -0
- data/spec/fixtures/image.jp2 +0 -0
- data/spec/fixtures/image.jpg +0 -0
- data/spec/fixtures/piano_note.wav +0 -0
- data/spec/fixtures/sample_mpeg4.mp4 +0 -0
- data/spec/fixtures/small_file.txt +1 -0
- data/spec/fixtures/spoken-text.m4a +0 -0
- data/spec/fixtures/test4.pdf +0 -0
- data/spec/fixtures/test5.mp3 +0 -0
- data/spec/fixtures/world.png +0 -0
- data/spec/forms/collection_edit_form_spec.rb +20 -0
- data/spec/forms/generic_file_edit_form_spec.rb +33 -0
- data/spec/helpers/catalog_helper_spec.rb +58 -0
- data/spec/helpers/configuration_helper_spec.rb +13 -0
- data/spec/helpers/curation_concerns/.keep +0 -0
- data/spec/helpers/curation_concerns/collections_helper_spec.rb +49 -0
- data/spec/helpers/render_constraints_helper_spec.rb +19 -0
- data/spec/helpers/thumbnail_helper_spec.rb +21 -0
- data/spec/helpers/url_helper_spec.rb +22 -0
- data/spec/jobs/active_fedora_id_based_job_spec.rb +14 -0
- data/spec/jobs/audit_job_spec.rb +53 -0
- data/spec/jobs/characterize_job_spec.rb +23 -0
- data/spec/jobs/copy_permissions_job_spec.rb +49 -0
- data/spec/jobs/create_derivatives_job_spec.rb +23 -0
- data/spec/jobs/curation_concerns_resque_queue_spec.rb +49 -0
- data/spec/jobs/import_url_job_spec.rb +45 -0
- data/spec/jobs/ingest_local_file_job_spec.rb +25 -0
- data/spec/lib/curation_concerns/messages_spec.rb +70 -0
- data/spec/lib/curation_concerns/readable_permissions_spec.rb +56 -0
- data/spec/lib/curation_concerns/writable_permissions_spec.rb +16 -0
- data/spec/matchers/metadata_field_matchers.rb +28 -0
- data/spec/matchers/response_matchers.rb +7 -0
- data/spec/matchers.rb +24 -0
- data/spec/models/checksum_audit_log_spec.rb +66 -0
- data/spec/models/curation_concerns/collection_behavior_spec.rb +107 -0
- data/spec/models/curation_concerns/generic_file/derivatives_spec.rb +88 -0
- data/spec/models/curation_concerns/generic_work_behavior_spec.rb +35 -0
- data/spec/models/fits_datastream_spec.rb +127 -0
- data/spec/models/generic_file_spec.rb +619 -0
- data/spec/models/generic_work_spec.rb +43 -0
- data/spec/models/user_spec.rb +23 -0
- data/spec/presenters/curation_concerns/collection_presenter_spec.rb +34 -0
- data/spec/presenters/curation_concerns/generic_file_presenter_spec.rb +16 -0
- data/spec/routing/curation_concerns/routes_spec.rb +36 -0
- data/spec/routing/route_spec.rb +86 -0
- data/spec/services/characterization_service_spec.rb +30 -0
- data/spec/services/embargo_service_spec.rb +38 -0
- data/spec/services/full_text_extraction_service_spec.rb +5 -0
- data/spec/services/generic_file_audit_service_spec.rb +71 -0
- data/spec/services/generic_file_indexing_service_spec.rb +57 -0
- data/spec/services/generic_work_indexing_service_spec.rb +18 -0
- data/spec/services/lease_service_spec.rb +53 -0
- data/spec/services/repository_audit_service_spec.rb +18 -0
- data/spec/services/versioning_service_spec.rb +32 -0
- data/spec/spec_helper.rb +94 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/curation_concerns/factory_helpers.rb +14 -0
- data/spec/support/features/fixture_file_upload.rb +14 -0
- data/spec/support/features/session_helpers.rb +41 -0
- data/spec/support/features.rb +19 -0
- data/spec/support/shared/shared_examples_has_dc_metadata.rb +17 -0
- data/spec/support/shared/shared_examples_is_embargoable.rb +8 -0
- data/spec/support/shared/shared_examples_with_access_rights.rb +63 -0
- data/spec/tasks/rake_spec.rb +24 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +55 -0
- data/spec/views/catalog/index.html.erb_spec.rb +59 -0
- data/spec/views/curation_concerns/base/_attributes.html.erb_spec.rb +25 -0
- data/spec/views/curation_concerns/base/show.html.erb_spec.rb +29 -0
- data/spec/views/curation_concerns/permissions/confirm.html.erb_spec.rb +33 -0
- data/spec/views/shared/_add_content.html.erb_spec.rb +42 -0
- data/spec/views/shared/_my_actions.html.erb_spec.rb +23 -0
- data/spec/workers/visibility_copy_worker_spec.rb +70 -0
- data/tasks/jetty.rake +15 -0
- data/tasks/release.rake +93 -0
- data/vendor/assets/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/vendor/assets/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/vendor/assets/javascripts/handlebars.js +2278 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.autocomplete.js +602 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.core.js +356 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect-highlight.js +50 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.menu.js +610 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.position.js +498 -0
- data/vendor/assets/javascripts/jquery-ui-1.9.2/jquery.ui.widget.js +528 -0
- data/vendor/assets/javascripts/jquery.tokeninput.js +1061 -0
- data/vendor/assets/stylesheets/jquery-ui-lightness.css +474 -0
- data/vendor/assets/stylesheets/token-input-facebook.css +122 -0
- data/vendor/assets/stylesheets/token-input-mac.css +204 -0
- data/vendor/assets/stylesheets/token-input.css +127 -0
- metadata +888 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module CollectionsControllerBehavior
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
include Hydra::CollectionsControllerBehavior
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
before_filter :filter_docs_with_read_access!, except: :show
|
|
8
|
+
self.search_params_logic += [:add_access_controls_to_solr_params, :add_advanced_parse_q_to_solr]
|
|
9
|
+
layout "curation_concerns/1_column"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def new
|
|
13
|
+
super
|
|
14
|
+
form
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def edit
|
|
18
|
+
super
|
|
19
|
+
form
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def show
|
|
23
|
+
super
|
|
24
|
+
presenter
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
protected
|
|
28
|
+
|
|
29
|
+
def presenter
|
|
30
|
+
@presenter ||= presenter_class.new(@collection)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def presenter_class
|
|
34
|
+
CurationConcerns::CollectionPresenter
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def collection_member_search_builder_class
|
|
38
|
+
CurationConcerns::SearchBuilder
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def collection_params
|
|
42
|
+
form_class.model_attributes(
|
|
43
|
+
params.require(:collection).permit(:title, :description, :members, part_of: [],
|
|
44
|
+
contributor: [], creator: [], publisher: [], date_created: [], subject: [],
|
|
45
|
+
language: [], rights: [], resource_type: [], identifier: [], based_near: [],
|
|
46
|
+
tag: [], related_url: [])
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def query_collection_members
|
|
51
|
+
flash[:notice]=nil if flash[:notice] == "Select something first"
|
|
52
|
+
params[:q] = params[:cq]
|
|
53
|
+
super
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def after_destroy(id)
|
|
57
|
+
respond_to do |format|
|
|
58
|
+
format.html { redirect_to collections_path, notice: 'Collection was successfully deleted.' }
|
|
59
|
+
format.json { render json: {id: id}, status: :destroyed, location: @collection }
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def form
|
|
64
|
+
@form ||= form_class.new(@collection)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def form_class
|
|
68
|
+
CurationConcerns::Forms::CollectionEditForm
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Include 'catalog' and 'curation_concerns/base' in the search path for views
|
|
72
|
+
def _prefixes
|
|
73
|
+
@_prefixes ||= super + ['catalog', 'curation_concerns/base']
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
module CurationConcerns::CurationConcernController
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
include Blacklight::Catalog::SearchContext
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
include CurationConcerns::ThemedLayoutController
|
|
7
|
+
with_themed_layout '1_column'
|
|
8
|
+
helper CurationConcerns::AbilityHelper
|
|
9
|
+
|
|
10
|
+
class_attribute :curation_concern_type
|
|
11
|
+
attr_accessor :curation_concern
|
|
12
|
+
helper_method :curation_concern
|
|
13
|
+
|
|
14
|
+
respond_to :html
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module ClassMethods
|
|
18
|
+
def set_curation_concern_type(curation_concern_type)
|
|
19
|
+
load_and_authorize_resource class: curation_concern_type, instance_name: :curation_concern
|
|
20
|
+
self.curation_concern_type = curation_concern_type
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def cancan_resource_class
|
|
24
|
+
CurationConcerns::ControllerResource
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def new
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def create
|
|
32
|
+
# return unless verify_acceptance_of_user_agreement!
|
|
33
|
+
if actor.create
|
|
34
|
+
after_create_response
|
|
35
|
+
else
|
|
36
|
+
setup_form
|
|
37
|
+
respond_with(:curation_concerns, curation_concern) do |wants|
|
|
38
|
+
wants.html { render 'new', status: :unprocessable_entity }
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def show
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def edit
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def update
|
|
50
|
+
if actor.update
|
|
51
|
+
after_update_response
|
|
52
|
+
else
|
|
53
|
+
setup_form
|
|
54
|
+
respond_with(:curation_concerns, curation_concern) do |wants|
|
|
55
|
+
wants.html { render 'edit', status: :unprocessable_entity }
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def destroy
|
|
61
|
+
title = curation_concern.to_s
|
|
62
|
+
curation_concern.destroy
|
|
63
|
+
after_destroy_response(title)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
attr_writer :actor
|
|
67
|
+
|
|
68
|
+
protected
|
|
69
|
+
def actor
|
|
70
|
+
@actor ||= CurationConcerns::CurationConcern.actor(curation_concern, current_user, attributes_for_actor)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Override setup_form in concrete controllers to get the form ready for display
|
|
74
|
+
def setup_form
|
|
75
|
+
if curation_concern.respond_to?(:contributor) && curation_concern.contributor.blank?
|
|
76
|
+
curation_concern.contributor << current_user.name
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# def verify_acceptance_of_user_agreement!
|
|
81
|
+
# return true if contributor_agreement.is_being_accepted?
|
|
82
|
+
# # Calling the new action to make sure we are doing our best to preserve
|
|
83
|
+
# # the input values; Its a stretch but hopefully it'll work
|
|
84
|
+
# self.new
|
|
85
|
+
# respond_with(:curation_concern, curation_concern) do |wants|
|
|
86
|
+
# wants.html {
|
|
87
|
+
# flash.now[:error] = "You must accept the contributor agreement"
|
|
88
|
+
# render 'new', status: :conflict
|
|
89
|
+
# }
|
|
90
|
+
# end
|
|
91
|
+
# false
|
|
92
|
+
# end
|
|
93
|
+
|
|
94
|
+
def _prefixes
|
|
95
|
+
@_prefixes ||= super + ['curation_concerns/base']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def after_create_response
|
|
99
|
+
respond_with(main_app, :curation_concerns, curation_concern)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def after_update_response
|
|
103
|
+
#TODO visibility or lease/embargo status
|
|
104
|
+
if actor.visibility_changed?
|
|
105
|
+
redirect_to main_app.confirm_curation_concerns_permission_path(curation_concern)
|
|
106
|
+
else
|
|
107
|
+
respond_with(main_app, :curation_concerns, curation_concern)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def after_destroy_response(title)
|
|
112
|
+
flash[:notice] = "Deleted #{title}"
|
|
113
|
+
respond_with { |wants|
|
|
114
|
+
wants.html { redirect_to main_app.catalog_index_path }
|
|
115
|
+
}
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def attributes_for_actor
|
|
119
|
+
params.fetch(hash_key_for_curation_concern, {}).permit!
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def hash_key_for_curation_concern
|
|
123
|
+
self.class.curation_concern_type.name.underscore.to_sym
|
|
124
|
+
end
|
|
125
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Overrides Hydra::Controller::DownloadBehavior to accommodate the fact that PCDM Objects#files uses direct containment instead of basic containment
|
|
2
|
+
module CurationConcerns
|
|
3
|
+
module DownloadBehavior
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
include Hydra::Controller::DownloadBehavior
|
|
6
|
+
|
|
7
|
+
module ClassMethods
|
|
8
|
+
def default_content_path
|
|
9
|
+
:original_file
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Customize the :download ability in your Ability class, or override this method
|
|
15
|
+
def authorize_download!
|
|
16
|
+
# authorize! :download, file # can't use this because Hydra::Ability#download_permissions assumes that files are in Basic Container (and thus include the asset's uri)
|
|
17
|
+
authorize! :read, asset
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Overrides Hydra::Controller::DownloadBehavior#load_file, which is hard-coded to assume files are in BasicContainer (PCDM Objects use direct containment)
|
|
21
|
+
# Override this method to change which file is shown.
|
|
22
|
+
# Loads the file specified by the HTTP parameter `:file_id`.
|
|
23
|
+
# If this object does not have a file by that name, return the default file
|
|
24
|
+
# as returned by {#default_file}
|
|
25
|
+
# @return [ActiveFedora::File] the file
|
|
26
|
+
def load_file
|
|
27
|
+
file_reference = params[:file]
|
|
28
|
+
# f = asset.attached_files[file_path] if file_path # can't use this because attached_files assumes basic containment
|
|
29
|
+
f = asset.send(file_reference) if valid_file_reference?(file_reference)
|
|
30
|
+
f ||= default_file
|
|
31
|
+
raise "Unable to find a file for #{asset}" if f.nil?
|
|
32
|
+
f
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def default_file
|
|
36
|
+
if asset.class.respond_to?(:default_file_path)
|
|
37
|
+
default_file_reference = asset.class.default_file_path
|
|
38
|
+
else
|
|
39
|
+
default_file_reference = DownloadsController.default_content_path
|
|
40
|
+
end
|
|
41
|
+
if valid_file_reference?(default_file_reference)
|
|
42
|
+
return asset.send(default_file_reference)
|
|
43
|
+
else
|
|
44
|
+
return nil
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def valid_file_reference?(file_reference)
|
|
51
|
+
return false if file_reference.nil?
|
|
52
|
+
# the second part of this is covering the fact that directly_contains_one isn't implemented yet, so :original_file, :thumbnail,:extracted_text are not singular associations (yet)
|
|
53
|
+
singular_associations.include?(file_reference.to_sym) || [:original_file, :thumbnail,:extracted_text].include?(file_reference.to_sym)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def singular_associations
|
|
57
|
+
asset.association_cache.select {|key,assoc| assoc.kind_of?(ActiveFedora::Associations::SingularAssociation)}.keys
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module EmbargoesControllerBehavior
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
skip_before_filter :normalize_identifier, only: :update
|
|
7
|
+
|
|
8
|
+
def destroy
|
|
9
|
+
update_files = !curation_concern.under_embargo? # embargo expired
|
|
10
|
+
remove_embargo(curation_concern)
|
|
11
|
+
flash[:notice] = curation_concern.embargo_history.last
|
|
12
|
+
if update_files
|
|
13
|
+
redirect_to confirm_curation_concerns_permission_path(curation_concern)
|
|
14
|
+
else
|
|
15
|
+
redirect_to edit_embargo_path(curation_concern)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def update
|
|
20
|
+
filter_docs_with_edit_access!
|
|
21
|
+
copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] }
|
|
22
|
+
batch.each do |id|
|
|
23
|
+
ActiveFedora::Base.find(id).tap do |curation_concern|
|
|
24
|
+
remove_embargo(curation_concern)
|
|
25
|
+
curation_concern.copy_visibility_to_files if copy_visibility.include?(id)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
redirect_to embargoes_path
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
protected
|
|
33
|
+
|
|
34
|
+
def _prefixes
|
|
35
|
+
# This allows us to use the unauthorized template in curation_concerns/base
|
|
36
|
+
@_prefixes ||= super + ['curation_concerns/base']
|
|
37
|
+
end
|
|
38
|
+
def remove_embargo(work)
|
|
39
|
+
work.embargo_visibility! # If the embargo has lapsed, update the current visibility.
|
|
40
|
+
work.deactivate_embargo!
|
|
41
|
+
work.save
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module GenericFilesControllerBehavior
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
include CurationConcerns::ThemedLayoutController
|
|
7
|
+
with_themed_layout '1_column'
|
|
8
|
+
load_and_authorize_resource class: ::GenericFile
|
|
9
|
+
helper_method :curation_concern
|
|
10
|
+
include CurationConcerns::ParentContainer
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def curation_concern
|
|
14
|
+
@generic_file
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# routed to /files/new
|
|
18
|
+
def new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# routed to /files/:id/edit
|
|
22
|
+
def edit
|
|
23
|
+
# @generic_file.initialize_fields
|
|
24
|
+
@groups = current_user.groups
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# routed to /files (POST)
|
|
28
|
+
def create
|
|
29
|
+
create_from_upload(params)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def create_from_upload(params)
|
|
33
|
+
# check error condition No files
|
|
34
|
+
return json_error("Error! No file to save") if !params.has_key?(:files)
|
|
35
|
+
|
|
36
|
+
file = params[:files].detect {|f| f.respond_to?(:original_filename) }
|
|
37
|
+
if !file
|
|
38
|
+
json_error "Error! No file for upload", 'unknown file', :status => :unprocessable_entity
|
|
39
|
+
elsif (empty_file?(file))
|
|
40
|
+
json_error "Error! Zero Length File!", file.original_filename
|
|
41
|
+
else
|
|
42
|
+
process_file(file)
|
|
43
|
+
end
|
|
44
|
+
rescue RSolr::Error::Http => error
|
|
45
|
+
logger.error "GenericFilesController::create rescued #{error.class}\n\t#{error.to_s}\n #{error.backtrace.join("\n")}\n\n"
|
|
46
|
+
json_error "Error occurred while creating generic file."
|
|
47
|
+
ensure
|
|
48
|
+
# remove the tempfile (only if it is a temp file)
|
|
49
|
+
file.tempfile.delete if file.respond_to?(:tempfile)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# routed to /files/:id
|
|
53
|
+
def show
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def destroy
|
|
57
|
+
@generic_file.destroy
|
|
58
|
+
redirect_to [main_app, :curation_concerns, @generic_file.generic_works.first], notice: "The file has been deleted."
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# routed to /files/:id (PUT)
|
|
62
|
+
def update
|
|
63
|
+
success = if wants_to_revert?
|
|
64
|
+
actor.revert_content(params[:revision])
|
|
65
|
+
elsif params.has_key? :files
|
|
66
|
+
actor.update_content(params[:files].first)
|
|
67
|
+
elsif params.has_key? :generic_file
|
|
68
|
+
update_metadata
|
|
69
|
+
end
|
|
70
|
+
if success
|
|
71
|
+
redirect_to [main_app, :curation_concerns, @generic_file], notice:
|
|
72
|
+
"The file #{view_context.link_to(@generic_file, [main_app, :curation_concerns, @generic_file])} has been updated."
|
|
73
|
+
else
|
|
74
|
+
render action: 'edit'
|
|
75
|
+
end
|
|
76
|
+
rescue RSolr::Error::Http => error
|
|
77
|
+
flash[:error] = error.message
|
|
78
|
+
logger.error "GenericFilesController::update rescued #{error.class}\n\t#{error.message}\n #{error.backtrace.join("\n")}\n\n"
|
|
79
|
+
render action: 'edit'
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# this is provided so that implementing application can override this behavior and map params to different attributes
|
|
83
|
+
def update_metadata
|
|
84
|
+
# attrs_without_visibility_info = actor.interpret_visibility(attributes)
|
|
85
|
+
file_attributes = CurationConcerns::Forms::GenericFileEditForm.model_attributes(attributes)
|
|
86
|
+
actor.update_metadata(file_attributes, attributes)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
protected
|
|
90
|
+
|
|
91
|
+
def wants_to_revert?
|
|
92
|
+
params.has_key?(:revision) && params[:revision] != @generic_file.latest_content_version.label
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def actor
|
|
96
|
+
@actor ||= ::CurationConcerns::GenericFileActor.new(@generic_file, current_user)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def attributes
|
|
100
|
+
# params.fetch(:generic_file, {}).dup # use a copy of the hash so that original params stays untouched when interpret_visibility modifies things
|
|
101
|
+
params.fetch(:generic_file, {}).permit!.dup # use a copy of the hash so that original params stays untouched when interpret_visibility modifies things
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def json_error(error, name=nil, additional_arguments={})
|
|
105
|
+
args = {:error => error}
|
|
106
|
+
args[:name] = name if name
|
|
107
|
+
render additional_arguments.merge({:json => [args]})
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def _prefixes
|
|
111
|
+
# This allows us to use the unauthorized and form_permission template in curation_concerns/base
|
|
112
|
+
@_prefixes ||= super + ['curation_concerns/base']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def empty_file?(file)
|
|
116
|
+
(file.respond_to?(:tempfile) && file.tempfile.size == 0) || (file.respond_to?(:size) && file.size == 0)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def process_file(file)
|
|
120
|
+
update_metadata_from_upload_screen
|
|
121
|
+
actor.create_metadata(params[:batch_id], parent_id, params[:generic_file])
|
|
122
|
+
if actor.create_content(file)
|
|
123
|
+
respond_to do |format|
|
|
124
|
+
format.html {
|
|
125
|
+
if request.xhr?
|
|
126
|
+
render 'jq_upload', formats: 'json', content_type: 'text/html'
|
|
127
|
+
else
|
|
128
|
+
redirect_to [main_app, :curation_concerns, @generic_file.generic_works.first]
|
|
129
|
+
end
|
|
130
|
+
}
|
|
131
|
+
format.json {
|
|
132
|
+
render 'jq_upload'
|
|
133
|
+
}
|
|
134
|
+
end
|
|
135
|
+
else
|
|
136
|
+
msg = @generic_file.errors.full_messages.join(', ')
|
|
137
|
+
flash[:error] = msg
|
|
138
|
+
json_error "Error creating generic file: #{msg}"
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# this is provided so that implementing application can override this behavior and map params to different attributes
|
|
143
|
+
def update_metadata_from_upload_screen
|
|
144
|
+
# Relative path is set by the jquery uploader when uploading a directory
|
|
145
|
+
@generic_file.relative_path = params[:relative_path] if params[:relative_path]
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
end
|
|
149
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module LeasesControllerBehavior
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
skip_before_filter :normalize_identifier, only: :update
|
|
7
|
+
|
|
8
|
+
def destroy
|
|
9
|
+
curation_concern.lease_visibility! # If the lease has lapsed, update the current visibility.
|
|
10
|
+
curation_concern.deactivate_lease!
|
|
11
|
+
saved = curation_concern.save
|
|
12
|
+
CurationConcerns.queue.push(VisibilityCopyWorker.new(curation_concern.id)) if saved
|
|
13
|
+
flash[:notice] = curation_concern.lease_history.last
|
|
14
|
+
redirect_to edit_lease_path(curation_concern)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def update
|
|
18
|
+
filter_docs_with_edit_access!
|
|
19
|
+
batch.each do |id|
|
|
20
|
+
ActiveFedora::Base.find(id).tap do |curation_concern|
|
|
21
|
+
curation_concern.deactivate_lease!
|
|
22
|
+
curation_concern.save
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
redirect_to leases_path
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
protected
|
|
30
|
+
|
|
31
|
+
def _prefixes
|
|
32
|
+
# This allows us to use the unauthorized template in curation_concerns/base
|
|
33
|
+
@_prefixes ||= super + ['curation_concerns/base']
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
module ManagesEmbargoes
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
include CurationConcerns::ThemedLayoutController
|
|
7
|
+
with_themed_layout '1_column'
|
|
8
|
+
|
|
9
|
+
attr_accessor :curation_concern
|
|
10
|
+
helper_method :curation_concern
|
|
11
|
+
load_and_authorize_resource class: ActiveFedora::Base, instance_name: :curation_concern
|
|
12
|
+
|
|
13
|
+
def deny_access(exception)
|
|
14
|
+
redirect_to root_path, alert: exception.message
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def index
|
|
20
|
+
authorize! :discover, :embargo
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def edit
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module CurationConcerns::ParentContainer
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
helper_method :parent
|
|
6
|
+
# before_filter :authorize_edit_parent_rights!, except: [:show] # Not sure we actually want this enforced any more (was originally in worthwhile), especially since GenericFiles and GenericWorks (which are PCDM::Objects)can belong to multiple parents
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def parent
|
|
10
|
+
@parent ||= new_or_create? ? ActiveFedora::Base.find(parent_id) : curation_concern.parent_objects.first # parent_objects method is inherited from Hydra::PCDM::ObjectBehavior
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def parent_id
|
|
14
|
+
@parent_id ||= new_or_create? ? params[:parent_id] : curation_concern.generic_works.parent_objects.first.id
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
protected
|
|
18
|
+
|
|
19
|
+
def new_or_create?
|
|
20
|
+
['create', 'new'].include? action_name
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def namespaced_parent_id
|
|
24
|
+
# Sufia::Noid.namespaceize(params[:parent_id])
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# restricts edit access so that you can only edit a record if you can also edit its parent.
|
|
28
|
+
|
|
29
|
+
def authorize_edit_parent_rights!
|
|
30
|
+
authorize! :edit, parent_id
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Copied from Curate
|
|
2
|
+
module CurationConcerns::ThemedLayoutController
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
|
|
5
|
+
included do
|
|
6
|
+
class_attribute :theme
|
|
7
|
+
self.theme = 'curation_concerns'
|
|
8
|
+
helper_method :theme
|
|
9
|
+
helper_method :show_site_actions?
|
|
10
|
+
helper_method :show_site_search?
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module ClassMethods
|
|
14
|
+
def with_themed_layout(view_name = nil)
|
|
15
|
+
if view_name
|
|
16
|
+
layout("#{theme}/#{view_name}")
|
|
17
|
+
else
|
|
18
|
+
layout(theme)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def show_site_actions?
|
|
24
|
+
true
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def show_site_search?
|
|
28
|
+
true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
# Including WithoutNamespace on a controller allows us to prepend the default namespace to the params[:id]
|
|
3
|
+
module WithoutNamespace
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
prepend_before_filter :normalize_identifier, except: [:index, :create, :new]
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
protected
|
|
11
|
+
def normalize_identifier
|
|
12
|
+
params[:id] = CurationConcerns::Noid.namespaceize(params[:id])
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
class ClassifyConcernsController < ApplicationController
|
|
3
|
+
include CurationConcerns::ThemedLayoutController
|
|
4
|
+
with_themed_layout '1_column'
|
|
5
|
+
respond_to :html
|
|
6
|
+
before_filter :authenticate_user!
|
|
7
|
+
load_and_authorize_resource
|
|
8
|
+
|
|
9
|
+
add_breadcrumb 'Submit a work', lambda {|controller| controller.request.path }
|
|
10
|
+
|
|
11
|
+
def classify_concern
|
|
12
|
+
@classify_concern
|
|
13
|
+
end
|
|
14
|
+
helper_method :classify_concern
|
|
15
|
+
|
|
16
|
+
def new
|
|
17
|
+
respond_with(classify_concern)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def create
|
|
21
|
+
classify_concern.attributes = params[:classify_concern]
|
|
22
|
+
if classify_concern.valid?
|
|
23
|
+
respond_with(classify_concern) do |wants|
|
|
24
|
+
wants.html do
|
|
25
|
+
redirect_to new_polymorphic_path(
|
|
26
|
+
[:curation_concerns, classify_concern.curation_concern_class]
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
else
|
|
31
|
+
respond_with(classify_concern)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module CurationConcerns
|
|
2
|
+
class GenericFilesController < ApplicationController
|
|
3
|
+
include CurationConcerns::GenericFilesControllerBehavior
|
|
4
|
+
|
|
5
|
+
def generic_file_params
|
|
6
|
+
if params.has_key?(:generic_file)
|
|
7
|
+
params.require(:generic_file).permit!
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class CurationConcerns::PermissionsController < ApplicationController
|
|
2
|
+
include CurationConcerns::CurationConcernController
|
|
3
|
+
with_themed_layout '1_column'
|
|
4
|
+
self.curation_concern_type = ActiveFedora::Base
|
|
5
|
+
|
|
6
|
+
def confirm
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def copy
|
|
10
|
+
CurationConcerns.queue.push(VisibilityCopyWorker.new(curation_concern.id))
|
|
11
|
+
flash_message = 'Updating file permissions. This may take a few minutes. You may want to refresh your browser or return to this record later to see the updated file permissions.'
|
|
12
|
+
redirect_to polymorphic_path([main_app, :curation_concerns, curation_concern]), notice: flash_message
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def curation_concern
|
|
16
|
+
@curation_concern ||= self.curation_concern_type.find(params[:id], cast: true)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|