hydra-head 3.0.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +71 -0
- data/.gitmodules +6 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +257 -0
- data/README.textile +150 -0
- data/README_RAILS3_CHANGES.textile +42 -0
- data/Rakefile +5 -0
- data/TESTING.textile +85 -0
- data/app/controllers/assets_controller.rb +117 -0
- data/app/controllers/contributors_controller.rb +54 -0
- data/app/controllers/file_assets_controller.rb +152 -0
- data/app/controllers/permissions_controller.rb +137 -0
- data/app/controllers/user_sessions_controller.rb +14 -0
- data/app/helpers/article_metadata_helper.rb +80 -0
- data/app/helpers/blacklight_helper.rb +192 -0
- data/app/helpers/downloads_helper.rb +19 -0
- data/app/helpers/generic_content_objects_helper.rb +16 -0
- data/app/helpers/hydra_assets_helper.rb +75 -0
- data/app/helpers/hydra_djatoka_helper.rb +23 -0
- data/app/helpers/hydra_fedora_metadata_helper.rb +365 -0
- data/app/helpers/hydra_helper.rb +155 -0
- data/app/helpers/hydra_uploader_helper.rb +18 -0
- data/app/helpers/inline_editable_metadata_helper.rb +15 -0
- data/app/helpers/javascript_includes_helper.rb +93 -0
- data/app/helpers/release_process_helper.rb +32 -0
- data/app/models/audio_asset.rb +8 -0
- data/app/models/file_asset.rb +111 -0
- data/app/models/generic_content.rb +21 -0
- data/app/models/generic_image.rb +62 -0
- data/app/models/image_asset.rb +8 -0
- data/app/models/mods_asset.rb +6 -0
- data/app/models/role_mapper.rb +22 -0
- data/app/models/superuser.rb +6 -0
- data/app/models/video_asset.rb +8 -0
- data/app/views/_add_assets_links.html.erb +13 -0
- data/app/views/_brown_sidebar.html +15 -0
- data/app/views/_user_util_links.html.erb +31 -0
- data/app/views/catalog/_citation.html.erb +11 -0
- data/app/views/catalog/_constraints_element.html.erb +34 -0
- data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
- data/app/views/catalog/_document_list.html.erb +11 -0
- data/app/views/catalog/_edit_partials/_default.html.erb +64 -0
- data/app/views/catalog/_edit_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_email_form.html.erb +9 -0
- data/app/views/catalog/_facets.html.erb +37 -0
- data/app/views/catalog/_flash_msg.html.erb +17 -0
- data/app/views/catalog/_home.html.erb +6 -0
- data/app/views/catalog/_home_text.html.erb +10 -0
- data/app/views/catalog/_index_partials/_default.html.erb +20 -0
- data/app/views/catalog/_index_partials/_default_details.html.erb +11 -0
- data/app/views/catalog/_index_partials/_default_group.html.erb +15 -0
- data/app/views/catalog/_search_form.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +23 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +12 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/_sms_form.html.erb +21 -0
- data/app/views/catalog/_sort_and_per_page.html.erb +22 -0
- data/app/views/catalog/_uva_tabs.html.erb +10 -0
- data/app/views/catalog/about.html.erb +0 -0
- data/app/views/catalog/show.html.erb +48 -0
- data/app/views/contributors/_add_contributor_split_button.html.erb +10 -0
- data/app/views/contributors/_edit_conference.html.erb +29 -0
- data/app/views/contributors/_edit_organization.html.erb +29 -0
- data/app/views/contributors/_edit_person.html.erb +42 -0
- data/app/views/contributors/_index.html.erb +12 -0
- data/app/views/contributors/_new.html.erb +10 -0
- data/app/views/contributors/_show_conference.html.erb +22 -0
- data/app/views/contributors/_show_organization.html.erb +29 -0
- data/app/views/contributors/_show_person.html.erb +17 -0
- data/app/views/contributors/new.html.erb +13 -0
- data/app/views/downloads/index.html.erb +1 -0
- data/app/views/file_assets/_deletable_result.html.erb +5 -0
- data/app/views/file_assets/_index.html.erb +15 -0
- data/app/views/file_assets/_new.html.erb +2 -0
- data/app/views/file_assets/_result.html.erb +16 -0
- data/app/views/file_assets/index.html.erb +5 -0
- data/app/views/fluid_infusion/_uploader.html.erb +81 -0
- data/app/views/fluid_infusion/_uploader_generic_content_objects.js.erb +38 -0
- data/app/views/fluid_infusion/_uploader_js.erb +45 -0
- data/app/views/generic_content_objects/_edit_description.html.erb +50 -0
- data/app/views/generic_content_objects/_new.html.erb +0 -0
- data/app/views/generic_content_objects/_show_description.html.erb +68 -0
- data/app/views/generic_content_objects/contributors/_edit_conference.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_organization.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_person.html.erb +37 -0
- data/app/views/generic_content_objects/contributors/_new.html.erb +10 -0
- data/app/views/generic_content_objects/contributors/_show_conference.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_organization.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_person.html.erb +38 -0
- data/app/views/generic_contents/_edit.html.erb +59 -0
- data/app/views/generic_contents/_index.html.erb +23 -0
- data/app/views/generic_contents/_show.html.erb +18 -0
- data/app/views/generic_contents/_show_content.html.erb +4 -0
- data/app/views/generic_images/_edit.html.erb +59 -0
- data/app/views/generic_images/_index.html.erb +24 -0
- data/app/views/generic_images/_show.html.erb +18 -0
- data/app/views/generic_images/_show_all.html.erb +14 -0
- data/app/views/generic_images/_show_content.html.erb +7 -0
- data/app/views/layouts/application.html.erb +57 -0
- data/app/views/layouts/hydra-head.html.erb +12 -0
- data/app/views/mods_assets/_edit.html.erb +49 -0
- data/app/views/mods_assets/_edit_description.html.erb +82 -0
- data/app/views/mods_assets/_edit_journal.html.erb +72 -0
- data/app/views/mods_assets/_index.html.erb +1 -0
- data/app/views/mods_assets/_index_list.html.erb +37 -0
- data/app/views/mods_assets/_index_table.html.erb +7 -0
- data/app/views/mods_assets/_progress_box.html.erb +82 -0
- data/app/views/mods_assets/_show.html.erb +44 -0
- data/app/views/mods_assets/_show_description.html.erb +44 -0
- data/app/views/mods_assets/_show_journal.html.erb +42 -0
- data/app/views/mods_assets/_show_permissions.html.erb +14 -0
- data/app/views/permissions/_edit_person_permissions.html.erb +35 -0
- data/app/views/permissions/_index.html.erb +55 -0
- data/app/views/permissions/_new.html.erb +18 -0
- data/app/views/permissions/index.html.erb +1 -0
- data/app/views/permissions/new.html.erb +1 -0
- data/app/views/shared/_delete_asset_confirmation.html.erb +17 -0
- data/app/views/user_sessions/_login_form.html.erb +10 -0
- data/app/views/user_sessions/logged_out.html.erb +1 -0
- data/config/routes.rb +12 -0
- data/fedora_conf/conf/fedora.fcfg +1021 -0
- data/hydra-head.gemspec +70 -0
- data/lib/application_controller.rb +25 -0
- data/lib/application_helper.rb +2 -0
- data/lib/engine.rb +30 -0
- data/lib/generators/hydra/head_generator.rb +152 -0
- data/lib/generators/hydra/templates/config/fedora.yml +17 -0
- data/lib/generators/hydra/templates/config/initializers/blacklight_config.rb +246 -0
- data/lib/generators/hydra/templates/config/initializers/fedora_config.rb +23 -0
- data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +29 -0
- data/lib/generators/hydra/templates/config/role_map_cucumber.yml +10 -0
- data/lib/generators/hydra/templates/config/role_map_development.yml +12 -0
- data/lib/generators/hydra/templates/config/role_map_production.yml +2 -0
- data/lib/generators/hydra/templates/config/role_map_test.yml +15 -0
- data/lib/generators/hydra/templates/config/solr.yml +10 -0
- data/lib/generators/hydra/templates/config/solr_mappings.yml +22 -0
- data/lib/generators/hydra/templates/fedora_conf/conf/fedora.fcfg +1021 -0
- data/lib/generators/hydra/templates/migrations/add_user_attributes_table.rb +15 -0
- data/lib/generators/hydra/templates/migrations/create_superusers.rb +12 -0
- data/lib/generators/hydra/templates/solr_conf/conf/schema.xml +118 -0
- data/lib/generators/hydra/templates/solr_conf/conf/solrconfig.xml +332 -0
- data/lib/generators/hydra/templates/solr_conf/solr.xml +35 -0
- data/lib/hydra-head.rb +29 -0
- data/lib/hydra-head/engine.rb +9 -0
- data/lib/hydra-head/routes.rb +87 -0
- data/lib/hydra-head/version.rb +4 -0
- data/lib/hydra.rb +22 -0
- data/lib/hydra/access_controls_enforcement.rb +236 -0
- data/lib/hydra/access_controls_evaluation.rb +97 -0
- data/lib/hydra/assets_controller_helper.rb +144 -0
- data/lib/hydra/catalog.rb +64 -0
- data/lib/hydra/common_mods_index_methods.rb +42 -0
- data/lib/hydra/controller.rb +7 -0
- data/lib/hydra/file_assets_helper.rb +144 -0
- data/lib/hydra/fixtures.rb +43 -0
- data/lib/hydra/generic_content.rb +113 -0
- data/lib/hydra/generic_image.rb +100 -0
- data/lib/hydra/image.rb +177 -0
- data/lib/hydra/model_methods.rb +95 -0
- data/lib/hydra/model_mixins.rb +2 -0
- data/lib/hydra/model_mixins/common_metadata.rb +24 -0
- data/lib/hydra/model_mixins/mods_object.rb +16 -0
- data/lib/hydra/mods_article.rb +505 -0
- data/lib/hydra/mods_dataset.rb +165 -0
- data/lib/hydra/mods_generic_content.rb +494 -0
- data/lib/hydra/mods_image.rb +494 -0
- data/lib/hydra/repository_controller.rb +102 -0
- data/lib/hydra/rights_metadata.rb +189 -0
- data/lib/hydra/superuser_attributes.rb +12 -0
- data/lib/hydra/testing_server.rb +183 -0
- data/lib/hydra/user.rb +22 -0
- data/lib/mediashelf/active_fedora_helper.rb +72 -0
- data/lib/railties/all_tests.rake +23 -0
- data/lib/railties/hydra-fixtures.rake +184 -0
- data/lib/railties/hydra_jetty.rake +79 -0
- data/lib/railties/hyhead_cucumber.rake +127 -0
- data/lib/railties/hyhead_rspec.rake +137 -0
- data/lib/stanford/searchworks_helper.rb +1338 -0
- data/lib/stanford/solr_helper.rb +108 -0
- data/lib/uva/mods_index_methods.rb +24 -0
- data/solr_conf/conf/schema.xml +122 -0
- data/solr_conf/conf/solrconfig.xml +332 -0
- data/solr_conf/solr.xml +35 -0
- data/tasks/hydra-head-fixtures.rake +54 -0
- data/tasks/hydra-head.rake +247 -0
- data/tasks/hydra_jetty.rake +79 -0
- data/tasks/replicator.rake +27 -0
- data/tasks/solrizer-fedora.rake +53 -0
- data/tasks/solrizer.rake +13 -0
- data/test_support/etc/Gemfile +29 -0
- data/test_support/etc/rvmrc +32 -0
- data/test_support/features/button_add_assets.feature +22 -0
- data/test_support/features/button_add_generic_content.feature +11 -0
- data/test_support/features/button_add_image.feature +11 -0
- data/test_support/features/button_add_mods_asset.feature +11 -0
- data/test_support/features/contributor_add.feature +39 -0
- data/test_support/features/file_assets_list.feature +32 -0
- data/test_support/features/file_upload.feature +40 -0
- data/test_support/features/home_page.feature +9 -0
- data/test_support/features/html_validity.feature +47 -0
- data/test_support/features/mods_asset_contributors_edit.feature +80 -0
- data/test_support/features/mods_asset_create.feature +12 -0
- data/test_support/features/mods_asset_edit.feature +33 -0
- data/test_support/features/mods_asset_edit_without_permission.feature +10 -0
- data/test_support/features/mods_asset_search_result.feature +13 -0
- data/test_support/features/mods_asset_show.feature +39 -0
- data/test_support/features/permissions_add.feature +15 -0
- data/test_support/features/permissions_edit.feature +63 -0
- data/test_support/features/step_definitions/catalog_index_steps.rb +14 -0
- data/test_support/features/step_definitions/create_asset_steps.rb +7 -0
- data/test_support/features/step_definitions/edit_metadata_steps.rb +73 -0
- data/test_support/features/step_definitions/file_list_steps.rb +28 -0
- data/test_support/features/step_definitions/hydra_metadata_steps.rb +3 -0
- data/test_support/features/step_definitions/hydra_steps.rb +8 -0
- data/test_support/features/step_definitions/inline_editable_edit_steps.rb +77 -0
- data/test_support/features/step_definitions/search_steps.rb +88 -0
- data/test_support/features/step_definitions/searching_steps.rb +22 -0
- data/test_support/features/step_definitions/show_document_steps.rb +85 -0
- data/test_support/features/step_definitions/user_steps.rb +36 -0
- data/test_support/features/step_definitions/web_steps.rb +219 -0
- data/test_support/features/support/env.rb +55 -0
- data/test_support/features/support/paths.rb +80 -0
- data/test_support/features/switch_users.feature +14 -0
- data/test_support/features/view_catalog_index.feature +18 -0
- data/test_support/fixtures/empty_file.txt +0 -0
- data/test_support/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +1212 -0
- data/test_support/fixtures/hydrangea_fixture_file_asset1.foxml.xml +4946 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article1.foxml.xml +234 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article2.foxml.xml +177 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article3.foxml.xml +170 -0
- data/test_support/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +187 -0
- data/test_support/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +676 -0
- data/test_support/fixtures/image.jp2 +0 -0
- data/test_support/fixtures/libra-oa_1.foxml.xml +2324 -0
- data/test_support/fixtures/libra-oa_2.foxml.xml +2422 -0
- data/test_support/spec/controllers/assets_controller_spec.rb +113 -0
- data/test_support/spec/controllers/catalog_controller_spec.rb +148 -0
- data/test_support/spec/controllers/catalog_controller_viewing_context_spec.rb +62 -0
- data/test_support/spec/controllers/contributors_controller_spec.rb +47 -0
- data/test_support/spec/controllers/file_assets_controller_spec.rb +189 -0
- data/test_support/spec/controllers/hydra_controller_spec.rb +15 -0
- data/test_support/spec/controllers/permissions_controller_spec.rb +80 -0
- data/test_support/spec/controllers/user_sessions_controller_spec.rb +35 -0
- data/test_support/spec/generators/hydra-head_generator_spec.rb +14 -0
- data/test_support/spec/helpers/access_controls_enforcement_spec.rb +212 -0
- data/test_support/spec/helpers/access_controls_evaluation_spec.rb +35 -0
- data/test_support/spec/helpers/assets_controller_helper_spec.rb +71 -0
- data/test_support/spec/helpers/blacklight_helper_spec.rb +64 -0
- data/test_support/spec/helpers/file_assets_helper_spec.rb +107 -0
- data/test_support/spec/helpers/hydra-repository_controller_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_assets_helper_spec.rb +195 -0
- data/test_support/spec/helpers/hydra_djatoka_helper_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +215 -0
- data/test_support/spec/helpers/hydra_helper_spec.rb +73 -0
- data/test_support/spec/helpers/hydra_model_methods_spec.rb +95 -0
- data/test_support/spec/helpers/hydra_uploader_helper_spec.rb +18 -0
- data/test_support/spec/helpers/javascript_includes_helper_spec.rb +43 -0
- data/test_support/spec/integration/file_asset_spec.rb +150 -0
- data/test_support/spec/lib/active_fedora_helper_spec.rb +56 -0
- data/test_support/spec/lib/catalog_spec.rb +16 -0
- data/test_support/spec/lib/common_mods_index_methods_spec.rb +28 -0
- data/test_support/spec/models/audio_asset_spec.rb +23 -0
- data/test_support/spec/models/file_asset_spec.rb +42 -0
- data/test_support/spec/models/generic_content_spec.rb +29 -0
- data/test_support/spec/models/generic_image_spec.rb +58 -0
- data/test_support/spec/models/hydra_rights_metadata_spec.rb +162 -0
- data/test_support/spec/models/image_asset_spec.rb +23 -0
- data/test_support/spec/models/mods_asset_spec.rb +29 -0
- data/test_support/spec/models/role_mapper_spec.rb +22 -0
- data/test_support/spec/models/user_spec.rb +52 -0
- data/test_support/spec/models/video_asset_spec.rb +23 -0
- data/test_support/spec/rcov.opts +3 -0
- data/test_support/spec/spec.opts +4 -0
- data/test_support/spec/spec_helper.rb +44 -0
- data/test_support/spec/support/matchers/helper_matcher.rb +14 -0
- data/test_support/spec/support/matchers/solr_matchers.rb +60 -0
- data/test_support/spec/unit/hydra-head-engine_spec.rb +8 -0
- data/test_support/spec/unit/hydra-head_spec.rb +8 -0
- data/test_support/spec/utilities/hydra_testing_server_spec.rb +49 -0
- data/test_support/spec/views/uploader.html.erb_spec.rb +30 -0
- data/vendor/cache/RedCloth-4.2.3.gem +0 -0
- data/vendor/cache/abstract-1.0.0.gem +0 -0
- data/vendor/cache/actionmailer-3.0.9.gem +0 -0
- data/vendor/cache/actionpack-3.0.9.gem +0 -0
- data/vendor/cache/active-fedora-2.3.3.gem +0 -0
- data/vendor/cache/activemodel-3.0.9.gem +0 -0
- data/vendor/cache/activerecord-3.0.9.gem +0 -0
- data/vendor/cache/activeresource-3.0.9.gem +0 -0
- data/vendor/cache/activesupport-3.0.9.gem +0 -0
- data/vendor/cache/arel-2.0.10.gem +0 -0
- data/vendor/cache/blacklight-3.0.0.gem +0 -0
- data/vendor/cache/block_helpers-0.3.3.gem +0 -0
- data/vendor/cache/builder-2.1.2.gem +0 -0
- data/vendor/cache/capybara-1.0.0.gem +0 -0
- data/vendor/cache/childprocess-0.2.0.gem +0 -0
- data/vendor/cache/columnize-0.3.4.gem +0 -0
- data/vendor/cache/crack-0.1.8.gem +0 -0
- data/vendor/cache/cucumber-1.0.2.gem +0 -0
- data/vendor/cache/cucumber-rails-1.0.2.gem +0 -0
- data/vendor/cache/curb-0.7.15.gem +0 -0
- data/vendor/cache/daemons-1.1.4.gem +0 -0
- data/vendor/cache/database_cleaner-0.6.7.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
- data/vendor/cache/equivalent-xml-0.2.7.gem +0 -0
- data/vendor/cache/erubis-2.6.6.gem +0 -0
- data/vendor/cache/facets-2.8.4.gem +0 -0
- data/vendor/cache/factory_girl-1.3.3.gem +0 -0
- data/vendor/cache/fastercsv-1.5.4.gem +0 -0
- data/vendor/cache/ffi-1.0.9.gem +0 -0
- data/vendor/cache/gherkin-2.4.5.gem +0 -0
- data/vendor/cache/haml-3.1.2.gem +0 -0
- data/vendor/cache/httparty-0.7.8.gem +0 -0
- data/vendor/cache/i18n-0.5.0.gem +0 -0
- data/vendor/cache/jettywrapper-0.0.10.gem +0 -0
- data/vendor/cache/json-1.5.3.gem +0 -0
- data/vendor/cache/json_pure-1.5.3.gem +0 -0
- data/vendor/cache/kaminari-0.12.4.gem +0 -0
- data/vendor/cache/launchy-2.0.3.gem +0 -0
- data/vendor/cache/linecache-0.46.gem +0 -0
- data/vendor/cache/logger-1.2.8.gem +0 -0
- data/vendor/cache/mail-2.2.19.gem +0 -0
- data/vendor/cache/marc-0.4.3.gem +0 -0
- data/vendor/cache/mediashelf-loggable-0.4.2.gem +0 -0
- data/vendor/cache/mime-types-1.16.gem +0 -0
- data/vendor/cache/mocha-0.9.12.gem +0 -0
- data/vendor/cache/multipart-post-1.1.2.gem +0 -0
- data/vendor/cache/nokogiri-1.5.0.gem +0 -0
- data/vendor/cache/om-1.2.5.gem +0 -0
- data/vendor/cache/polyglot-0.3.1.gem +0 -0
- data/vendor/cache/rack-1.2.3.gem +0 -0
- data/vendor/cache/rack-mount-0.6.14.gem +0 -0
- data/vendor/cache/rack-test-0.5.7.gem +0 -0
- data/vendor/cache/rails-3.0.9.gem +0 -0
- data/vendor/cache/railties-3.0.9.gem +0 -0
- data/vendor/cache/rake-0.9.2.gem +0 -0
- data/vendor/cache/rbx-require-relative-0.0.5.gem +0 -0
- data/vendor/cache/rcov-0.9.9.gem +0 -0
- data/vendor/cache/rdoc-3.8.gem +0 -0
- data/vendor/cache/rsolr-1.0.2.gem +0 -0
- data/vendor/cache/rsolr-ext-1.0.3.gem +0 -0
- data/vendor/cache/rspec-2.6.0.gem +0 -0
- data/vendor/cache/rspec-core-2.6.4.gem +0 -0
- data/vendor/cache/rspec-expectations-2.6.0.gem +0 -0
- data/vendor/cache/rspec-mocks-2.6.0.gem +0 -0
- data/vendor/cache/rspec-rails-2.6.1.gem +0 -0
- data/vendor/cache/ruby-debug-0.10.4.gem +0 -0
- data/vendor/cache/ruby-debug-base-0.10.4.gem +0 -0
- data/vendor/cache/rubyzip-0.9.4.gem +0 -0
- data/vendor/cache/sanitize-2.0.3.gem +0 -0
- data/vendor/cache/selenium-webdriver-0.2.2.gem +0 -0
- data/vendor/cache/solr-ruby-0.0.8.gem +0 -0
- data/vendor/cache/solrizer-1.1.0.gem +0 -0
- data/vendor/cache/solrizer-fedora-1.1.0.gem +0 -0
- data/vendor/cache/sqlite3-ruby-1.2.5.gem +0 -0
- data/vendor/cache/stomp-1.1.9.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.5.gem +0 -0
- data/vendor/cache/thor-0.14.6.gem +0 -0
- data/vendor/cache/treetop-1.4.9.gem +0 -0
- data/vendor/cache/trollop-1.16.2.gem +0 -0
- data/vendor/cache/tzinfo-0.3.29.gem +0 -0
- data/vendor/cache/unicode-0.4.0.gem +0 -0
- data/vendor/cache/will_paginate-2.3.15.gem +0 -0
- data/vendor/cache/xml-simple-1.1.0.gem +0 -0
- data/vendor/cache/xpath-0.1.4.gem +0 -0
- data/vendor/cache/yard-0.7.2.gem +0 -0
- metadata +1110 -0
@@ -0,0 +1,155 @@
|
|
1
|
+
module HydraHelper
|
2
|
+
|
3
|
+
# collection of stylesheet links to be rendered in the <head>
|
4
|
+
def stylesheet_links
|
5
|
+
@stylesheet_links ||= []
|
6
|
+
end
|
7
|
+
|
8
|
+
# collection of javascript includes to be rendered in the <head>
|
9
|
+
def javascript_includes
|
10
|
+
@javascript_includes ||= []
|
11
|
+
end
|
12
|
+
|
13
|
+
def async_load_tag( url, tag )
|
14
|
+
javascript_tag do
|
15
|
+
"window._token='#{form_authenticity_token}'"
|
16
|
+
"async_load('#{url}', '\##{tag}');"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def link_to_multifacet( name, args={} )
|
21
|
+
facet_params = {}
|
22
|
+
options = {}
|
23
|
+
args.each_pair do |k,v|
|
24
|
+
if k == :options
|
25
|
+
options = v
|
26
|
+
else
|
27
|
+
facet_params[:f] ||= {}
|
28
|
+
facet_params[:f][k] ||= []
|
29
|
+
v = v.instance_of?(Array) ? v.first : v
|
30
|
+
facet_params[:f][k].push(v)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
link_to(name, catalog_index_path(facet_params), options).html_safe
|
35
|
+
end
|
36
|
+
|
37
|
+
def edit_and_browse_links
|
38
|
+
result = ""
|
39
|
+
if params[:action] == "edit"
|
40
|
+
result << "<a href=\"#{catalog_path(@document[:id], :viewing_context=>"browse")}\" class=\"browse toggle\">Browse</a>"
|
41
|
+
result << "<span class=\"edit toggle active\">Edit</span>"
|
42
|
+
else
|
43
|
+
result << "<span class=\"browse toggle active\">Browse</span>"
|
44
|
+
result << "<a href=\"#{edit_catalog_path(@document[:id])}\" class=\"edit toggle\">Edit</a>"
|
45
|
+
end
|
46
|
+
# result << link_to "Browse", "#", :class=>"browse"
|
47
|
+
# result << link_to "Edit", edit_document_path(@document[:id]), :class=>"edit"
|
48
|
+
return result.html_safe
|
49
|
+
end
|
50
|
+
|
51
|
+
def grouped_result_count(response, facet_name=nil, facet_value=nil)
|
52
|
+
if facet_name && facet_value
|
53
|
+
facet = response.facets.detect {|f| f.name == facet_name}
|
54
|
+
facet_item = facet.items.detect {|i| i.value == facet_value} if facet
|
55
|
+
count = facet_item ? facet_item.hits : 0
|
56
|
+
else
|
57
|
+
count = response.docs.total
|
58
|
+
end
|
59
|
+
pluralize(count, 'document')
|
60
|
+
end
|
61
|
+
|
62
|
+
def grouping_facet
|
63
|
+
fields = Hash[sort_fields]
|
64
|
+
case h(params[:sort])
|
65
|
+
when fields['date -']
|
66
|
+
'year_facet'
|
67
|
+
when fields['date +']
|
68
|
+
'year_facet'
|
69
|
+
when fields['document type']
|
70
|
+
'medium_t'
|
71
|
+
when fields['location']
|
72
|
+
'series_facet'
|
73
|
+
else
|
74
|
+
nil
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def document_fedora_show_html_title
|
79
|
+
@document.datastreams["descMetadata"].title_values.first
|
80
|
+
end
|
81
|
+
|
82
|
+
# Returns the hits for facet_value within facet solr_fname within the solr_result.
|
83
|
+
def facet_value_hits(solr_result, solr_fname, facet_value, default_response="1")
|
84
|
+
item = solr_result.facets.detect {|f| f.name == solr_fname}.items.detect {|i| i.value == facet_value}
|
85
|
+
if item
|
86
|
+
return item.hits
|
87
|
+
else
|
88
|
+
return default_response
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def get_html_data_with_label(doc, label, field_string, opts={})
|
93
|
+
if opts[:default] && !doc[field_string]
|
94
|
+
doc[field_string] = opts[:default]
|
95
|
+
end
|
96
|
+
|
97
|
+
if doc[field_string]
|
98
|
+
field = doc[field_string]
|
99
|
+
text = "<dt>#{label}</dt><dd>"
|
100
|
+
if field.is_a?(Array)
|
101
|
+
field.each do |l|
|
102
|
+
text += "#{CGI::unescapeHTML(l)}"
|
103
|
+
if l != h(field.last)
|
104
|
+
text += "<br/>"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
else
|
108
|
+
text += CGI::unescapeHTML(field)
|
109
|
+
end
|
110
|
+
#Does the field have a vernacular equivalent?
|
111
|
+
if doc["vern_#{field_string}"]
|
112
|
+
vern_field = doc["vern_#{field_string}"]
|
113
|
+
text += "<br/>"
|
114
|
+
if vern_field.is_a?(Array)
|
115
|
+
vern_field.each do |l|
|
116
|
+
text += "#{CGI::unescapeHTML(l)}"
|
117
|
+
if l != h(vern_field.last)
|
118
|
+
text += "<br/>"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
else
|
122
|
+
text += CGI::unescapeHTML(vern_field)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
text += "</dd>"
|
126
|
+
text
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def get_textile_data_with_label(doc, label, field_string, opts={})
|
131
|
+
if opts[:default] && !doc[field_string]
|
132
|
+
doc[field_string] = opts[:default]
|
133
|
+
end
|
134
|
+
|
135
|
+
if doc[field_string]
|
136
|
+
field = doc[field_string]
|
137
|
+
text = "<dt>#{label}</dt><dd>"
|
138
|
+
if field.is_a?(Array)
|
139
|
+
field.each do |l|
|
140
|
+
text += "#{RedCloth.new(l).to_html}"
|
141
|
+
if l != h(field.last)
|
142
|
+
text += "<br/>"
|
143
|
+
end
|
144
|
+
end
|
145
|
+
else
|
146
|
+
text += RedCloth.new(field).to_html
|
147
|
+
end
|
148
|
+
text += "</dd>"
|
149
|
+
text
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module HydraUploaderHelper
|
2
|
+
|
3
|
+
# Generate the appropriate url for posting uploads to
|
4
|
+
# Uses the +container_id+ method to figure out what container uploads should go into
|
5
|
+
def upload_url
|
6
|
+
upload_url = asset_file_assets_path(:asset_id=>container_id)
|
7
|
+
end
|
8
|
+
|
9
|
+
# The id of the container that uploads should be posted into
|
10
|
+
# If params[:container_id] is not set, it uses params[:id] (assumes that you're uploading items into the current object)
|
11
|
+
def container_id
|
12
|
+
if !params[:asset_id].nil?
|
13
|
+
return params[:asset_id]
|
14
|
+
else
|
15
|
+
return params[:id]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module InlineEditableMetadataHelper
|
2
|
+
|
3
|
+
def inline_editable_text_field(object_name, method, options = {})
|
4
|
+
end
|
5
|
+
|
6
|
+
def inline_editable_text_area(object_name, method, options = {})
|
7
|
+
end
|
8
|
+
|
9
|
+
def inline_editable_select(object_name, method, options = {})
|
10
|
+
end
|
11
|
+
|
12
|
+
def inline_editable_checkbox(object_name, method, options = {})
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Use this helper to declare which javascript should be loaded in which views
|
2
|
+
# Internally, it relies on include_javascript_for_#{controller}_#{action} helper methods
|
3
|
+
# These helper methods will usually append their includes to the controller's javascript_includes array
|
4
|
+
#
|
5
|
+
# @example Within your views (or in your controllers), call the helper like this
|
6
|
+
# include_javascript_for "hydrangea_articles", "edit"
|
7
|
+
#
|
8
|
+
# To declare your own array of includes for a specific content type or action, define a helper method in your host application or plugin like this
|
9
|
+
# @example Declaring the javascript includes for hydrangea_datasets show view while reusing the includes from catalog_edit
|
10
|
+
# def include_javascript_for_hydrangea_datasets_show
|
11
|
+
# include_javascript_for_catalog_edit
|
12
|
+
# javascript_includes << ['hydrangeaArticleBehaviors.js', {:plugin=>:hydrangea_articles}]
|
13
|
+
# end
|
14
|
+
module JavascriptIncludesHelper
|
15
|
+
|
16
|
+
# Add the appropriate javascripts for the specified content type & action into the Controller's javascript_includes array
|
17
|
+
# If you have defined custom javascript includes for that content_type & action, they will be used.
|
18
|
+
# @param [String or Symbol] content_type
|
19
|
+
# @param [String or Symbol] action
|
20
|
+
# @example This will rely on the include_javascript_for_hydranea_articles_edit helper method if it's defined. Defaults to calling include_default_javascript("edit")
|
21
|
+
# include_javascript_for "hydrangea_articles", "edit"
|
22
|
+
def include_javascript_for(content_type, action, opts={})
|
23
|
+
begin
|
24
|
+
method_name = "include_javascript_for_#{content_type.to_s}_#{action.to_s}"
|
25
|
+
logger.debug "attempting to include #{method_name}"
|
26
|
+
self.send(method_name.to_sym)
|
27
|
+
rescue
|
28
|
+
logger.debug "... no specific includes defined for #{content_type.to_s}. Using defaults for #{action.to_s} views"
|
29
|
+
include_default_javascript( action )
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Add the default javascript to the controller's javascript_includes
|
34
|
+
# Takes a method argument (ie. show or edit) to decide which defaults to use.
|
35
|
+
# Currently configured to use the javascript includes for catalog show / edit.
|
36
|
+
# @param [String or Symbol] method Currently only "show" and "edit" have defaults set
|
37
|
+
def include_default_javascript(method)
|
38
|
+
case method.to_s
|
39
|
+
when "show"
|
40
|
+
include_javascript_for_catalog_show
|
41
|
+
when "edit"
|
42
|
+
include_javascript_for_catalog_edit
|
43
|
+
else
|
44
|
+
logger.debug "No default javascript includes defined for #{method} views. Doing nothing."
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Helpers for Catalog Show & Edit Javascript Includes
|
50
|
+
#
|
51
|
+
|
52
|
+
# Adds the appropriate javascripts to javascript_includes for CatalogController show views
|
53
|
+
# Override this if you want to change the set of javascript_includes for CatalogController show views
|
54
|
+
def include_javascript_for_catalog_show
|
55
|
+
javascript_includes << ['custom', {:plugin=>"hydra-head"}]
|
56
|
+
|
57
|
+
# This file contains the page initialization scripts for catalog show views
|
58
|
+
javascript_includes << ["catalog/show", {:plugin=>"hydra-head"}]
|
59
|
+
end
|
60
|
+
|
61
|
+
# Adds the appropriate javascripts to javascript_includes for CatalogController edit views
|
62
|
+
# Override this if you want to change the set of javascript_includes for CatalogController edit views
|
63
|
+
def include_javascript_for_catalog_edit
|
64
|
+
# This _would_ include the fluid infusion javascripts, but we don't want them
|
65
|
+
# javascript_includes << infusion_javascripts(:default_no_jquery, :extras=>[:inline_editor_integrations], :debug=>true, :render_html=>false)
|
66
|
+
|
67
|
+
javascript_includes << ["jquery.jeditable.mini.js", {:plugin=>"hydra-head"}]
|
68
|
+
javascript_includes << ["jquery.form.js", {:plugin=>"hydra-head"}]
|
69
|
+
javascript_includes << ['custom', {:plugin=>"hydra-head"}]
|
70
|
+
|
71
|
+
javascript_includes << ["jquery.hydraMetadata.js", {:plugin=>"hydra-head"}]
|
72
|
+
javascript_includes << ["jquery.notice.js", {:plugin=>"hydra-head"}]
|
73
|
+
|
74
|
+
javascript_includes << ["jquery.jeditable.mini.js", "date-picker/js/datepicker", "jquery.form.js", 'custom', "catalog/edit", "jquery.hydraMetadata.js", "jquery.notice.js", {:plugin=>"hydra-head"}]
|
75
|
+
javascript_includes << ["../infusion/components/undo/js/Undo.js", {:plugin=>:"fluid-infusion"}]
|
76
|
+
|
77
|
+
# For DatePicker
|
78
|
+
javascript_includes << ["jquery.ui.widget.js","jquery.ui.datepicker.js", "mediashelf.datepicker.js", {:plugin=>"hydra-head" }]
|
79
|
+
|
80
|
+
# For Fancybox
|
81
|
+
javascript_includes << ["fancybox/jquery.fancybox-1.3.1.pack.js", {:plugin=>"hydra-head"}]
|
82
|
+
stylesheet_links << ["../javascripts/fancybox/jquery.fancybox-1.3.1.css", {:plugin=>"hydra-head"}]
|
83
|
+
|
84
|
+
# For slider controls
|
85
|
+
javascript_includes << ["select_to_ui_slider/selectToUISlider.jQuery.js", {:plugin=>"hydra-head"}]
|
86
|
+
stylesheet_links << ["../javascripts/select_to_ui_slider/css/ui.slider.extras.css", {:plugin=>"hydra-head"}]
|
87
|
+
stylesheet_links << ["slider", {:plugin=>"hydra-head"}]
|
88
|
+
|
89
|
+
# This file contains the page initialization scripts for catalog edit views
|
90
|
+
javascript_includes << ["catalog/edit", {:plugin=>"hydra-head"}]
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module ReleaseProcessHelper
|
2
|
+
|
3
|
+
def display_release_status_notice(document)
|
4
|
+
readiness = document.test_release_readiness
|
5
|
+
if readiness == true
|
6
|
+
flash[:notice] ||= []
|
7
|
+
if document.submitted_for_release?
|
8
|
+
flash[:notice] << "This item has been released for library circulation."
|
9
|
+
else
|
10
|
+
flash[:notice] << "This item is ready to be released for library circulation."
|
11
|
+
end
|
12
|
+
else
|
13
|
+
flash[:error] ||= []
|
14
|
+
flash[:error] = flash[:error] | readiness[:failures]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def check_embargo_date_format
|
19
|
+
if params.keys.include? [:embargo, :embargo_release_date]
|
20
|
+
em_date = params[[:embargo, :embargo_release_date]]["0"]
|
21
|
+
unless em_date.blank?
|
22
|
+
begin
|
23
|
+
!Date.parse(em_date)
|
24
|
+
rescue
|
25
|
+
params[[:embargo,:embargo_release_date]]["0"] = ""
|
26
|
+
raise "Unacceptable date format"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# model for a FileAsset ActiveFedora object
|
2
|
+
# a file asset is a generic notion of a file, which could have, for example, image or text or video behaviors.
|
3
|
+
class FileAsset < ActiveFedora::Base
|
4
|
+
|
5
|
+
include Hydra::ModelMethods
|
6
|
+
|
7
|
+
has_relationship "is_member_of_collection", :has_collection_member, :inbound => true
|
8
|
+
has_bidirectional_relationship "part_of", :is_part_of, :has_part
|
9
|
+
|
10
|
+
# deletes the object identified by pid if it does not have any objects asserting has_collection_member
|
11
|
+
def self.garbage_collect(pid)
|
12
|
+
begin
|
13
|
+
obj = FileAsset.load_instance(pid)
|
14
|
+
if obj.containers.empty?
|
15
|
+
obj.delete
|
16
|
+
end
|
17
|
+
rescue
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Returns a human readable filesize appropriate for the given number of bytes (ie. automatically chooses 'bytes','KB','MB','GB','TB')
|
22
|
+
# Based on a bit of python code posted here: http://blogmag.net/blog/read/38/Print_human_readable_file_size
|
23
|
+
# @param [Numeric] file size in bits
|
24
|
+
def bits_to_human_readable(num)
|
25
|
+
['bytes','KB','MB','GB','TB'].each do |x|
|
26
|
+
if num < 1024.0
|
27
|
+
return "#{num.to_i} #{x}"
|
28
|
+
else
|
29
|
+
num = num/1024.0
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
has_metadata :name => "descMetadata", :type => ActiveFedora::QualifiedDublinCoreDatastream do |m|
|
35
|
+
end
|
36
|
+
|
37
|
+
def label=(label)
|
38
|
+
super
|
39
|
+
datastreams_in_memory["descMetadata"].title_values = label
|
40
|
+
end
|
41
|
+
|
42
|
+
# augments add_file_datastream to also put file size (in bytes/KB/MB/GB/TB) in dc:extent
|
43
|
+
def add_file_datastream(file, opts={})
|
44
|
+
super
|
45
|
+
if file.respond_to?(:size)
|
46
|
+
size = bits_to_human_readable(file.size)
|
47
|
+
elsif file.kind_of?(File)
|
48
|
+
size = bits_to_human_readable(File.size(file))
|
49
|
+
else
|
50
|
+
size = ""
|
51
|
+
end
|
52
|
+
datastreams_in_memory["descMetadata"].extent_values = size
|
53
|
+
end
|
54
|
+
|
55
|
+
# Mimic the relationship accessor that would be created if a containers relationship existed
|
56
|
+
# Decided to create this method instead because it combines more than one relationship list
|
57
|
+
# from is_member_of_collection and part_of
|
58
|
+
# @param [Hash] opts The options hash that can contain a :response_format value of :id_array, :solr, or :load_from_solr
|
59
|
+
# @return [Array] Objects found through inbound has_collection_member and part_of relationships
|
60
|
+
def containers(opts={})
|
61
|
+
is_member_array = is_member_of_collection(:response_format=>:id_array)
|
62
|
+
|
63
|
+
if !is_member_array.empty?
|
64
|
+
logger.warn "This object has inbound collection member assertions. hasCollectionMember will no longer be used to track file_object relationships after active_fedora 1.3. Use isPartOf assertions in the RELS-EXT of child objects instead."
|
65
|
+
if opts[:response_format] == :solr || opts[:response_format] == :load_from_solr
|
66
|
+
logger.warn ":solr and :load_from_solr response formats for containers search only uses parts relationships (usage of hasCollectionMember is no longer supported)"
|
67
|
+
result = part_of(opts)
|
68
|
+
else
|
69
|
+
con_result = is_member_of_collection(opts)
|
70
|
+
part_of_result = part_of(opts)
|
71
|
+
ary = con_result+part_of_result
|
72
|
+
result = ary.uniq
|
73
|
+
end
|
74
|
+
else
|
75
|
+
result = part_of(opts)
|
76
|
+
end
|
77
|
+
return result
|
78
|
+
end
|
79
|
+
|
80
|
+
# Calls +containers+ with the :id_array option to return a list of pids for containers found.
|
81
|
+
# @return [Array] Container ids (via is_member_of_collection and part_of relationships)
|
82
|
+
def containers_ids
|
83
|
+
containers(:response_format => :id_array)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Calls +containers+ with the option to load objects found from solr instead of Fedora.
|
87
|
+
# @return [Array] ActiveFedora::Base objects populated via solr
|
88
|
+
def containers_from_solr
|
89
|
+
containers(:response_format => :load_from_solr)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Override ActiveFedora::Base.to_solr to...
|
93
|
+
# Check if we are dealing with a child of FileAsset and if so when calling to_solr from Solrizer indexer we want to skip loading parent metadata again
|
94
|
+
#
|
95
|
+
# if known models greater than one (without ActiveFedora::Base) and
|
96
|
+
# known models contains a child of FileAsset and
|
97
|
+
# opts[:model_only] == true and
|
98
|
+
# current object class is FileAsset
|
99
|
+
# that means that the child already has had to_solr called which included metadata from FileAsset
|
100
|
+
# if any of the above is false then call to_solr as normal
|
101
|
+
def to_solr(solr_doc=Hash.new, opts={})
|
102
|
+
|
103
|
+
active_fedora_model_s = solr_doc["active_fedora_model_s"] if solr_doc["active_fedora_model_s"]
|
104
|
+
actual_class = active_fedora_model_s.constantize if active_fedora_model_s
|
105
|
+
if actual_class && actual_class != self.class && actual_class.superclass == FileAsset
|
106
|
+
solr_doc
|
107
|
+
else
|
108
|
+
super(solr_doc,opts)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'hydra'
|
2
|
+
|
3
|
+
class GenericContent < ActiveFedora::Base
|
4
|
+
include Hydra::ModelMethods
|
5
|
+
include Hydra::GenericContent
|
6
|
+
|
7
|
+
# Uses the Hydra Rights Metadata Schema for tracking access permissions & copyright
|
8
|
+
has_metadata :name => "rightsMetadata", :type => Hydra::RightsMetadata
|
9
|
+
|
10
|
+
has_metadata :name => "descMetadata", :type => Hydra::ModsGenericContent
|
11
|
+
|
12
|
+
# A place to put extra metadata values
|
13
|
+
has_metadata :name => "properties", :type => ActiveFedora::MetadataDatastream do |m|
|
14
|
+
m.field 'collection', :string
|
15
|
+
m.field 'depositor', :string
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize( attrs={} )
|
19
|
+
super
|
20
|
+
end
|
21
|
+
end
|