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
data/hydra-head.gemspec
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "hydra-head/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "hydra-head"
|
7
|
+
s.version = HydraHead::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Matt Zumwalt, Bess Sadler, Julie Meloni, Naomi Dushay, Jessie Keck, John Scofield, Justin Coyne & many more. See https://github.com/projecthydra/hydra-head/contributors"]
|
10
|
+
s.email = ["hydra-tech@googlegroups.com"]
|
11
|
+
s.homepage = "http://projecthydra.org"
|
12
|
+
s.summary = %q{Hydra-Head Rails Engine (requires Rails3) }
|
13
|
+
s.description = %q{Hydra-Head is a Rails Engine containing the core code for a Hydra application. The full hydra stack includes: Blacklight, Fedora, Solr, active-fedora, solrizer, and om}
|
14
|
+
|
15
|
+
s.add_dependency "rails", '>= 3.0'
|
16
|
+
s.add_dependency "blacklight", '3.0.0'
|
17
|
+
s.add_dependency "active-fedora", '>= 2.3.3'
|
18
|
+
s.add_dependency 'builder'
|
19
|
+
s.add_dependency 'columnize'
|
20
|
+
s.add_dependency 'crack'
|
21
|
+
s.add_dependency 'curb'
|
22
|
+
s.add_dependency 'database_cleaner'
|
23
|
+
s.add_dependency 'diff-lcs'
|
24
|
+
s.add_dependency 'facets', '2.8.4'
|
25
|
+
s.add_dependency 'haml'
|
26
|
+
s.add_dependency 'httparty'
|
27
|
+
s.add_dependency 'json_pure', '>1.4.3'
|
28
|
+
s.add_dependency 'launchy'
|
29
|
+
s.add_dependency 'linecache'
|
30
|
+
s.add_dependency 'mime-types'
|
31
|
+
s.add_dependency 'multipart-post'
|
32
|
+
s.add_dependency 'nokogiri' # Default to using the version required by Blacklight
|
33
|
+
s.add_dependency 'om', '>=1.2.3'
|
34
|
+
s.add_dependency 'rack'
|
35
|
+
s.add_dependency 'rack-test'
|
36
|
+
s.add_dependency 'rake'
|
37
|
+
s.add_dependency 'rcov'
|
38
|
+
s.add_dependency 'RedCloth', '=4.2.3'
|
39
|
+
s.add_dependency 'solr-ruby'
|
40
|
+
s.add_dependency 'solrizer', '>=1.1.0'
|
41
|
+
s.add_dependency 'solrizer-fedora', '>=1.1.0'
|
42
|
+
s.add_dependency 'sqlite3-ruby', '1.2.5'
|
43
|
+
s.add_dependency 'term-ansicolor'
|
44
|
+
s.add_dependency 'trollop'
|
45
|
+
s.add_dependency 'will_paginate'
|
46
|
+
s.add_dependency 'xml-simple'
|
47
|
+
s.add_dependency 'yard'
|
48
|
+
s.add_dependency 'block_helpers'
|
49
|
+
s.add_dependency 'sanitize'
|
50
|
+
|
51
|
+
s.add_development_dependency 'jettywrapper', "~> 0.0.10"
|
52
|
+
s.add_development_dependency 'ruby-debug'
|
53
|
+
s.add_development_dependency 'ruby-debug-base'
|
54
|
+
s.add_development_dependency 'rspec', '>= 2.0.0'
|
55
|
+
s.add_development_dependency 'rspec-rails', '>= 2.0.0' # rspec-rails 2.0.0 requires Rails 3.
|
56
|
+
s.add_development_dependency 'mocha'
|
57
|
+
s.add_development_dependency 'cucumber', '>=0.8.5'
|
58
|
+
s.add_development_dependency 'cucumber-rails', '>=1.0.0'
|
59
|
+
# s.add_development_dependency 'capybara'
|
60
|
+
s.add_development_dependency 'gherkin'
|
61
|
+
s.add_development_dependency 'factory_girl'
|
62
|
+
#s.add_development_dependency 'markup_validity'
|
63
|
+
s.add_development_dependency "rake"
|
64
|
+
|
65
|
+
|
66
|
+
s.files = `git ls-files`.split("\n")
|
67
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
68
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
69
|
+
s.require_paths = ["lib"]
|
70
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module HydraHead
|
2
|
+
## Define ControllerMethods
|
3
|
+
module Controller
|
4
|
+
## this one manages the usual self.included, klass_eval stuff
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
before_filter :method_for_before_filtering
|
9
|
+
end
|
10
|
+
|
11
|
+
module InstanceMethods
|
12
|
+
def method_for_before_filtering
|
13
|
+
#puts "Filtering before"
|
14
|
+
end
|
15
|
+
|
16
|
+
def method_not_a_filter
|
17
|
+
puts "not used as a filter"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
::ActionController::Base.send :include, HydraHead::Controller
|
24
|
+
|
25
|
+
|
data/lib/engine.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'hydra-head'
|
2
|
+
require 'rails'
|
3
|
+
require 'action_controller'
|
4
|
+
require 'application_helper'
|
5
|
+
|
6
|
+
module HydraHead
|
7
|
+
class Engine < Rails::Engine
|
8
|
+
|
9
|
+
# Config defaults
|
10
|
+
config.mount_at = '/'
|
11
|
+
|
12
|
+
# Load rake tasks
|
13
|
+
rake_tasks do
|
14
|
+
Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)),'railties', '*.rake')).each do |railtie|
|
15
|
+
load railtie
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Check the gem config
|
20
|
+
initializer "check config" do |app|
|
21
|
+
# make sure mount_at ends with trailing slash
|
22
|
+
config.mount_at += '/' unless config.mount_at.last == '/'
|
23
|
+
end
|
24
|
+
|
25
|
+
initializer "static assets" do |app|
|
26
|
+
app.middleware.use ::ActionDispatch::Static, "#{root}/public"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'rails/generators'
|
3
|
+
require 'rails/generators/migration'
|
4
|
+
|
5
|
+
# require "generators/blacklight/blacklight_generator"
|
6
|
+
|
7
|
+
module Hydra
|
8
|
+
class HeadGenerator < Rails::Generators::Base
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
|
11
|
+
source_root File.expand_path('../templates', __FILE__)
|
12
|
+
|
13
|
+
argument :model_name, :type => :string , :default => "user"
|
14
|
+
|
15
|
+
desc """
|
16
|
+
This generator makes the following changes to your application:
|
17
|
+
1. Creates several database migrations if they do not exist in /db/migrate
|
18
|
+
2. Adds additional mime types to you application in the file '/config/initializers/mime_types.rb'
|
19
|
+
3. Creates config/initializers/hydra_config.rb
|
20
|
+
4. Creates config/initializers/fedora_config.rb
|
21
|
+
5. Creates config/fedora.yml and config/solr.yml which you may need to modify to tell the hydra head where to find fedora & solr
|
22
|
+
6. Creates a number of role_map config files that are used in the placeholder user roles implementation
|
23
|
+
Enjoy building your Hydra Head!
|
24
|
+
"""
|
25
|
+
|
26
|
+
#
|
27
|
+
# Config Files & Initializers
|
28
|
+
#
|
29
|
+
|
30
|
+
# Copy all files in templates/config directory to host config
|
31
|
+
def create_configuration_files
|
32
|
+
# Initializers
|
33
|
+
copy_file "config/initializers/fedora_config.rb", "config/initializers/fedora_config.rb"
|
34
|
+
copy_file "config/initializers/hydra_config.rb", "config/initializers/hydra_config.rb"
|
35
|
+
copy_file "config/initializers/blacklight_config.rb", "config/initializers/blacklight_config.rb"
|
36
|
+
|
37
|
+
# Role Mappings
|
38
|
+
copy_file "config/role_map_cucumber.yml", "config/role_map_cucumber.yml"
|
39
|
+
copy_file "config/role_map_development.yml", "config/role_map_development.yml"
|
40
|
+
copy_file "config/role_map_production.yml", "config/role_map_production.yml"
|
41
|
+
copy_file "config/role_map_test.yml", "config/role_map_test.yml"
|
42
|
+
|
43
|
+
# Solr Mappings
|
44
|
+
copy_file "config/solr_mappings.yml", "config/solr_mappings.yml"
|
45
|
+
|
46
|
+
# Fedora & Solr YAML files
|
47
|
+
copy_file "config/fedora.yml", "config/fedora.yml"
|
48
|
+
copy_file "config/solr.yml", "config/solr.yml"
|
49
|
+
|
50
|
+
# Fedora & Solr Config files
|
51
|
+
directory "fedora_conf"
|
52
|
+
directory "solr_conf"
|
53
|
+
# directory "../../../../fedora_conf", "fedora_conf"
|
54
|
+
# directory "../../../../solr_conf", "solr_conf"
|
55
|
+
end
|
56
|
+
|
57
|
+
# Register mimetypes required by hydra-head
|
58
|
+
def add_mime_types
|
59
|
+
puts "Updating Mime Types"
|
60
|
+
insert_into_file "config/initializers/mime_types.rb", :before => 'Mime::Type.register_alias "text/plain", :refworks_marc_txt' do <<EOF
|
61
|
+
# Mime Types Added By Hydra Head:
|
62
|
+
|
63
|
+
# Mime::Type.register "text/html", :html
|
64
|
+
# Mime::Type.register "application/pdf", :pdf
|
65
|
+
# Mime::Type.register "image/jpeg2000", :jp2
|
66
|
+
Mime::Type.register_alias "text/html", :textile
|
67
|
+
Mime::Type.register_alias "text/html", :inline
|
68
|
+
|
69
|
+
EOF
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
#
|
74
|
+
# Migrations
|
75
|
+
#
|
76
|
+
|
77
|
+
# Implement the required interface for Rails::Generators::Migration.
|
78
|
+
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
79
|
+
def self.next_migration_number(dirname)
|
80
|
+
unless @previous_migration_nr
|
81
|
+
if ActiveRecord::Base.timestamped_migrations
|
82
|
+
@previous_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
83
|
+
else
|
84
|
+
@previous_migration_nr = "%.3d" % (current_migration_number(dirname) + 1).to_i
|
85
|
+
end
|
86
|
+
else
|
87
|
+
@previous_migration_nr +=1
|
88
|
+
end
|
89
|
+
@previous_migration_nr.to_s
|
90
|
+
end
|
91
|
+
|
92
|
+
# Add Hydra behaviors to the user model
|
93
|
+
def inject_hydra_user_behavior
|
94
|
+
file_path = "app/models/#{model_name.underscore}.rb"
|
95
|
+
if File.exists?(file_path)
|
96
|
+
inject_into_class file_path, model_name.classify do
|
97
|
+
"# Connects this user object to Hydra behaviors. " +
|
98
|
+
"\n include Hydra::User\n"
|
99
|
+
end
|
100
|
+
else
|
101
|
+
puts " \e[31mFailure\e[0m Hydra requires a user object in order to apply access controls. This generators assumes that the model is defined in the file /app/models/user.rb, which does not exist. If you used a different name, please re-run the migration and provide that name as an argument. Such as \b rails -g hydra:head client"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Add Hydra behaviors and Filters to CatalogController
|
106
|
+
def inject_hydra_catalog_behavior
|
107
|
+
puts "Adding Hydra behaviors to CatalogController"
|
108
|
+
controller_name = "catalog_controller"
|
109
|
+
file_path = "app/controllers/#{controller_name.underscore}.rb"
|
110
|
+
if File.exists?(file_path)
|
111
|
+
insert_into_file file_path, :after => 'include Blacklight::Catalog' do
|
112
|
+
"\n # Extend Blacklight::Catalog with Hydra behaviors (primarily editing)." +
|
113
|
+
"\n include Hydra::Catalog\n" +
|
114
|
+
"\n # These before_filters apply the hydra access controls" +
|
115
|
+
"\n before_filter :enforce_access_controls" +
|
116
|
+
"\n before_filter :enforce_viewing_context_for_show_requests, :only=>:show" +
|
117
|
+
"\n # This applies appropriate access controls to all solr queries" +
|
118
|
+
"\n CatalogController.solr_search_params_logic << :add_access_controls_to_solr_params"
|
119
|
+
end
|
120
|
+
else
|
121
|
+
puts " \e[31mFailure\e[0m Could not find #{model_name.underscore}.rb. To add Hydra behaviors to your Blacklight::Catalog Controllers, you must include the Hydra::Controller module in the Controller class definition. See the Hydra::Controller section in the Hydra API Docs for more info."
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Inject call to HydraHead.add_routes in config/routes.rb
|
126
|
+
def inject_hydra_routes
|
127
|
+
insert_into_file "config/routes.rb", :after => 'Blacklight.add_routes(self)' do
|
128
|
+
"\n # Add Hydra routes. For options, see API docs for HydraHead.routes"
|
129
|
+
"\n HydraHead.add_routes(self)"
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
# Add Hydra to the application controller
|
134
|
+
def inject_blacklight_controller_behavior
|
135
|
+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
136
|
+
" # Adds Hydra behaviors into the application controller \n " +
|
137
|
+
" include Hydra::Controller\n"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def create_migration_file
|
142
|
+
migration_template 'migrations/add_user_attributes_table.rb', 'db/migrate/add_user_attributes_table.rb'
|
143
|
+
sleep 1 # ensure scripts have different time stamps
|
144
|
+
migration_template 'migrations/create_superusers.rb', 'db/migrate/create_superusers.rb'
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
end # HeadGenerator
|
152
|
+
end # Hydra
|
@@ -0,0 +1,17 @@
|
|
1
|
+
development:
|
2
|
+
fedora:
|
3
|
+
url: http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora
|
4
|
+
solr:
|
5
|
+
url: http://localhost:8983/solr/development
|
6
|
+
test: &TEST
|
7
|
+
fedora:
|
8
|
+
url: http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora
|
9
|
+
solr:
|
10
|
+
url: http://localhost:8983/solr/test
|
11
|
+
production:
|
12
|
+
fedora:
|
13
|
+
url: http://fedoraAdmin:fedoraAdmin@your.production.server:8080/fedora
|
14
|
+
solr:
|
15
|
+
url: http://your.production.server:8080/solr
|
16
|
+
cucumber:
|
17
|
+
<<: *TEST
|
@@ -0,0 +1,246 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
# You can configure Blacklight from here.
|
3
|
+
#
|
4
|
+
# Blacklight.configure(:environment) do |config| end
|
5
|
+
#
|
6
|
+
# :shared (or leave it blank) is used by all environments.
|
7
|
+
# You can override a shared key by using that key in a particular
|
8
|
+
# environment's configuration.
|
9
|
+
#
|
10
|
+
# If you have no configuration beyond :shared for an environment, you
|
11
|
+
# do not need to call configure() for that envirnoment.
|
12
|
+
#
|
13
|
+
# For specific environments:
|
14
|
+
#
|
15
|
+
# Blacklight.configure(:test) {}
|
16
|
+
# Blacklight.configure(:development) {}
|
17
|
+
# Blacklight.configure(:production) {}
|
18
|
+
#
|
19
|
+
|
20
|
+
Blacklight.configure(:shared) do |config|
|
21
|
+
|
22
|
+
config[:default_solr_params] = {
|
23
|
+
:qt => "search",
|
24
|
+
:per_page => 10
|
25
|
+
}
|
26
|
+
|
27
|
+
# solr field values given special treatment in the show (single result) view
|
28
|
+
config[:show] = {
|
29
|
+
:html_title => "title_t",
|
30
|
+
:heading => "title_t",
|
31
|
+
:display_type => "has_model_s"
|
32
|
+
}
|
33
|
+
|
34
|
+
# solr fld values given special treatment in the index (search results) view
|
35
|
+
config[:index] = {
|
36
|
+
:show_link => "title_t",
|
37
|
+
:record_display_type => "id"
|
38
|
+
}
|
39
|
+
|
40
|
+
# solr fields that will be treated as facets by the blacklight application
|
41
|
+
# The ordering of the field names is the order of the display
|
42
|
+
# TODO: Reorganize facet data structures supplied in config to make simpler
|
43
|
+
# for human reading/writing, kind of like search_fields. Eg,
|
44
|
+
# config[:facet] << {:field_name => "format", :label => "Format", :limit => 10}
|
45
|
+
config[:facet] = {
|
46
|
+
:field_names => (facet_fields = [
|
47
|
+
"format",
|
48
|
+
"pub_date",
|
49
|
+
"subject_topic_facet",
|
50
|
+
"language_facet",
|
51
|
+
"lc_1letter_facet",
|
52
|
+
"subject_geo_facet",
|
53
|
+
"subject_era_facet"
|
54
|
+
]),
|
55
|
+
:labels => {
|
56
|
+
"format" => "Format",
|
57
|
+
"pub_date" => "Publication Year",
|
58
|
+
"subject_topic_facet" => "Topic",
|
59
|
+
"language_facet" => "Language",
|
60
|
+
"lc_1letter_facet" => "Call Number",
|
61
|
+
"subject_era_facet" => "Era",
|
62
|
+
"subject_geo_facet" => "Region"
|
63
|
+
},
|
64
|
+
# Setting a limit will trigger Blacklight's 'more' facet values link.
|
65
|
+
# * If left unset, then all facet values returned by solr will be displayed.
|
66
|
+
# * If set to an integer, then "f.somefield.facet.limit" will be added to
|
67
|
+
# solr request, with actual solr request being +1 your configured limit --
|
68
|
+
# you configure the number of items you actually want _displayed_ in a page.
|
69
|
+
# * If set to 'true', then no additional parameters will be sent to solr,
|
70
|
+
# but any 'sniffed' request limit parameters will be used for paging, with
|
71
|
+
# paging at requested limit -1. Can sniff from facet.limit or
|
72
|
+
# f.specific_field.facet.limit solr request params. This 'true' config
|
73
|
+
# can be used if you set limits in :default_solr_params, or as defaults
|
74
|
+
# on the solr side in the request handler itself. Request handler defaults
|
75
|
+
# sniffing requires solr requests to be made with "echoParams=all", for
|
76
|
+
# app code to actually have it echo'd back to see it.
|
77
|
+
:limits => {
|
78
|
+
"subject_topic_facet" => 20,
|
79
|
+
"language_facet" => true
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
# Have BL send all facet field names to Solr, which has been the default
|
84
|
+
# previously. Simply remove these lines if you'd rather use Solr request
|
85
|
+
# handler defaults, or have no facets.
|
86
|
+
config[:default_solr_params] ||= {}
|
87
|
+
config[:default_solr_params][:"facet.field"] = facet_fields
|
88
|
+
|
89
|
+
# solr fields to be displayed in the index (search results) view
|
90
|
+
# The ordering of the field names is the order of the display
|
91
|
+
config[:index_fields] = {
|
92
|
+
:field_names => [
|
93
|
+
"title_display",
|
94
|
+
"title_vern_display",
|
95
|
+
"author_display",
|
96
|
+
"author_vern_display",
|
97
|
+
"format",
|
98
|
+
"language_facet",
|
99
|
+
"published_display",
|
100
|
+
"published_vern_display",
|
101
|
+
"lc_callnum_display"
|
102
|
+
],
|
103
|
+
:labels => {
|
104
|
+
"title_display" => "Title:",
|
105
|
+
"title_vern_display" => "Title:",
|
106
|
+
"author_display" => "Author:",
|
107
|
+
"author_vern_display" => "Author:",
|
108
|
+
"format" => "Format:",
|
109
|
+
"language_facet" => "Language:",
|
110
|
+
"published_display" => "Published:",
|
111
|
+
"published_vern_display" => "Published:",
|
112
|
+
"lc_callnum_display" => "Call number:"
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
# solr fields to be displayed in the show (single result) view
|
117
|
+
# The ordering of the field names is the order of the display
|
118
|
+
config[:show_fields] = {
|
119
|
+
:field_names => [
|
120
|
+
"title_display",
|
121
|
+
"title_vern_display",
|
122
|
+
"subtitle_display",
|
123
|
+
"subtitle_vern_display",
|
124
|
+
"author_display",
|
125
|
+
"author_vern_display",
|
126
|
+
"format",
|
127
|
+
"url_fulltext_display",
|
128
|
+
"url_suppl_display",
|
129
|
+
"material_type_display",
|
130
|
+
"language_facet",
|
131
|
+
"published_display",
|
132
|
+
"published_vern_display",
|
133
|
+
"lc_callnum_display",
|
134
|
+
"isbn_t"
|
135
|
+
],
|
136
|
+
:labels => {
|
137
|
+
"title_display" => "Title:",
|
138
|
+
"title_vern_display" => "Title:",
|
139
|
+
"subtitle_display" => "Subtitle:",
|
140
|
+
"subtitle_vern_display" => "Subtitle:",
|
141
|
+
"author_display" => "Author:",
|
142
|
+
"author_vern_display" => "Author:",
|
143
|
+
"format" => "Format:",
|
144
|
+
"url_fulltext_display" => "URL:",
|
145
|
+
"url_suppl_display" => "More Information:",
|
146
|
+
"material_type_display" => "Physical description:",
|
147
|
+
"language_facet" => "Language:",
|
148
|
+
"published_display" => "Published:",
|
149
|
+
"published_vern_display" => "Published:",
|
150
|
+
"lc_callnum_display" => "Call number:",
|
151
|
+
"isbn_t" => "ISBN:"
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
# "fielded" search configuration. Used by pulldown among other places.
|
157
|
+
# For supported keys in hash, see rdoc for Blacklight::SearchFields
|
158
|
+
#
|
159
|
+
# Search fields will inherit the :qt solr request handler from
|
160
|
+
# config[:default_solr_parameters], OR can specify a different one
|
161
|
+
# with a :qt key/value. Below examples inherit, except for subject
|
162
|
+
# that specifies the same :qt as default for our own internal
|
163
|
+
# testing purposes.
|
164
|
+
#
|
165
|
+
# The :key is what will be used to identify this BL search field internally,
|
166
|
+
# as well as in URLs -- so changing it after deployment may break bookmarked
|
167
|
+
# urls. A display label will be automatically calculated from the :key,
|
168
|
+
# or can be specified manually to be different.
|
169
|
+
config[:search_fields] ||= []
|
170
|
+
|
171
|
+
# This one uses all the defaults set by the solr request handler. Which
|
172
|
+
# solr request handler? The one set in config[:default_solr_parameters][:qt],
|
173
|
+
# since we aren't specifying it otherwise.
|
174
|
+
config[:search_fields] << {
|
175
|
+
:key => "all_fields",
|
176
|
+
:display_label => 'All Fields'
|
177
|
+
}
|
178
|
+
|
179
|
+
# Now we see how to over-ride Solr request handler defaults, in this
|
180
|
+
# case for a BL "search field", which is really a dismax aggregate
|
181
|
+
# of Solr search fields.
|
182
|
+
config[:search_fields] << {
|
183
|
+
:key => 'title',
|
184
|
+
# solr_parameters hash are sent to Solr as ordinary url query params.
|
185
|
+
:solr_parameters => {
|
186
|
+
:"spellcheck.dictionary" => "title"
|
187
|
+
},
|
188
|
+
# :solr_local_parameters will be sent using Solr LocalParams
|
189
|
+
# syntax, as eg {! qf=$title_qf }. This is neccesary to use
|
190
|
+
# Solr parameter de-referencing like $title_qf.
|
191
|
+
# See: http://wiki.apache.org/solr/LocalParams
|
192
|
+
:solr_local_parameters => {
|
193
|
+
:qf => "$title_qf",
|
194
|
+
:pf => "$title_pf"
|
195
|
+
}
|
196
|
+
}
|
197
|
+
config[:search_fields] << {
|
198
|
+
:key =>'author',
|
199
|
+
:solr_parameters => {
|
200
|
+
:"spellcheck.dictionary" => "author"
|
201
|
+
},
|
202
|
+
:solr_local_parameters => {
|
203
|
+
:qf => "$author_qf",
|
204
|
+
:pf => "$author_pf"
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
# Specifying a :qt only to show it's possible, and so our internal automated
|
209
|
+
# tests can test it. In this case it's the same as
|
210
|
+
# config[:default_solr_parameters][:qt], so isn't actually neccesary.
|
211
|
+
config[:search_fields] << {
|
212
|
+
:key => 'subject',
|
213
|
+
:qt=> 'search',
|
214
|
+
:solr_parameters => {
|
215
|
+
:"spellcheck.dictionary" => "subject"
|
216
|
+
},
|
217
|
+
:solr_local_parameters => {
|
218
|
+
:qf => "$subject_qf",
|
219
|
+
:pf => "$subject_pf"
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
# "sort results by" select (pulldown)
|
224
|
+
# label in pulldown is followed by the name of the SOLR field to sort by and
|
225
|
+
# whether the sort is ascending or descending (it must be asc or desc
|
226
|
+
# except in the relevancy case).
|
227
|
+
# label is key, solr field is value
|
228
|
+
config[:sort_fields] ||= []
|
229
|
+
config[:sort_fields] << ['relevance', 'score desc, pub_date_sort desc, title_sort asc']
|
230
|
+
config[:sort_fields] << ['year', 'pub_date_sort desc, title_sort asc']
|
231
|
+
config[:sort_fields] << ['author', 'author_sort asc, title_sort asc']
|
232
|
+
config[:sort_fields] << ['title', 'title_sort asc, pub_date_sort desc']
|
233
|
+
|
234
|
+
# If there are more than this many search results, no spelling ("did you
|
235
|
+
# mean") suggestion is offered.
|
236
|
+
config[:spell_max] = 5
|
237
|
+
|
238
|
+
# Add documents to the list of object formats that are supported for all objects.
|
239
|
+
# This parameter is a hash, identical to the Blacklight::Solr::Document#export_formats
|
240
|
+
# output; keys are format short-names that can be exported. Hash includes:
|
241
|
+
# :content-type => mime-content-type
|
242
|
+
config[:unapi] = {
|
243
|
+
'oai_dc_xml' => { :content_type => 'text/xml' }
|
244
|
+
}
|
245
|
+
end
|
246
|
+
|