curation_concerns 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,20 @@
|
|
1
|
+
class RegistrationsController < Devise::RegistrationsController
|
2
|
+
include CurationConcerns::ThemedLayoutController
|
3
|
+
with_themed_layout '1_column'
|
4
|
+
|
5
|
+
protected
|
6
|
+
|
7
|
+
# def after_update_path_for(resource)
|
8
|
+
# resource.update_column(:user_does_not_require_profile_update, true)
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# def resource_class
|
13
|
+
# Account
|
14
|
+
# end
|
15
|
+
|
16
|
+
# def sign_up(resource_name, resource)
|
17
|
+
# sign_in(resource_name, resource.user)
|
18
|
+
# end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module CurationConcerns::GenericWorkRdfProperties
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
included do
|
4
|
+
property :part_of, predicate: RDF::DC.isPartOf
|
5
|
+
property :resource_type, predicate: RDF::DC.type do |index|
|
6
|
+
index.as :stored_searchable, :facetable
|
7
|
+
end
|
8
|
+
property :title, predicate: RDF::DC.title do |index|
|
9
|
+
index.as :stored_searchable, :facetable
|
10
|
+
end
|
11
|
+
property :creator, predicate: RDF::DC.creator do |index|
|
12
|
+
index.as :stored_searchable, :facetable
|
13
|
+
end
|
14
|
+
property :contributor, predicate: RDF::DC.contributor do |index|
|
15
|
+
index.as :stored_searchable, :facetable
|
16
|
+
end
|
17
|
+
property :description, predicate: RDF::DC.description do |index|
|
18
|
+
index.type :text
|
19
|
+
index.as :stored_searchable
|
20
|
+
end
|
21
|
+
property :relation, predicate: RDF::DC.relation
|
22
|
+
property :rights, predicate: RDF::DC.rights do |index|
|
23
|
+
index.as :stored_searchable
|
24
|
+
end
|
25
|
+
property :publisher, predicate: RDF::DC.publisher do |index|
|
26
|
+
index.as :stored_searchable, :facetable
|
27
|
+
end
|
28
|
+
property :created, predicate: RDF::DC.created
|
29
|
+
|
30
|
+
property :date, predicate: RDF::DC.date do |index|
|
31
|
+
index.type :date
|
32
|
+
index.as :stored_sortable
|
33
|
+
end
|
34
|
+
property :date_uploaded, predicate: RDF::DC.dateSubmitted do |index|
|
35
|
+
index.type :date
|
36
|
+
index.as :stored_sortable
|
37
|
+
end
|
38
|
+
property :date_modified, predicate: RDF::DC.modified do |index|
|
39
|
+
index.type :date
|
40
|
+
index.as :stored_sortable
|
41
|
+
end
|
42
|
+
property :subject, predicate: RDF::DC.subject do |index|
|
43
|
+
index.as :stored_searchable, :facetable
|
44
|
+
end
|
45
|
+
property :language, predicate: RDF::DC.language do |index|
|
46
|
+
index.as :stored_searchable, :facetable
|
47
|
+
end
|
48
|
+
property :identifier, predicate: RDF::DC.identifier do |index|
|
49
|
+
index.as :stored_searchable
|
50
|
+
end
|
51
|
+
property :bibliographic_citation, predicate: RDF::DC.bibliographicCitation
|
52
|
+
property :source, predicate: RDF::DC.source
|
53
|
+
property :coverage, predicate: RDF::DC.coverage
|
54
|
+
property :type, predicate: RDF::DC.type
|
55
|
+
property :content_format, predicate: RDF::DC.format
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module Forms
|
3
|
+
class CollectionEditForm
|
4
|
+
include HydraEditor::Form
|
5
|
+
self.model_class = ::Collection
|
6
|
+
self.terms = [:resource_type, :title, :creator, :contributor, :description, :tag, :rights,
|
7
|
+
:publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url]
|
8
|
+
|
9
|
+
# Test to see if the given field is required
|
10
|
+
# @param [Symbol] key a field
|
11
|
+
# @return [Boolean] is it required or not
|
12
|
+
def required?(key)
|
13
|
+
model_class.validators_on(key).any?{|v| v.kind_of? ActiveModel::Validations::PresenceValidator}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module Forms
|
3
|
+
class GenericFileEditForm < GenericFilePresenter
|
4
|
+
include HydraEditor::Form
|
5
|
+
include HydraEditor::Form::Permissions
|
6
|
+
self.required_fields = [:title, :creator, :tag, :rights]
|
7
|
+
|
8
|
+
# def self.build_permitted_params
|
9
|
+
# super.merge {
|
10
|
+
# :visibility, :visibility_during_embargo, :embargo_release_date, :visibility_after_embargo, :visibility_during_lease, :lease_expiration_date, :visibility_after_lease }
|
11
|
+
# end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module AbilityHelper
|
3
|
+
# Returns true if can create at least one type of work
|
4
|
+
def can_ever_create_works?
|
5
|
+
can = false
|
6
|
+
CurationConcerns.configuration.curation_concerns.each do |curation_concern_type|
|
7
|
+
break if can
|
8
|
+
can = can?(:create,curation_concern_type)
|
9
|
+
end
|
10
|
+
return can
|
11
|
+
end
|
12
|
+
|
13
|
+
def visibility_options(variant)
|
14
|
+
options = [
|
15
|
+
['Open Access',Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC],
|
16
|
+
[t('curation_concerns.institution_name'),Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED],
|
17
|
+
['Private',Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE]
|
18
|
+
]
|
19
|
+
case variant
|
20
|
+
when :restrict
|
21
|
+
options.delete_at(0)
|
22
|
+
options.reverse!
|
23
|
+
when :loosen
|
24
|
+
options.delete_at(2)
|
25
|
+
end
|
26
|
+
return options
|
27
|
+
end
|
28
|
+
|
29
|
+
def visibility_badge(value)
|
30
|
+
case value
|
31
|
+
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
|
32
|
+
content_tag :span, "Open Access", class:"label label-success"
|
33
|
+
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
|
34
|
+
content_tag :span, t('sufia.institution_name'), class:"label label-info"
|
35
|
+
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
|
36
|
+
content_tag :span, "Private", class:"label label-danger"
|
37
|
+
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO
|
38
|
+
content_tag :span, "Embargo", class:"label label-warning"
|
39
|
+
when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE
|
40
|
+
content_tag :span, "Lease", class:"label label-warning"
|
41
|
+
else
|
42
|
+
content_tag :span, value, class:"label label-info"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module AttributeHelper
|
3
|
+
|
4
|
+
# If options[:catalog_search_link] is false,
|
5
|
+
# it will return the attribute value as text.
|
6
|
+
# If options[:catalog_search_link] is true,
|
7
|
+
# it will return a link to a catalog search for that text.
|
8
|
+
#
|
9
|
+
# If the method_name of the attribute is different than
|
10
|
+
# how the attribute name should appear on the search URL,
|
11
|
+
# you can explicitly set the URL's search field name using
|
12
|
+
# options[:search_field].
|
13
|
+
def curation_concern_attribute_to_html(curation_concern, method_name, label = nil, options = {})
|
14
|
+
if curation_concern.respond_to?(method_name)
|
15
|
+
markup = ""
|
16
|
+
label ||= derived_label_for(curation_concern, method_name)
|
17
|
+
subject = curation_concern.send(method_name)
|
18
|
+
return markup if !subject.present? && !options[:include_empty]
|
19
|
+
markup << %(<tr><th>#{label}</th>\n<td><ul class='tabular'>)
|
20
|
+
[subject].flatten.compact.each do |value|
|
21
|
+
if method_name == :rights
|
22
|
+
# Special treatment for license/rights. A URL from the Sufia gem's config/sufia.rb is stored in the descMetadata of the
|
23
|
+
# curation_concern. If that URL is valid in form, then it is used as a link. If it is not valid, it is used as plain text.
|
24
|
+
parsedUri = URI.parse(value) rescue nil
|
25
|
+
if parsedUri.nil?
|
26
|
+
markup << %(<li class="attribute #{method_name}">#{h(value)}</li>\n)
|
27
|
+
else
|
28
|
+
markup << %(<li class="attribute #{method_name}"><a href=#{h(value)} target="_blank"> #{h(CurationConcerns.config.cc_licenses_reverse[value])}</a></li>\n)
|
29
|
+
end
|
30
|
+
else
|
31
|
+
search_field = options[:search_field] || method_name
|
32
|
+
li_value = link_to_if(options[:catalog_search_link], h(value), main_app.catalog_index_path(search_field: search_field, q: h(value)))
|
33
|
+
markup << %(<li class="attribute #{method_name}"> #{li_value} </li>\n)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
markup << %(</ul></td></tr>)
|
37
|
+
markup.html_safe
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def permission_badge_for(curation_concern, solr_document = nil)
|
42
|
+
solr_document ||= curation_concern.to_solr
|
43
|
+
dom_label_class, link_title = extract_dom_label_class_and_link_title(solr_document)
|
44
|
+
%(<span class="label #{dom_label_class}" title="#{link_title}">#{link_title}</span>).html_safe
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
def extract_dom_label_class_and_link_title(document)
|
49
|
+
hash = document.stringify_keys
|
50
|
+
dom_label_class, link_title = "label-danger", "Private"
|
51
|
+
if hash[Hydra.config.permissions.read.group].present?
|
52
|
+
if hash[Hydra.config.permissions.read.group].include?('public')
|
53
|
+
if hash[Hydra.config.permissions.embargo.release_date].present?
|
54
|
+
dom_label_class, link_title = 'label-warning', 'Open Access with Embargo'
|
55
|
+
else
|
56
|
+
dom_label_class, link_title = 'label-success', 'Open Access'
|
57
|
+
end
|
58
|
+
elsif hash[Hydra.config.permissions.read.group].include?('registered')
|
59
|
+
dom_label_class, link_title = "label-info", t('sufia.institution_name')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
return dom_label_class, link_title
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module CurationConcerns::CatalogHelper
|
2
|
+
def type_tab(label, key=label)
|
3
|
+
if params[:f] && params[:f][type_field] == [key]
|
4
|
+
content_tag(:li, link_to(label, "#"), class: "active")
|
5
|
+
else
|
6
|
+
facet_solr_field = facet_configuration_for_field(type_field)
|
7
|
+
path = search_action_path(add_facet_params_and_redirect(type_field, key))
|
8
|
+
# local_params = params.dup
|
9
|
+
# local_facet_params = local_params[:f] || {}.with_indifferent_access
|
10
|
+
# local_params[:f] = local_facet_params.select{|k,_| k != type_field }
|
11
|
+
# puts "local #{local_params}"
|
12
|
+
# path = add_facet_params(type_field, key, local_params)
|
13
|
+
content_tag(:li, link_to(label, path))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def all_type_tab(label = t('curation_concerns.catalog.index.type_tabs.all'))
|
18
|
+
if params[:f] && params[:f][type_field]
|
19
|
+
facet_solr_field = facet_configuration_for_field(type_field)
|
20
|
+
new_params = remove_facet_params(type_field, params[:f][type_field].first)
|
21
|
+
|
22
|
+
# Delete any request params from facet-specific action, needed
|
23
|
+
# to redir to index action properly.
|
24
|
+
new_params.except! *Blacklight::Solr::FacetPaginator.request_keys.values
|
25
|
+
path = search_action_path(new_params)
|
26
|
+
content_tag(:li, link_to(label, path))
|
27
|
+
else
|
28
|
+
content_tag(:li, link_to(label, '#'), class: "active")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def type_field
|
35
|
+
Solrizer.solr_name("generic_type", :facetable)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module CurationConcerns::CollectionsHelper
|
2
|
+
def has_collection_search_parameters?
|
3
|
+
params[:cq].present?
|
4
|
+
end
|
5
|
+
|
6
|
+
def collection_modal_id(collectible)
|
7
|
+
"#{collectible.to_param.gsub(/:/, '-')}-modal"
|
8
|
+
end
|
9
|
+
|
10
|
+
def link_to_select_collection(collectible, opts={})
|
11
|
+
html_class = opts[:class]
|
12
|
+
link_to '#', data: { toggle: "modal", target: '#' + collection_modal_id(collectible) },
|
13
|
+
class: "add-to-collection #{html_class}", title: "Add #{collectible.human_readable_type} to Collection" do
|
14
|
+
icon('plus-sign') + ' Add to a Collection'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# override hydra-collections
|
19
|
+
def link_to_remove_from_collection(document, label = 'Remove From Collection')
|
20
|
+
link_to collections.collection_path(@collection.id, collection: { members: 'remove'},
|
21
|
+
batch_document_ids: [ document.id ]), method: :put do
|
22
|
+
icon('minus-sign') + ' ' + label
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def icon(type)
|
27
|
+
content_tag :span, '', class: "glyphicon glyphicon-#{type}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def collection_options_for_select(exclude_item = nil)
|
31
|
+
options_for_select(available_collections(exclude_item))
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
# return a list of collections for the current user with the exception of the passed in collection
|
36
|
+
def available_collections(exclude_item)
|
37
|
+
if exclude_item
|
38
|
+
collection_options.reject {|n| n.last == exclude_item.id}
|
39
|
+
else
|
40
|
+
collection_options
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def collection_options
|
46
|
+
@collection_options ||= current_users_collections
|
47
|
+
end
|
48
|
+
|
49
|
+
# Defaults to returning a list of all collections.
|
50
|
+
# If you have implement User.collections, the results of that will be used.
|
51
|
+
def current_users_collections
|
52
|
+
if current_user.respond_to?(:collections)
|
53
|
+
current_user.collections.map { |c| [c.title.join(', '), c.id] }
|
54
|
+
else
|
55
|
+
query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: Collection.to_class_uri)
|
56
|
+
ActiveFedora::SolrService.query(query, fl: 'title_tesim id',
|
57
|
+
rows: 1000).map do |r|
|
58
|
+
[r['title_tesim'].join(', '), r['id']]
|
59
|
+
end.sort { |a, b| a.first <=> b.first }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module EmbargoHelper
|
3
|
+
|
4
|
+
def assets_with_expired_embargoes
|
5
|
+
@assets_with_expired_embargoes ||= EmbargoService.assets_with_expired_embargoes
|
6
|
+
end
|
7
|
+
|
8
|
+
def assets_under_embargo
|
9
|
+
@assets_under_embargo ||= EmbargoService.assets_under_embargo
|
10
|
+
end
|
11
|
+
|
12
|
+
def assets_with_deactivated_embargoes
|
13
|
+
@assets_with_deactivated_embargoes ||= EmbargoService.assets_with_deactivated_embargoes
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module CurationConcerns::GenericFileHelper
|
2
|
+
|
3
|
+
def generic_file_title(gf)
|
4
|
+
can?(:read, gf) ? gf.to_s : "File"
|
5
|
+
end
|
6
|
+
|
7
|
+
def generic_file_link_name(gf)
|
8
|
+
can?(:read, gf) ? gf.filename : "File"
|
9
|
+
end
|
10
|
+
|
11
|
+
def parent_path(parent)
|
12
|
+
if parent.is_a?(Collection)
|
13
|
+
main_app.collection_path(parent)
|
14
|
+
else
|
15
|
+
polymorphic_path([main_app, :curation_concerns, parent])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module LeaseHelper
|
3
|
+
|
4
|
+
def assets_with_expired_leases
|
5
|
+
@assets_with_expired_leases ||= LeaseService.assets_with_expired_leases
|
6
|
+
end
|
7
|
+
|
8
|
+
def assets_under_lease
|
9
|
+
@assets_under_lease ||= LeaseService.assets_under_lease
|
10
|
+
end
|
11
|
+
|
12
|
+
def assets_with_deactivated_leases
|
13
|
+
@assets_with_deactivated_leases ||= LeaseService.assets_with_deactivated_leases
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CurationConcerns::MainAppHelpers
|
2
|
+
include CurationConcerns::TitleHelper
|
3
|
+
include CurationConcerns::AttributeHelper
|
4
|
+
include CurationConcerns::GenericFileHelper
|
5
|
+
include CurationConcerns::SearchPathsHelper
|
6
|
+
include CurationConcerns::RenderConstraintsHelper
|
7
|
+
include CurationConcerns::AbilityHelper
|
8
|
+
include CurationConcerns::ThumbnailHelper
|
9
|
+
include CurationConcerns::UrlHelper
|
10
|
+
include CurationConcerns::EmbargoHelper
|
11
|
+
include CurationConcerns::LeaseHelper
|
12
|
+
include CurationConcerns::CollectionsHelper
|
13
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module RenderConstraintsHelper
|
3
|
+
# Overridden to remove the 'search_field' tag from the localized params when the query is cleared.
|
4
|
+
# This is because unlike Blacklight, there is no way to change the search_field in the curation_concerns UI
|
5
|
+
##
|
6
|
+
# Render the query constraints
|
7
|
+
#
|
8
|
+
# @param [Hash] query parameters
|
9
|
+
# @return [String]
|
10
|
+
def render_constraints_query(localized_params = params)
|
11
|
+
# So simple don't need a view template, we can just do it here.
|
12
|
+
return "".html_safe if localized_params[:q].blank?
|
13
|
+
|
14
|
+
render_constraint_element(constraint_query_label(localized_params),
|
15
|
+
localized_params[:q],
|
16
|
+
classes: ["query"],
|
17
|
+
remove: url_for(localized_params.except(:search_field).merge(q: nil, action: 'index')))
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# We can remove this method once we use Blacklight > 5.4.0
|
22
|
+
##
|
23
|
+
# Return a label for the currently selected search field.
|
24
|
+
# If no "search_field" or the default (e.g. "all_fields") is selected, then return nil
|
25
|
+
# Otherwise grab the label of the selected search field.
|
26
|
+
# @param [Hash] query parameters
|
27
|
+
# @return [String]
|
28
|
+
def constraint_query_label(localized_params = params)
|
29
|
+
label_for_search_field(localized_params[:search_field]) unless default_search_field?(localized_params[:search_field])
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# We can remove this method once we use Blacklight > 5.4.0
|
34
|
+
##
|
35
|
+
# Is the search form using the default search field ("all_fields" by default)?
|
36
|
+
# @param [String] the currently selected search_field
|
37
|
+
# @return [Boolean]
|
38
|
+
def default_search_field?(selected_search_field)
|
39
|
+
selected_search_field.blank? || (default_search_field && selected_search_field == default_search_field[:key])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CurationConcerns::SearchPathsHelper
|
2
|
+
|
3
|
+
def search_path_for_my_works(opts={})
|
4
|
+
params_for_my_works = {:'f[generic_type_sim][]'=>'Work', works: 'mine'}
|
5
|
+
main_app.catalog_index_path(params_for_my_works.merge(opts))
|
6
|
+
end
|
7
|
+
|
8
|
+
def search_path_for_my_collections(opts={})
|
9
|
+
params_for_my_collections = {:'f[generic_type_sim][]'=>'Collection', works: 'mine'}
|
10
|
+
main_app.catalog_index_path(params_for_my_collections.merge(opts))
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module ThumbnailHelper
|
3
|
+
def thumbnail_tag(document, image_options)
|
4
|
+
if document.representative.present?
|
5
|
+
image_tag main_app.download_path(document.representative, datastream_id: 'thumbnail'), alt: 'Thumbnail', class: "canonical-image"
|
6
|
+
else
|
7
|
+
content_tag :span, '', class: 'canonical-image'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module CurationConcerns::TitleHelper
|
2
|
+
|
3
|
+
def construct_page_title(*elements)
|
4
|
+
(elements.flatten.compact + [application_name]).join(" // ")
|
5
|
+
end
|
6
|
+
|
7
|
+
def curation_concern_page_title(curation_concern)
|
8
|
+
if curation_concern.persisted?
|
9
|
+
construct_page_title(curation_concern.title, "#{curation_concern.human_readable_type} [#{curation_concern.to_param}]")
|
10
|
+
else
|
11
|
+
construct_page_title("New #{curation_concern.human_readable_type}")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def default_page_title
|
16
|
+
text = controller_name.singularize.titleize
|
17
|
+
if action_name
|
18
|
+
text = "#{action_name.titleize} " + text
|
19
|
+
end
|
20
|
+
construct_page_title(text)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
module UrlHelper
|
3
|
+
|
4
|
+
# override Blacklight so we can use our 'curation_concern' namespace
|
5
|
+
# We may also pass in a ActiveFedora document instead of a SolrDocument
|
6
|
+
def url_for_document doc, options = {}
|
7
|
+
if doc.collection?
|
8
|
+
doc
|
9
|
+
else
|
10
|
+
polymorphic_path([main_app, :curation_concerns, doc])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def track_collection_path(*args)
|
15
|
+
main_app.track_solr_document_path(*args)
|
16
|
+
end
|
17
|
+
|
18
|
+
def track_generic_file_path(*args)
|
19
|
+
main_app.track_solr_document_path(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
# generated new GenericWork models get registered as curation concerns and need a
|
23
|
+
# track_model_path to render Blacklight-related views
|
24
|
+
CurationConcerns.configuration.registered_curation_concern_types.each do |concern|
|
25
|
+
define_method("track_#{concern.underscore}_path") {|*args| main_app.track_solr_document_path(*args)}
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
class CollectionPresenter
|
3
|
+
include Hydra::Presenter
|
4
|
+
include ActionView::Helpers::NumberHelper
|
5
|
+
|
6
|
+
self.model_class = ::Collection
|
7
|
+
# Terms is the list of fields displayed by app/views/collections/_show_descriptions.html.erb
|
8
|
+
self.terms = [:title, :total_items, :size, :resource_type, :description, :creator, :contributor,
|
9
|
+
:tag, :rights, :publisher, :date_created, :subject, :language, :identifier,
|
10
|
+
:based_near, :related_url]
|
11
|
+
|
12
|
+
# Depositor and permissions are not displayed in app/views/collections/_show_descriptions.html.erb
|
13
|
+
# so don't include them in `terms'.
|
14
|
+
# delegate :depositor, :permissions, to: :model
|
15
|
+
|
16
|
+
def terms_with_values
|
17
|
+
terms.select { |t| self[t].present? }
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](key)
|
21
|
+
case key
|
22
|
+
when :size
|
23
|
+
size
|
24
|
+
when :total_items
|
25
|
+
total_items
|
26
|
+
else
|
27
|
+
super
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def size
|
32
|
+
number_to_human_size(model.bytes)
|
33
|
+
end
|
34
|
+
|
35
|
+
def total_items
|
36
|
+
model.members.count
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
class GenericFilePresenter
|
3
|
+
include Hydra::Presenter
|
4
|
+
self.model_class = ::GenericFile
|
5
|
+
# Terms is the list of fields displayed by app/views/generic_files/_show_descriptions.html.erb
|
6
|
+
self.terms = [:resource_type, :title, :creator, :contributor, :description, :tag, :rights,
|
7
|
+
:publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url]
|
8
|
+
|
9
|
+
# Depositor and permissions are not displayed in app/views/generic_files/_show_descriptions.html.erb
|
10
|
+
# so don't include them in `terms'.
|
11
|
+
delegate :depositor, :permissions, to: :model
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CurationConcerns
|
2
|
+
class GenericWorkPresenter
|
3
|
+
include Hydra::Presenter
|
4
|
+
self.model_class = GenericWork
|
5
|
+
# Terms is the list of fields displayed
|
6
|
+
self.terms = [:resource_type, :title, :creator, :contributor, :description, :tag, :rights,
|
7
|
+
:publisher, :date_created, :subject, :language, :identifier, :based_near, :related_url]
|
8
|
+
|
9
|
+
# Depositor and permissions are not displayed
|
10
|
+
# so don't include them in `terms'.
|
11
|
+
delegate :depositor, :permissions, to: :model
|
12
|
+
end
|
13
|
+
end
|