commonwealth-vlr-engine 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +91 -0
- data/.gitmodules +3 -0
- data/Gemfile +20 -0
- data/LICENSE +202 -0
- data/README.md +38 -0
- data/Rakefile +43 -0
- data/app/assets/images/commonwealth-vlr-engine/bplLoginButton.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/dc_audio-icon.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/dc_collection-icon.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/dc_image-icon.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/dc_institution-icon.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/dc_moving-image-icon.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/dc_text-icon.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/facebookLoginButton.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/loading-wdl-grid.gif +0 -0
- data/app/assets/images/commonwealth-vlr-engine/loading-wdl.gif +0 -0
- data/app/assets/images/commonwealth-vlr-engine/loading.gif +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_grouphover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_hover.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_pressed.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_rest.png +0 -0
- data/app/assets/images/commonwealth-vlr-engine/vlr_logo_img.png +0 -0
- data/app/assets/javascripts/blacklight_gallery.js +1 -0
- data/app/assets/javascripts/blacklight_google_analytics/blacklight_google_analytics.js.erb +165 -0
- data/app/assets/javascripts/bootstrap-accessibility-plugin/bootstrap-accessibility.js +586 -0
- data/app/assets/javascripts/commonwealth-vlr-engine.js +22 -0
- data/app/assets/javascripts/commonwealth-vlr-engine/collection_facets.js +5 -0
- data/app/assets/javascripts/commonwealth-vlr-engine/disable_dropdown_nav.js +21 -0
- data/app/assets/javascripts/commonwealth-vlr-engine/feedback_alerts.js.erb +19 -0
- data/app/assets/javascripts/commonwealth-vlr-engine/folder_tools.js +26 -0
- data/app/assets/javascripts/commonwealth-vlr-engine/multi_img_viewer.js.erb +20 -0
- data/app/assets/javascripts/commonwealth-vlr-engine/ocr_search_utils.js.erb +32 -0
- data/app/assets/javascripts/commonwealth-vlr-engine/volumes_list.js +5 -0
- data/app/assets/javascripts/openseadragon.js +2 -0
- data/app/assets/javascripts/respond/respond.min.js +6 -0
- data/app/assets/javascripts/wdl-viewer/fd-slider.js +1303 -0
- data/app/assets/javascripts/wdl-viewer/jquery-deparam.js +113 -0
- data/app/assets/javascripts/wdl-viewer/jquery.ba-throttle-debounce.min.js +9 -0
- data/app/assets/javascripts/wdl-viewer/jquery.hammer.min.js +7 -0
- data/app/assets/javascripts/wdl-viewer/modernizr-wdl.min.js +3 -0
- data/app/assets/javascripts/wdl-viewer/wdl-search.js +33 -0
- data/app/assets/javascripts/wdl-viewer/wdl-viewer_commonwealth.js +1147 -0
- data/app/assets/stylesheets/blacklight_advanced_search.css +5 -0
- data/app/assets/stylesheets/blacklight_gallery.css +1 -0
- data/app/assets/stylesheets/blacklight_maps.css +1 -0
- data/app/assets/stylesheets/bootstrap-accessibility-plugin/bootstrap-accessibility.css +105 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/advanced_search.scss +139 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/basic_search.scss +47 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/book_viewer.scss +576 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/carousel.scss +94 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/cmmnwlth_defaults.scss +45 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/cmmnwlth_shared.scss +75 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/collections.scss +563 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/commonwealth-vlr-engine.css +32 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/facets.scss +111 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/feedback.scss +10 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/folders.scss +276 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/footer.scss +47 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/header.scss +329 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/home.scss +269 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/index.scss +580 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/institutions.scss +246 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/pages.scss +31 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/search_inside.scss +172 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/searches.scss +55 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/show.scss +840 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/signin.scss +43 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/users.scss +18 -0
- data/app/assets/stylesheets/commonwealth-vlr-engine/vlr_dependencies.css +8 -0
- data/app/assets/stylesheets/ie_fixes.css +16 -0
- data/app/assets/stylesheets/openseadragon.css +1 -0
- data/app/assets/stylesheets/wdl-viewer/fd-slider.min.css +2 -0
- data/app/controllers/blacklight_advanced_search/advanced_controller.rb +66 -0
- data/app/controllers/bookmarks_controller.rb +38 -0
- data/app/controllers/collections_controller.rb +128 -0
- data/app/controllers/commonwealth_vlr_engine/application_controller.rb +8 -0
- data/app/controllers/feedback_controller.rb +39 -0
- data/app/controllers/folder_items_actions_controller.rb +72 -0
- data/app/controllers/folder_items_controller.rb +90 -0
- data/app/controllers/folders_controller.rb +132 -0
- data/app/controllers/iiif_manifest_controller.rb +74 -0
- data/app/controllers/image_viewer_controller.rb +34 -0
- data/app/controllers/institutions_controller.rb +62 -0
- data/app/controllers/ocr_search_controller.rb +78 -0
- data/app/controllers/pages_controller.rb +5 -0
- data/app/controllers/users/omniauth_callbacks_controller.rb +10 -0
- data/app/controllers/users/registrations_controller.rb +3 -0
- data/app/controllers/users/sessions_controller.rb +3 -0
- data/app/controllers/users_controller.rb +27 -0
- data/app/helpers/blacklight_maps_helper.rb +3 -0
- data/app/helpers/collections_helper.rb +3 -0
- data/app/helpers/commonwealth_vlr_engine/application_helper.rb +200 -0
- data/app/helpers/commonwealth_vlr_engine/blacklight_helper.rb +35 -0
- data/app/helpers/commonwealth_vlr_engine/blacklight_url_helper.rb +53 -0
- data/app/helpers/commonwealth_vlr_engine/catalog_helper.rb +414 -0
- data/app/helpers/commonwealth_vlr_engine/collections_helper_behavior.rb +19 -0
- data/app/helpers/commonwealth_vlr_engine/component_helper.rb +22 -0
- data/app/helpers/commonwealth_vlr_engine/facets_helper.rb +20 -0
- data/app/helpers/commonwealth_vlr_engine/feedback_helper_behavior.rb +14 -0
- data/app/helpers/commonwealth_vlr_engine/folders_helper_behavior.rb +9 -0
- data/app/helpers/commonwealth_vlr_engine/image_viewer_helper_behavior.rb +14 -0
- data/app/helpers/commonwealth_vlr_engine/institutions_helper_behavior.rb +31 -0
- data/app/helpers/commonwealth_vlr_engine/layout_helper.rb +22 -0
- data/app/helpers/commonwealth_vlr_engine/ocr_search_helper_behavior.rb +48 -0
- data/app/helpers/commonwealth_vlr_engine/pages_helper_behavior.rb +38 -0
- data/app/helpers/commonwealth_vlr_engine/vlr_blacklight_maps_helper_behavior.rb +59 -0
- data/app/helpers/feedback_helper.rb +3 -0
- data/app/helpers/folders_helper.rb +3 -0
- data/app/helpers/image_viewer_helper.rb +3 -0
- data/app/helpers/institutions_helper.rb +3 -0
- data/app/helpers/ocr_search_helper.rb +3 -0
- data/app/helpers/pages_helper.rb +3 -0
- data/app/mailers/notifier.rb +5 -0
- data/app/models/carousel_slide.rb +7 -0
- data/app/models/record_mailer.rb +18 -0
- data/app/models/user.rb +15 -0
- data/app/views/advanced/_advanced_search_date.html.erb +23 -0
- data/app/views/advanced/_advanced_search_facets.html.erb +5 -0
- data/app/views/advanced/_advanced_search_fields.html.erb +39 -0
- data/app/views/advanced/_advanced_search_form.html.erb +51 -0
- data/app/views/advanced/_advanced_search_help.html.erb +13 -0
- data/app/views/advanced/_facet_layout.html.erb +9 -0
- data/app/views/advanced/_facet_limit.html.erb +15 -0
- data/app/views/advanced/index.html.erb +29 -0
- data/app/views/blacklight_advanced_search/_facet_limit.html.erb +12 -0
- data/app/views/bookmarks/_tools.html.erb +25 -0
- data/app/views/bookmarks/index.html.erb +64 -0
- data/app/views/bookmarks/update.js.erb +1 -0
- data/app/views/bpluser/folders/_folder.html.erb +36 -0
- data/app/views/catalog/_add_this.html.erb +10 -0
- data/app/views/catalog/_az_links.html.erb +15 -0
- data/app/views/catalog/_basic_search.html.erb +67 -0
- data/app/views/catalog/_citation.html.erb +50 -0
- data/app/views/catalog/_constraints.html.erb +26 -0
- data/app/views/catalog/_document_collections_gallery.html.erb +7 -0
- data/app/views/catalog/_facet_limit_series.html.erb +21 -0
- data/app/views/catalog/_facets.html.erb +31 -0
- data/app/views/catalog/_facets_series.html.erb +4 -0
- data/app/views/catalog/_folder_item_control.html.erb +64 -0
- data/app/views/catalog/_index_collections_gallery.html.erb +12 -0
- data/app/views/catalog/_index_gallery.html.erb +11 -0
- data/app/views/catalog/_index_header_default.html.erb +22 -0
- data/app/views/catalog/_index_list_collection.html.erb +33 -0
- data/app/views/catalog/_index_list_default.html.erb +13 -0
- data/app/views/catalog/_index_map_institutions.html.erb +10 -0
- data/app/views/catalog/_index_masonry.html.erb +8 -0
- data/app/views/catalog/_index_slideshow.html.erb +18 -0
- data/app/views/catalog/_more_like_this.html.erb +9 -0
- data/app/views/catalog/_opengraph.html.erb +16 -0
- data/app/views/catalog/_previous_next_doc.html.erb +22 -0
- data/app/views/catalog/_results_pagination.html.erb +9 -0
- data/app/views/catalog/_search_form.html.erb +23 -0
- data/app/views/catalog/_search_header.html.erb +5 -0
- data/app/views/catalog/_show_default.html.erb +75 -0
- data/app/views/catalog/_show_main_content.html.erb +27 -0
- data/app/views/catalog/_show_more_like_this.html.erb +15 -0
- data/app/views/catalog/_show_partials/_show_book_viewer_link.html.erb +25 -0
- data/app/views/catalog/_show_partials/_show_default_img.html.erb +32 -0
- data/app/views/catalog/_show_partials/_show_default_metadata.html.erb +486 -0
- data/app/views/catalog/_show_partials/_show_default_simple_img_viewer.html.erb +45 -0
- data/app/views/catalog/_show_partials/_show_downloads.html.erb +14 -0
- data/app/views/catalog/_show_partials/_show_flagged_notice.html.erb +29 -0
- data/app/views/catalog/_show_partials/_show_multi_img.html.erb +42 -0
- data/app/views/catalog/_show_partials/_show_multi_img_pagination.html.erb +20 -0
- data/app/views/catalog/_show_partials/_show_oai_item_img.html.erb +5 -0
- data/app/views/catalog/_show_partials/_show_oai_item_link.html.erb +8 -0
- data/app/views/catalog/_show_partials/_show_prev_next_carousel_links.html.erb +17 -0
- data/app/views/catalog/_show_partials/_show_volumes.html.erb +52 -0
- data/app/views/catalog/_show_sidebar.html.erb +1 -0
- data/app/views/catalog/_show_tools.html.erb +42 -0
- data/app/views/catalog/_zero_results.html.erb +20 -0
- data/app/views/catalog/email.html.erb +6 -0
- data/app/views/catalog/index.html.erb +17 -0
- data/app/views/catalog/metadata_view.html.erb +7 -0
- data/app/views/catalog/show.html.erb +13 -0
- data/app/views/collections/_search_form_collection.html.erb +23 -0
- data/app/views/collections/index.html.erb +30 -0
- data/app/views/collections/show.html.erb +116 -0
- data/app/views/devise/confirmations/new.html.erb +14 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +13 -0
- data/app/views/devise/passwords/edit.html.erb +33 -0
- data/app/views/devise/passwords/new.html.erb +31 -0
- data/app/views/devise/registrations/edit.html.erb +83 -0
- data/app/views/devise/registrations/new.html.erb +53 -0
- data/app/views/devise/sessions/new.html.erb +75 -0
- data/app/views/devise/shared/_links.erb +29 -0
- data/app/views/feedback/complete.html.erb +9 -0
- data/app/views/feedback/show.html.erb +61 -0
- data/app/views/folder_items/create.js.erb +1 -0
- data/app/views/folder_items/destroy.js.erb +1 -0
- data/app/views/folder_items/item_actions.js.erb +2 -0
- data/app/views/folder_items/update.js.erb +1 -0
- data/app/views/folders/_in_folder.html.erb +2 -0
- data/app/views/folders/_new_edit_form_fields.html.erb +36 -0
- data/app/views/folders/edit.html.erb +25 -0
- data/app/views/folders/index.html.erb +73 -0
- data/app/views/folders/new.html.erb +27 -0
- data/app/views/folders/public_list.html.erb +44 -0
- data/app/views/folders/show.html.erb +98 -0
- data/app/views/image_viewer/_book_viewer_help.html.erb +125 -0
- data/app/views/image_viewer/_render_book_viewer.html.erb +185 -0
- data/app/views/image_viewer/book_viewer.html.erb +57 -0
- data/app/views/image_viewer/show.js.erb +19 -0
- data/app/views/institutions/_intro_text.html.erb +1 -0
- data/app/views/institutions/_map_institutions_search.html.erb +9 -0
- data/app/views/institutions/_search_form_institution.html.erb +24 -0
- data/app/views/institutions/index.html.erb +31 -0
- data/app/views/institutions/show.html.erb +104 -0
- data/app/views/layouts/_google_analytics.html.erb +9 -0
- data/app/views/layouts/book_viewer.html.erb +37 -0
- data/app/views/layouts/commonwealth-vlr-engine.html.erb +59 -0
- data/app/views/notifier/feedback.text.erb +6 -0
- data/app/views/ocr_search/_index_ocr_list.html.erb +17 -0
- data/app/views/ocr_search/_search_form_ocr.html.erb +23 -0
- data/app/views/ocr_search/_snippets_more.html.erb +15 -0
- data/app/views/ocr_search/_zero_results_ocr.html.erb +9 -0
- data/app/views/ocr_search/index.html.erb +49 -0
- data/app/views/pages/_carousel.html.erb +46 -0
- data/app/views/pages/_home_partials/_banner.html.erb +23 -0
- data/app/views/pages/_home_partials/_browse.html.erb +55 -0
- data/app/views/pages/_home_partials/_context.html.erb +24 -0
- data/app/views/pages/_home_partials/_home_content.html.erb +14 -0
- data/app/views/pages/about.html.erb +10 -0
- data/app/views/pages/about_site.html.erb +6 -0
- data/app/views/pages/explore.html.erb +32 -0
- data/app/views/pages/home.html.erb +3 -0
- data/app/views/record_mailer/email_record.text.erb +7 -0
- data/app/views/saved_searches/index.html.erb +60 -0
- data/app/views/search_history/index.html.erb +59 -0
- data/app/views/shared/_error_messages.html.erb +9 -0
- data/app/views/shared/_flash_msg_maintenance.html.erb +6 -0
- data/app/views/shared/_folder_item_actions.html.erb +66 -0
- data/app/views/shared/_folder_tools.html.erb +4 -0
- data/app/views/shared/_footer.html.erb +14 -0
- data/app/views/shared/_header_navbar.html.erb +34 -0
- data/app/views/shared/_nav_links.html.erb +58 -0
- data/app/views/shared/_search_form_header.html.erb +16 -0
- data/app/views/shared/_tools.html.erb +14 -0
- data/app/views/shared/_user_util_links.html.erb +43 -0
- data/app/views/users/show.html.erb +33 -0
- data/commonwealth-vlr-engine.gemspec +47 -0
- data/config/initializers/patch_blacklight_advanced_search.rb +74 -0
- data/config/initializers/patch_blacklight_maps.rb +20 -0
- data/config/jetty.yml +7 -0
- data/config/locales/commonwealth-vlr-engine.en.yml +463 -0
- data/config/routes.rb +92 -0
- data/lib/commonwealth-vlr-engine.rb +55 -0
- data/lib/commonwealth-vlr-engine/commonwealth_search_builder.rb +66 -0
- data/lib/commonwealth-vlr-engine/controller.rb +69 -0
- data/lib/commonwealth-vlr-engine/controller_override.rb +238 -0
- data/lib/commonwealth-vlr-engine/engine.rb +40 -0
- data/lib/commonwealth-vlr-engine/finder.rb +285 -0
- data/lib/commonwealth-vlr-engine/iiif_manifest.rb +189 -0
- data/lib/commonwealth-vlr-engine/notifier.rb +33 -0
- data/lib/commonwealth-vlr-engine/pages.rb +33 -0
- data/lib/commonwealth-vlr-engine/render_constraints_override.rb +57 -0
- data/lib/commonwealth-vlr-engine/route_sets.rb +49 -0
- data/lib/commonwealth-vlr-engine/routes.rb +21 -0
- data/lib/commonwealth-vlr-engine/version.rb +3 -0
- data/lib/generators/commonwealth_vlr_engine/controller_generator.rb +92 -0
- data/lib/generators/commonwealth_vlr_engine/environment_generator.rb +49 -0
- data/lib/generators/commonwealth_vlr_engine/install_generator.rb +57 -0
- data/lib/generators/commonwealth_vlr_engine/localassets_generator.rb +29 -0
- data/lib/generators/commonwealth_vlr_engine/model_generator.rb +65 -0
- data/lib/generators/commonwealth_vlr_engine/routes_generator.rb +39 -0
- data/lib/generators/commonwealth_vlr_engine/templates/commonwealth_vlr_engine.css.scss +4 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/contact_emails.yml.sample +13 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/fedora.yml.sample +6 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/geojson_static_file.yml.sample +11 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/google_analytics.yml.sample +10 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/iiif_server.yml.sample +10 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/initializers/a_load_commonwealth_vlr_configs.rb +14 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/initializers/devise.rb +269 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/initializers/secret_token.rb +8 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/locales/blacklight.en.yml +44 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/locales/devise.en.yml +12 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/omniauth-facebook.yml.sample +14 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/omniauth-polaris.yml.sample +20 -0
- data/lib/generators/commonwealth_vlr_engine/templates/config/vlr.yml +13 -0
- data/lib/generators/commonwealth_vlr_engine/yml_generator.rb +29 -0
- data/lib/railties/commonwealth_vlr_engine.rake +6 -0
- data/solr_conf/conf/schema.xml +476 -0
- data/solr_conf/conf/solrconfig.xml +286 -0
- data/spec/controllers/catalog_controller_spec.rb +67 -0
- data/spec/controllers/collections_controller_spec.rb +127 -0
- data/spec/controllers/feedback_controller_spec.rb +51 -0
- data/spec/controllers/folder_items_actions_controller_spec.rb +99 -0
- data/spec/controllers/folder_items_controller_spec.rb +90 -0
- data/spec/controllers/folders_controller_spec.rb +368 -0
- data/spec/controllers/iiif_manifest_controller_spec.rb +85 -0
- data/spec/controllers/image_viewer_controller_spec.rb +50 -0
- data/spec/controllers/institutions_controller_spec.rb +64 -0
- data/spec/controllers/ocr_search_controller_spec.rb +71 -0
- data/spec/controllers/pages_controller_spec.rb +58 -0
- data/spec/controllers/users_controller_spec.rb +62 -0
- data/spec/features/catalog/_az_links_spec.rb +27 -0
- data/spec/features/catalog/_show_partials/_show_book_viewer_link_spec.rb +47 -0
- data/spec/features/catalog/_show_partials/_show_default_simple_img_viewer_spec.rb +19 -0
- data/spec/features/catalog/_show_partials/_show_flagged_notice_spec.rb +23 -0
- data/spec/features/catalog/_show_partials/_show_multi_img_spec.rb +18 -0
- data/spec/features/catalog/_show_partials/_show_volumes_spec.rb +24 -0
- data/spec/features/collections/index_spec.rb +35 -0
- data/spec/features/feedback/show_spec.rb +47 -0
- data/spec/features/image_viewer/book_viewer_spec.rb +67 -0
- data/spec/features/institutions/index_spec.rb +31 -0
- data/spec/features/institutions/map_view_spec.rb +37 -0
- data/spec/features/more_like_this_search_spec.rb +23 -0
- data/spec/features/ocr_search/index_spec.rb +89 -0
- data/spec/fixtures/sample_rss_feed.xml +56 -0
- data/spec/fixtures/sample_solr_documents.yml +2748 -0
- data/spec/helpers/application_helper_spec.rb +114 -0
- data/spec/helpers/catalog_helper_spec.rb +386 -0
- data/spec/helpers/collections_helper_spec.rb +28 -0
- data/spec/helpers/component_helper_spec.rb +34 -0
- data/spec/helpers/folders_helper_spec.rb +31 -0
- data/spec/helpers/image_viewer_helper_spec.rb +15 -0
- data/spec/helpers/institutions_helper_spec.rb +53 -0
- data/spec/helpers/ocr_search_helper_spec.rb +70 -0
- data/spec/helpers/pages_helper_spec.rb +21 -0
- data/spec/lib/commonwealth-vlr-engine/commonwealth_search_builder_spec.rb +101 -0
- data/spec/lib/commonwealth-vlr-engine/controller_override_spec.rb +41 -0
- data/spec/lib/commonwealth-vlr-engine/controller_spec.rb +33 -0
- data/spec/lib/commonwealth-vlr-engine/finder_spec.rb +140 -0
- data/spec/lib/commonwealth-vlr-engine/iiif_manifest_spec.rb +157 -0
- data/spec/lib/commonwealth-vlr-engine/render_constraints_override_spec.rb +97 -0
- data/spec/mailers/notifier_spec.rb +31 -0
- data/spec/models/carousel_slide_spec.rb +38 -0
- data/spec/spec_helper.rb +40 -0
- data/spec/tasks/vlr_engine_rake_spec.rb +28 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +23 -0
- data/tasks/vlr_engine.rake +46 -0
- metadata +788 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
2
|
+
|
|
3
|
+
#https://github.com/plataformatec/devise/issues/2432
|
|
4
|
+
|
|
5
|
+
# this is the only spot where we allow CSRF, our openid / oauth redirect
|
|
6
|
+
# will not have a CSRF token, however the payload is all validated so its safe
|
|
7
|
+
skip_before_filter :verify_authenticity_token
|
|
8
|
+
|
|
9
|
+
include Bpluser::Users::OmniauthCallbacksController
|
|
10
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class UsersController < ApplicationController
|
|
2
|
+
|
|
3
|
+
before_action :authenticate_user!, :correct_user, :only => [:show]
|
|
4
|
+
|
|
5
|
+
def show
|
|
6
|
+
@user = User.find(params[:id])
|
|
7
|
+
|
|
8
|
+
respond_to do |format|
|
|
9
|
+
format.html # show.html.erb.bak
|
|
10
|
+
format.xml { render :xml => @user }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# getting some weird intermittent errors where users are being redirected
|
|
15
|
+
# to '/users' after signup. this is a failsafe last-resort solution
|
|
16
|
+
def index
|
|
17
|
+
redirect_to root_path
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
protected
|
|
21
|
+
|
|
22
|
+
def correct_user
|
|
23
|
+
@user = User.find(params[:id])
|
|
24
|
+
redirect_to root_path unless current_user.id == @user.id
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
module CommonwealthVlrEngine
|
|
2
|
+
module ApplicationHelper
|
|
3
|
+
|
|
4
|
+
# show the display-friendly value for the Format facet
|
|
5
|
+
def render_format(value)
|
|
6
|
+
case value
|
|
7
|
+
when 'Albums'
|
|
8
|
+
'Albums/Scrapbooks'
|
|
9
|
+
when 'Drawings'
|
|
10
|
+
'Drawings/Illustrations'
|
|
11
|
+
when 'Maps'
|
|
12
|
+
'Maps/Atlases'
|
|
13
|
+
when 'Motion pictures'
|
|
14
|
+
'Film/Video'
|
|
15
|
+
when 'Music'
|
|
16
|
+
'Music (recordings)'
|
|
17
|
+
when 'Objects'
|
|
18
|
+
'Objects/Artifacts'
|
|
19
|
+
when 'Musical notation'
|
|
20
|
+
'Sheet music'
|
|
21
|
+
when 'Sound recordings'
|
|
22
|
+
'Audio recordings (nonmusical)'
|
|
23
|
+
when 'Cards'
|
|
24
|
+
'Postcards/Cards'
|
|
25
|
+
when 'Correspondence'
|
|
26
|
+
'Letters/Correspondence'
|
|
27
|
+
else
|
|
28
|
+
value
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def render_format_index(args)
|
|
33
|
+
render_format(args[:document][args[:field]])
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# return the path to the icon for objects with no thumbnail
|
|
37
|
+
def render_object_icon_path(format)
|
|
38
|
+
case format
|
|
39
|
+
when 'still image'
|
|
40
|
+
icon = 'image'
|
|
41
|
+
when 'sound recording', 'sound recording-nonmusical', 'sound recording-musical'
|
|
42
|
+
icon = 'audio'
|
|
43
|
+
when 'moving image'
|
|
44
|
+
icon = 'moving-image'
|
|
45
|
+
else
|
|
46
|
+
icon = 'text'
|
|
47
|
+
end
|
|
48
|
+
"commonwealth-vlr-engine/dc_#{icon}-icon.png"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
#from psu scholarsphere
|
|
52
|
+
# TODO: this isn't used anywhere in the app, get rid of it?
|
|
53
|
+
def link_to_field(fieldname, fieldvalue, displayvalue = nil)
|
|
54
|
+
p = {:search_field => fieldname, :q => '"'+fieldvalue+'"'}
|
|
55
|
+
link_url = catalog_index_path(p)
|
|
56
|
+
display = displayvalue.blank? ? fieldvalue: displayvalue
|
|
57
|
+
link_to(display, link_url)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def link_to_facet(field_value, field, displayvalue = nil)
|
|
61
|
+
if field == 'genre_basic_ssim'
|
|
62
|
+
link_to(render_format(field_value), catalog_index_path(:f => {field => [field_value]}))
|
|
63
|
+
else
|
|
64
|
+
link_to(displayvalue.presence || field_value, catalog_index_path(:f => {field => [field_value]}))
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# link to a combination of facets (series + subseries, for ex)
|
|
69
|
+
def link_to_facets(field_values, fields, displayvalue = nil)
|
|
70
|
+
facets = {}
|
|
71
|
+
fields.each_with_index do |field, index|
|
|
72
|
+
facets[field] = [field_values[index]]
|
|
73
|
+
end
|
|
74
|
+
link_to(displayvalue.presence || field_values[0], catalog_index_path(:f => facets))
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def link_to_county_facet(field_value, field)
|
|
78
|
+
link_to(field_value + ' County', catalog_index_path(:f => {field => [field_value + ' (county)']}))
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# returns the direct URL to a datastream in Fedora
|
|
82
|
+
def datastream_disseminator_url pid, datastream_id
|
|
83
|
+
"#{FEDORA_URL['url']}/objects/#{pid}/datastreams/#{datastream_id}/content"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# create an image tag from an IIIF image server
|
|
87
|
+
def iiif_image_tag(image_pid,options)
|
|
88
|
+
image_tag iiif_image_url(image_pid, options), :alt => options[:alt].presence, :class => options[:class].presence
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# return the IIIF image url
|
|
92
|
+
def iiif_image_url(image_pid, options)
|
|
93
|
+
size = options[:size] ? options[:size] : 'full'
|
|
94
|
+
region = options[:region] ? options[:region] : 'full'
|
|
95
|
+
"#{IIIF_SERVER['url']}#{image_pid}/#{region}/#{size}/0/default.jpg"
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# return a square image of the supplied size (in pixels)
|
|
99
|
+
def iiif_square_img_path(image_pid, size)
|
|
100
|
+
img_info = get_image_metadata(image_pid)
|
|
101
|
+
width = img_info[:width]
|
|
102
|
+
height = img_info[:height]
|
|
103
|
+
if width > height
|
|
104
|
+
offset = (width - height) / 2
|
|
105
|
+
iiif_image_url(image_pid,
|
|
106
|
+
{:region => "#{offset},0,#{height},#{height}", :size => "#{size},#{size}"})
|
|
107
|
+
elsif height > width
|
|
108
|
+
offset = (height - width) / 2
|
|
109
|
+
iiif_image_url(image_pid,
|
|
110
|
+
{:region => "0,#{offset},#{width},#{width}", :size => "#{size},#{size}"})
|
|
111
|
+
else
|
|
112
|
+
iiif_image_url(image_pid, {:size => "#{size},#{size}"})
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# returns a hash with width/height from IIIF info.json response
|
|
117
|
+
def get_image_metadata(image_pid)
|
|
118
|
+
iiif_response = Typhoeus::Request.get(IIIF_SERVER['url'] + image_pid + '/info.json')
|
|
119
|
+
if iiif_response.response_code == 200 && !iiif_response.response_body.empty?
|
|
120
|
+
iiif_info = JSON.parse(iiif_response.body)
|
|
121
|
+
img_metadata = {height: iiif_info["height"].to_i, width: iiif_info["width"].to_i}
|
|
122
|
+
else
|
|
123
|
+
img_metadata = {height: 0, width: 0}
|
|
124
|
+
end
|
|
125
|
+
img_metadata
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def insert_opengraph_markup
|
|
129
|
+
if controller_name == 'catalog' && action_name == 'show'
|
|
130
|
+
content_for(:head) do
|
|
131
|
+
render :partial=>'/catalog/opengraph', :locals => {:document => @document}
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def insert_google_analytics
|
|
137
|
+
if Rails.env.to_s == 'production'
|
|
138
|
+
content_for(:head) do
|
|
139
|
+
render :partial=>'/layouts/google_analytics'
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# returns a hash with the location of the OpenSeadragon custom images
|
|
145
|
+
def osd_nav_images(path_to_directory)
|
|
146
|
+
{
|
|
147
|
+
zoomIn: {
|
|
148
|
+
REST: image_path("#{path_to_directory}/zoomin_rest.png"),
|
|
149
|
+
GROUP: image_path("#{path_to_directory}/zoomin_grouphover.png"),
|
|
150
|
+
HOVER: image_path("#{path_to_directory}/zoomin_hover.png"),
|
|
151
|
+
DOWN: image_path("#{path_to_directory}/zoomin_pressed.png")
|
|
152
|
+
},
|
|
153
|
+
zoomOut: {
|
|
154
|
+
REST: image_path("#{path_to_directory}/zoomout_rest.png"),
|
|
155
|
+
GROUP: image_path("#{path_to_directory}/zoomout_grouphover.png"),
|
|
156
|
+
HOVER: image_path("#{path_to_directory}/zoomout_hover.png"),
|
|
157
|
+
DOWN: image_path("#{path_to_directory}/zoomout_pressed.png")
|
|
158
|
+
},
|
|
159
|
+
home: {
|
|
160
|
+
REST: image_path("#{path_to_directory}/home_rest.png"),
|
|
161
|
+
GROUP: image_path("#{path_to_directory}/home_grouphover.png"),
|
|
162
|
+
HOVER: image_path("#{path_to_directory}/home_hover.png"),
|
|
163
|
+
DOWN: image_path("#{path_to_directory}/home_pressed.png")
|
|
164
|
+
},
|
|
165
|
+
fullpage: {
|
|
166
|
+
REST: image_path("#{path_to_directory}/fullpage_rest.png"),
|
|
167
|
+
GROUP: image_path("#{path_to_directory}/fullpage_grouphover.png"),
|
|
168
|
+
HOVER: image_path("#{path_to_directory}/fullpage_hover.png"),
|
|
169
|
+
DOWN: image_path("#{path_to_directory}/fullpage_pressed.png")
|
|
170
|
+
},
|
|
171
|
+
rotateleft: {
|
|
172
|
+
REST: image_path("#{path_to_directory}/rotateleft_rest.png"),
|
|
173
|
+
GROUP: image_path("#{path_to_directory}/rotateleft_grouphover.png"),
|
|
174
|
+
HOVER: image_path("#{path_to_directory}/rotateleft_hover.png"),
|
|
175
|
+
DOWN: image_path("#{path_to_directory}/rotateleft_pressed.png")
|
|
176
|
+
},
|
|
177
|
+
rotateright: {
|
|
178
|
+
REST: image_path("#{path_to_directory}/rotateright_rest.png"),
|
|
179
|
+
GROUP: image_path("#{path_to_directory}/rotateright_grouphover.png"),
|
|
180
|
+
HOVER: image_path("#{path_to_directory}/rotateright_hover.png"),
|
|
181
|
+
DOWN: image_path("#{path_to_directory}/rotateright_pressed.png")
|
|
182
|
+
},
|
|
183
|
+
previous: {
|
|
184
|
+
REST: image_path("#{path_to_directory}/previous_rest.png"),
|
|
185
|
+
GROUP: image_path("#{path_to_directory}/previous_grouphover.png"),
|
|
186
|
+
HOVER: image_path("#{path_to_directory}/previous_hover.png"),
|
|
187
|
+
DOWN: image_path("#{path_to_directory}/previous_pressed.png")
|
|
188
|
+
},
|
|
189
|
+
next: {
|
|
190
|
+
REST: image_path("#{path_to_directory}/next_rest.png"),
|
|
191
|
+
GROUP: image_path("#{path_to_directory}/next_grouphover.png"),
|
|
192
|
+
HOVER: image_path("#{path_to_directory}/next_hover.png"),
|
|
193
|
+
DOWN: image_path("#{path_to_directory}/next_pressed.png")
|
|
194
|
+
}
|
|
195
|
+
}.to_json
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module CommonwealthVlrEngine
|
|
2
|
+
module BlacklightHelper
|
|
3
|
+
include Blacklight::BlacklightHelperBehavior
|
|
4
|
+
|
|
5
|
+
# local override to allow using CommonwealthVlrEngine::CatalogHelper#render_main_title
|
|
6
|
+
# for catalog#show title heading
|
|
7
|
+
def document_heading document=nil
|
|
8
|
+
document ||= @document
|
|
9
|
+
if document[blacklight_config.index.title_field.to_sym]
|
|
10
|
+
render_main_title(document)
|
|
11
|
+
else
|
|
12
|
+
@document.id
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# local override to use custom #document_heading method (above) for catalog#show title heading
|
|
17
|
+
def render_document_heading(*args)
|
|
18
|
+
options = args.extract_options!
|
|
19
|
+
|
|
20
|
+
tag_or_document = args.first
|
|
21
|
+
|
|
22
|
+
if tag_or_document.is_a? String or tag_or_document.is_a? Symbol
|
|
23
|
+
Deprecation.warn(Blacklight::BlacklightHelperBehavior, "#render_document_heading with a tag argument is deprecated; pass e.g. `tag: :h4` instead")
|
|
24
|
+
tag = tag_or_document
|
|
25
|
+
document = @document
|
|
26
|
+
else
|
|
27
|
+
tag = options.fetch(:tag, :h4)
|
|
28
|
+
document = tag_or_document || @document
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
content_tag(tag, document_heading(document), itemprop: "name")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module CommonwealthVlrEngine
|
|
2
|
+
module BlacklightUrlHelper
|
|
3
|
+
include Blacklight::UrlHelperBehavior
|
|
4
|
+
|
|
5
|
+
# overriding to allow use in collections#show and institutions#show
|
|
6
|
+
# so facet links in those views point to catalog#index
|
|
7
|
+
def add_facet_params_and_redirect(field, item)
|
|
8
|
+
new_params = add_facet_params(field, item)
|
|
9
|
+
|
|
10
|
+
# Delete any request params from facet-specific action, needed
|
|
11
|
+
# to redir to index action properly.
|
|
12
|
+
request_keys = blacklight_config.facet_paginator_class.request_keys
|
|
13
|
+
new_params.except! *request_keys.values
|
|
14
|
+
|
|
15
|
+
# Force controller#action to be catalog#index.
|
|
16
|
+
new_params[:action] = "index"
|
|
17
|
+
new_params[:controller] = "catalog"
|
|
18
|
+
new_params
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# need this method for rss and atom polymorphic_url(url_for_document(document))
|
|
22
|
+
# because polymorphic_url appends any action passed in arg hash to route
|
|
23
|
+
# so we need to re-route to the correct url
|
|
24
|
+
def show_solr_document_url doc, options
|
|
25
|
+
if options[:controller]
|
|
26
|
+
case options[:controller]
|
|
27
|
+
when 'collections'
|
|
28
|
+
collection_url doc
|
|
29
|
+
when 'institutions'
|
|
30
|
+
institution_url doc
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
solr_document_url doc, options
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# override to route to collections#show and institutions#show where appropriate
|
|
39
|
+
def url_for_document doc, options = {}
|
|
40
|
+
if respond_to?(:blacklight_config) && doc.respond_to?(:[])
|
|
41
|
+
display_type = doc[blacklight_config.show.display_type_field].presence
|
|
42
|
+
if display_type == 'Collection' || display_type == 'Institution'
|
|
43
|
+
{controller: display_type.downcase.pluralize, action: :show, id: doc}
|
|
44
|
+
else
|
|
45
|
+
doc
|
|
46
|
+
end
|
|
47
|
+
else
|
|
48
|
+
doc
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
module CommonwealthVlrEngine
|
|
2
|
+
module CatalogHelper
|
|
3
|
+
include Blacklight::CatalogHelperBehavior
|
|
4
|
+
|
|
5
|
+
# returns the CC license terms code for use in URLs, etc.
|
|
6
|
+
def cc_terms_code(license)
|
|
7
|
+
license.match(/\s[BYNCDSA-]{2,}/).to_s.strip.downcase
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# returns a link to a CC license
|
|
11
|
+
def cc_url(license)
|
|
12
|
+
terms_code = cc_terms_code(license)
|
|
13
|
+
"http://creativecommons.org/licenses/#{terms_code}/3.0"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# return the image url for the collection gallery view document
|
|
17
|
+
# size = pixel length of square IIIF-created image
|
|
18
|
+
def collection_gallery_url document, size
|
|
19
|
+
exemplary_image_pid = document[:exemplary_image_ssi]
|
|
20
|
+
if exemplary_image_pid
|
|
21
|
+
if exemplary_image_pid.match(/oai/)
|
|
22
|
+
datastream_disseminator_url(exemplary_image_pid,'thumbnail300')
|
|
23
|
+
else
|
|
24
|
+
iiif_square_img_path(exemplary_image_pid, size)
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
collection_icon_path
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def collection_icon_path
|
|
32
|
+
'commonwealth-vlr-engine/dc_collection-icon.png'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def create_download_links(document, files_hash, link_class)
|
|
36
|
+
file_types = [files_hash[:documents], files_hash[:ereader], files_hash[:audio], files_hash[:generic]]
|
|
37
|
+
download_links = []
|
|
38
|
+
file_types.each do |file_type|
|
|
39
|
+
file_type.each do |file|
|
|
40
|
+
object_profile_json = JSON.parse(file['object_profile_ssm'].first)
|
|
41
|
+
file_name_ext = object_profile_json["objLabel"].split('.')
|
|
42
|
+
download_link_title = document['identifier_ia_id_ssi'] ? ia_download_title(file_name_ext[1]) : file_name_ext[0]
|
|
43
|
+
download_links << link_to(download_link_title,
|
|
44
|
+
datastream_disseminator_url(file['id'],'productionMaster'),
|
|
45
|
+
:target => '_blank',
|
|
46
|
+
:class => link_class) + content_tag(:span,
|
|
47
|
+
"(.#{file_name_ext[1]}, #{number_to_human_size(object_profile_json["datastreams"]["productionMaster"]["dsSize"])})",
|
|
48
|
+
:class => 'download_info')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
download_links
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def create_thumb_img_element(document, img_class=[])
|
|
55
|
+
image_classes = img_class.class == Array ? img_class.join(' ') : ''
|
|
56
|
+
image_tag(thumbnail_url(document),
|
|
57
|
+
:alt => document[blacklight_config.index.title_field.to_sym],
|
|
58
|
+
:class => image_classes)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def extra_body_classes
|
|
62
|
+
@extra_body_classes ||= ['blacklight-' + controller_name, 'blacklight-' + [controller_name, controller.action_name].join('-')]
|
|
63
|
+
# if this is the home page
|
|
64
|
+
if controller_name == 'pages' && action_name =='home'
|
|
65
|
+
@extra_body_classes.push('blacklight-home')
|
|
66
|
+
else
|
|
67
|
+
@extra_body_classes
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def has_downloadable_files? files_hash
|
|
72
|
+
files_hash[:documents].present? ||
|
|
73
|
+
files_hash[:audio].present? ||
|
|
74
|
+
files_hash[:generic].present? ||
|
|
75
|
+
files_hash[:ereader].present?
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def has_image_files? files_hash
|
|
79
|
+
image_file_pids = nil
|
|
80
|
+
unless files_hash[:images].empty?
|
|
81
|
+
image_file_pids = []
|
|
82
|
+
files_hash[:images].each do |image_file|
|
|
83
|
+
image_file_pids << image_file['id']
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
image_file_pids
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# render the file type names for Internet Archive book item download links
|
|
90
|
+
def ia_download_title(file_extension)
|
|
91
|
+
case file_extension
|
|
92
|
+
when 'mobi'
|
|
93
|
+
'Kindle'
|
|
94
|
+
when 'zip'
|
|
95
|
+
'Daisy'
|
|
96
|
+
when 'pdf'
|
|
97
|
+
'PDF'
|
|
98
|
+
when 'epub'
|
|
99
|
+
'EPUB'
|
|
100
|
+
else
|
|
101
|
+
file_extension.upcase
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# render collection name as a link in catalog#index list view
|
|
106
|
+
def index_collection_link options={}
|
|
107
|
+
setup_collection_links(options[:document]).join(' / ').html_safe
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# render the date in the catalog#index list view
|
|
112
|
+
def index_date_value options={}
|
|
113
|
+
render_mods_dates(options[:document]).first
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# render institution name as a link in catalog#index list view
|
|
117
|
+
def index_institution_link options={}
|
|
118
|
+
link_to(options[:value].first,
|
|
119
|
+
institution_path(:id => options[:document][:institution_pid_ssi]))
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# render the collection/institution icon if necessary
|
|
123
|
+
def index_relation_base_icon document
|
|
124
|
+
if document[blacklight_config.view_config(document_index_view_type).display_type_field]
|
|
125
|
+
display_type = document[blacklight_config.view_config(document_index_view_type).display_type_field].downcase
|
|
126
|
+
if controller_name == 'catalog' && (display_type == 'collection' || display_type == 'institution')
|
|
127
|
+
image_tag("commonwealth-vlr-engine/dc_#{display_type}-icon.png", alt: "#{display_type} icon", class: "index-title-icon #{display_type}-icon")
|
|
128
|
+
else
|
|
129
|
+
''
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# return the URL of an image to display in the catalog#index slideshow view
|
|
135
|
+
def index_slideshow_img_url document
|
|
136
|
+
if document[:exemplary_image_ssi] && !document[blacklight_config.flagged_field.to_sym]
|
|
137
|
+
if document[blacklight_config.index.display_type_field.to_sym] == 'OAIObject' || document[:exemplary_image_ssi].match(/oai/)
|
|
138
|
+
thumbnail_url(document)
|
|
139
|
+
else
|
|
140
|
+
iiif_image_url(document[:exemplary_image_ssi], {:size => ',500'})
|
|
141
|
+
end
|
|
142
|
+
elsif document[:type_of_resource_ssim]
|
|
143
|
+
render_object_icon_path(document[:type_of_resource_ssim].first)
|
|
144
|
+
elsif document[blacklight_config.index.display_type_field.to_sym] == 'Collection'
|
|
145
|
+
collection_icon_path
|
|
146
|
+
elsif document[blacklight_config.index.display_type_field.to_sym] == 'Institution'
|
|
147
|
+
institution_icon_path
|
|
148
|
+
else
|
|
149
|
+
render_object_icon_path(nil)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# determine the 'truncate' length based on catalog#index view type
|
|
154
|
+
def index_title_length
|
|
155
|
+
case params[:view]
|
|
156
|
+
when 'list'
|
|
157
|
+
170
|
|
158
|
+
when 'masonry'
|
|
159
|
+
89
|
|
160
|
+
else
|
|
161
|
+
130
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def institution_icon_path
|
|
166
|
+
'commonwealth-vlr-engine/dc_institution-icon.png'
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# link to items starting with a specific letter
|
|
170
|
+
def link_to_az_value(letter, field, search_path, link_class=nil)
|
|
171
|
+
new_params = params.except(:controller, :action, :q, :page)
|
|
172
|
+
new_params[:q] = "#{field}:#{letter}*"
|
|
173
|
+
link_to(letter,
|
|
174
|
+
self.send(search_path, new_params),
|
|
175
|
+
class: link_class)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def normalize_date(date)
|
|
179
|
+
if date.length == 10
|
|
180
|
+
Date.parse(date).strftime('%B %-d, %Y')
|
|
181
|
+
elsif date.length == 7
|
|
182
|
+
Date.parse(date + '-01').strftime('%B %Y')
|
|
183
|
+
else
|
|
184
|
+
date
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# insert an icon and link to CC licenses
|
|
189
|
+
def render_cc_license(license)
|
|
190
|
+
terms_code = cc_terms_code(license)
|
|
191
|
+
link_to(image_tag("//i.creativecommons.org/l/#{terms_code}/3.0/80x15.png",
|
|
192
|
+
:alt => 'CC ' + terms_code.upcase + ' icon',
|
|
193
|
+
:class => 'cc_license_icon'),
|
|
194
|
+
cc_url(license),
|
|
195
|
+
:rel => 'license',
|
|
196
|
+
:id => 'cc_license_link',
|
|
197
|
+
:target => '_blank')
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# output properly formatted full title, with subtitle, parallel title, etc.
|
|
201
|
+
def render_full_title(document)
|
|
202
|
+
title_output = ''
|
|
203
|
+
title_output << document[blacklight_config.index.title_field.to_sym]
|
|
204
|
+
if document[:subtitle_tsim]
|
|
205
|
+
title_output << " : #{document[:subtitle_tsim].first}"
|
|
206
|
+
end
|
|
207
|
+
if document[:title_info_partnum_tsi]
|
|
208
|
+
title_output << ". #{document[:title_info_partnum_tsi]}"
|
|
209
|
+
end
|
|
210
|
+
if document[:title_info_partname_tsi]
|
|
211
|
+
title_output << ". #{document[:title_info_partname_tsi]}"
|
|
212
|
+
end
|
|
213
|
+
if document[:title_info_primary_trans_tsim]
|
|
214
|
+
document[:title_info_primary_trans_tsim].each do |parallel_title|
|
|
215
|
+
title_output << " = #{parallel_title}"
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
title_output.squish
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# render metadata for <mods:hierarchicalGeographic> subjects from GeoJSON
|
|
222
|
+
def render_hiergo_subject(geojson_feature, separator, separator_class=nil)
|
|
223
|
+
output_array = []
|
|
224
|
+
hiergeo_hash = JSON.parse(geojson_feature).symbolize_keys[:properties]
|
|
225
|
+
hiergeo_hash.each_key do |k|
|
|
226
|
+
if k == 'country' && hiergeo_hash[k] == 'United States'
|
|
227
|
+
# display 'United States' only if no other values
|
|
228
|
+
output_array << link_to_facet(hiergeo_hash[k], 'subject_geographic_ssim') if hiergeo_hash.length == 1
|
|
229
|
+
elsif k == 'county'
|
|
230
|
+
output_array << link_to_facet("#{hiergeo_hash[k]} (county)", 'subject_geographic_ssim')
|
|
231
|
+
elsif k == 'island' || k == 'area' || k == 'province' || k == 'territory' || k == 'region'
|
|
232
|
+
output_array << link_to_facet(hiergeo_hash[k], 'subject_geographic_ssim') + " (#{k.to_s})"
|
|
233
|
+
elsif k == 'other'
|
|
234
|
+
place_type = hiergeo_hash[k].scan(/\([a-z\s]*\)/).last
|
|
235
|
+
place_name = hiergeo_hash[k].gsub(/#{place_type}/,'').gsub(/\s\(\)\z/,'')
|
|
236
|
+
output_array << link_to_facet(place_name, 'subject_geographic_ssim') + " #{place_type.to_s}"
|
|
237
|
+
else
|
|
238
|
+
output_array << link_to_facet(hiergeo_hash[k], 'subject_geographic_ssim')
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
output_array.join(content_tag(:span, separator, :class => separator_class)).html_safe
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def render_item_breadcrumb(document)
|
|
245
|
+
if document[:collection_pid_ssm]
|
|
246
|
+
setup_collection_links(document).sort.join(' / ').html_safe
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# output properly formatted title with volume info, but no subtitle
|
|
251
|
+
def render_main_title(document)
|
|
252
|
+
title_output = ''
|
|
253
|
+
if document[blacklight_config.index.title_field.to_sym]
|
|
254
|
+
title_output << document[blacklight_config.index.title_field.to_sym]
|
|
255
|
+
if document[:title_info_partnum_tsi]
|
|
256
|
+
title_output << ". #{document[:title_info_partnum_tsi]}"
|
|
257
|
+
end
|
|
258
|
+
if document[:title_info_partname_tsi]
|
|
259
|
+
title_output << ". #{document[:title_info_partname_tsi]}"
|
|
260
|
+
end
|
|
261
|
+
else
|
|
262
|
+
title_output << document.id
|
|
263
|
+
end
|
|
264
|
+
title_output.squish
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# render the 'more like this' search link if doc has subjects
|
|
268
|
+
def render_mlt_search_link(document)
|
|
269
|
+
if document[:subject_facet_ssim] || document[:subject_geo_city_ssim]
|
|
270
|
+
content_tag :div, :id => 'more_mlt_link_wrapper' do
|
|
271
|
+
link_to t('blacklight.more_like_this.more_mlt_link'),
|
|
272
|
+
catalog_index_path(:mlt_id => document.id,
|
|
273
|
+
:qt => 'mlt'),
|
|
274
|
+
:id => 'more_mlt_link'
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# returns an array of properly-formatted date values
|
|
280
|
+
def render_mods_dates (document)
|
|
281
|
+
date_values = []
|
|
282
|
+
document[:date_start_tsim].each_with_index do |start_date,index|
|
|
283
|
+
date_type = document[:date_type_ssm] ? document[:date_type_ssm][index] : nil
|
|
284
|
+
date_qualifier = document[:date_start_qualifier_ssm] ? document[:date_start_qualifier_ssm][index] : nil
|
|
285
|
+
date_end = document[:date_end_tsim] ? document[:date_end_tsim][index] : nil
|
|
286
|
+
date_values << render_mods_date(start_date, date_end, date_qualifier, date_type)
|
|
287
|
+
end
|
|
288
|
+
date_values
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# returns a properly-formatted date value as a string
|
|
292
|
+
def render_mods_date (date_start, date_end = nil, date_qualifier = nil, date_type = nil)
|
|
293
|
+
prefix = ''
|
|
294
|
+
suffix = ''
|
|
295
|
+
date_start_suffix = ''
|
|
296
|
+
if date_qualifier && date_qualifier != 'nil'
|
|
297
|
+
prefix = date_qualifier == 'approximate' ? '[ca. ' : '['
|
|
298
|
+
suffix = date_qualifier == 'questionable' ? '?]' : ']'
|
|
299
|
+
end
|
|
300
|
+
prefix << 'c' if date_type == 'copyrightDate'
|
|
301
|
+
if date_end && date_end != 'nil'
|
|
302
|
+
date_start_suffix = '?' if date_qualifier == 'questionable'
|
|
303
|
+
prefix + normalize_date(date_start) + date_start_suffix + t('blacklight.metadata_display.date_range_connector') + normalize_date(date_end) + suffix
|
|
304
|
+
else
|
|
305
|
+
prefix + normalize_date(date_start) + suffix
|
|
306
|
+
end
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
def render_mods_xml_record(document_id)
|
|
310
|
+
mods_xml_file_path = datastream_disseminator_url(document_id, 'descMetadata')
|
|
311
|
+
mods_response = Typhoeus::Request.get(mods_xml_file_path)
|
|
312
|
+
mods_xml_text = REXML::Document.new(mods_response.body)
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def render_volume_title(document)
|
|
316
|
+
vol_title_info = [document[:title_info_partnum_tsi], document[:title_info_partname_tsi]]
|
|
317
|
+
if vol_title_info[0]
|
|
318
|
+
vol_title_info[1] ? vol_title_info[0].capitalize + ': ' + vol_title_info[1] : vol_title_info[0].capitalize
|
|
319
|
+
elsif vol_title_info[1]
|
|
320
|
+
vol_title_info[1].capitalize
|
|
321
|
+
else
|
|
322
|
+
render_main_title(document)
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# return the correct name of the institution to link to for OAI objects
|
|
327
|
+
def return_oai_inst_name(document)
|
|
328
|
+
if document[blacklight_config.institution_field.to_sym]
|
|
329
|
+
document[blacklight_config.institution_field.to_sym].first
|
|
330
|
+
else
|
|
331
|
+
t('blacklight.oai_objects.default_inst_name')
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# creates an array of collection links
|
|
336
|
+
# for display on catalog#index list view and catalog#show breadcrumb
|
|
337
|
+
def setup_collection_links(document, link_class=nil)
|
|
338
|
+
coll_hash = {}
|
|
339
|
+
0.upto document[:collection_pid_ssm].length-1 do |index|
|
|
340
|
+
coll_hash[document[blacklight_config.collection_field.to_sym][index]] = document[:collection_pid_ssm][index]
|
|
341
|
+
end
|
|
342
|
+
coll_links = []
|
|
343
|
+
coll_hash.sort.each do |coll_array|
|
|
344
|
+
coll_links << link_to(coll_array[0],
|
|
345
|
+
collection_path(:id => coll_array[1]),
|
|
346
|
+
:class => link_class.presence)
|
|
347
|
+
end
|
|
348
|
+
coll_links
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
# create a list of names and roles to be displayed
|
|
352
|
+
def setup_names_roles(document)
|
|
353
|
+
names = []
|
|
354
|
+
roles = []
|
|
355
|
+
multi_role_indices = []
|
|
356
|
+
name_fields = [document[:name_personal_tsim], document[:name_corporate_tsim], document[:name_generic_tsim]]
|
|
357
|
+
role_fields = [document[:name_personal_role_tsim], document[:name_corporate_role_tsim], document[:name_generic_role_tsim]]
|
|
358
|
+
name_fields.each_with_index do |name_field,name_field_index|
|
|
359
|
+
if name_field
|
|
360
|
+
0.upto name_field.length-1 do |index|
|
|
361
|
+
names << name_field[index]
|
|
362
|
+
if role_fields[name_field_index] && role_fields[name_field_index][index]
|
|
363
|
+
roles << role_fields[name_field_index][index].strip
|
|
364
|
+
else
|
|
365
|
+
roles << 'Creator'
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
roles.each_with_index do |role,index|
|
|
371
|
+
if /[\|]{2}/.match(role)
|
|
372
|
+
multi_roles = role.split('||')
|
|
373
|
+
multi_role_name = names[index]
|
|
374
|
+
multi_role_indices << index
|
|
375
|
+
multi_roles.each { |multi_role| roles << multi_role }
|
|
376
|
+
0.upto multi_roles.length-1 do
|
|
377
|
+
names << multi_role_name
|
|
378
|
+
end
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
unless multi_role_indices.empty?
|
|
382
|
+
multi_role_indices.reverse.each do |index|
|
|
383
|
+
names.delete_at(index)
|
|
384
|
+
roles.delete_at(index)
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
return names,roles
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
def should_autofocus_on_search_box?
|
|
391
|
+
(controller.is_a? Blacklight::Catalog and
|
|
392
|
+
action_name == "index" and
|
|
393
|
+
params[:q].to_s.empty? and
|
|
394
|
+
params[:f].to_s.empty?) or
|
|
395
|
+
(controller.is_a? PagesController and action_name == 'home')
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
# LOCAL OVERRIDE: don't want to pull thumbnail url from Solr
|
|
399
|
+
def thumbnail_url document
|
|
400
|
+
if document[:exemplary_image_ssi] && !document[blacklight_config.flagged_field.to_sym]
|
|
401
|
+
datastream_disseminator_url(document[:exemplary_image_ssi], 'thumbnail300')
|
|
402
|
+
elsif document[:type_of_resource_ssim]
|
|
403
|
+
render_object_icon_path(document[:type_of_resource_ssim].first)
|
|
404
|
+
elsif document[blacklight_config.index.display_type_field.to_sym] == 'Collection'
|
|
405
|
+
collection_icon_path
|
|
406
|
+
elsif document[blacklight_config.index.display_type_field.to_sym] == 'Institution'
|
|
407
|
+
institution_icon_path
|
|
408
|
+
else
|
|
409
|
+
render_object_icon_path(nil)
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
end
|
|
414
|
+
end
|