commonwealth-vlr-engine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +91 -0
  3. data/.gitmodules +3 -0
  4. data/Gemfile +20 -0
  5. data/LICENSE +202 -0
  6. data/README.md +38 -0
  7. data/Rakefile +43 -0
  8. data/app/assets/images/commonwealth-vlr-engine/bplLoginButton.png +0 -0
  9. data/app/assets/images/commonwealth-vlr-engine/dc_audio-icon.png +0 -0
  10. data/app/assets/images/commonwealth-vlr-engine/dc_collection-icon.png +0 -0
  11. data/app/assets/images/commonwealth-vlr-engine/dc_image-icon.png +0 -0
  12. data/app/assets/images/commonwealth-vlr-engine/dc_institution-icon.png +0 -0
  13. data/app/assets/images/commonwealth-vlr-engine/dc_moving-image-icon.png +0 -0
  14. data/app/assets/images/commonwealth-vlr-engine/dc_text-icon.png +0 -0
  15. data/app/assets/images/commonwealth-vlr-engine/facebookLoginButton.png +0 -0
  16. data/app/assets/images/commonwealth-vlr-engine/loading-wdl-grid.gif +0 -0
  17. data/app/assets/images/commonwealth-vlr-engine/loading-wdl.gif +0 -0
  18. data/app/assets/images/commonwealth-vlr-engine/loading.gif +0 -0
  19. data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_grouphover.png +0 -0
  20. data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_hover.png +0 -0
  21. data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_pressed.png +0 -0
  22. data/app/assets/images/commonwealth-vlr-engine/openseadragon/fullpage_rest.png +0 -0
  23. data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_grouphover.png +0 -0
  24. data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_hover.png +0 -0
  25. data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_pressed.png +0 -0
  26. data/app/assets/images/commonwealth-vlr-engine/openseadragon/home_rest.png +0 -0
  27. data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_grouphover.png +0 -0
  28. data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_hover.png +0 -0
  29. data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_pressed.png +0 -0
  30. data/app/assets/images/commonwealth-vlr-engine/openseadragon/next_rest.png +0 -0
  31. data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_grouphover.png +0 -0
  32. data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_hover.png +0 -0
  33. data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_pressed.png +0 -0
  34. data/app/assets/images/commonwealth-vlr-engine/openseadragon/previous_rest.png +0 -0
  35. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_grouphover.png +0 -0
  36. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_hover.png +0 -0
  37. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_pressed.png +0 -0
  38. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateleft_rest.png +0 -0
  39. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_grouphover.png +0 -0
  40. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_hover.png +0 -0
  41. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_pressed.png +0 -0
  42. data/app/assets/images/commonwealth-vlr-engine/openseadragon/rotateright_rest.png +0 -0
  43. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_grouphover.png +0 -0
  44. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_hover.png +0 -0
  45. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_pressed.png +0 -0
  46. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomin_rest.png +0 -0
  47. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_grouphover.png +0 -0
  48. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_hover.png +0 -0
  49. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_pressed.png +0 -0
  50. data/app/assets/images/commonwealth-vlr-engine/openseadragon/zoomout_rest.png +0 -0
  51. data/app/assets/images/commonwealth-vlr-engine/vlr_logo_img.png +0 -0
  52. data/app/assets/javascripts/blacklight_gallery.js +1 -0
  53. data/app/assets/javascripts/blacklight_google_analytics/blacklight_google_analytics.js.erb +165 -0
  54. data/app/assets/javascripts/bootstrap-accessibility-plugin/bootstrap-accessibility.js +586 -0
  55. data/app/assets/javascripts/commonwealth-vlr-engine.js +22 -0
  56. data/app/assets/javascripts/commonwealth-vlr-engine/collection_facets.js +5 -0
  57. data/app/assets/javascripts/commonwealth-vlr-engine/disable_dropdown_nav.js +21 -0
  58. data/app/assets/javascripts/commonwealth-vlr-engine/feedback_alerts.js.erb +19 -0
  59. data/app/assets/javascripts/commonwealth-vlr-engine/folder_tools.js +26 -0
  60. data/app/assets/javascripts/commonwealth-vlr-engine/multi_img_viewer.js.erb +20 -0
  61. data/app/assets/javascripts/commonwealth-vlr-engine/ocr_search_utils.js.erb +32 -0
  62. data/app/assets/javascripts/commonwealth-vlr-engine/volumes_list.js +5 -0
  63. data/app/assets/javascripts/openseadragon.js +2 -0
  64. data/app/assets/javascripts/respond/respond.min.js +6 -0
  65. data/app/assets/javascripts/wdl-viewer/fd-slider.js +1303 -0
  66. data/app/assets/javascripts/wdl-viewer/jquery-deparam.js +113 -0
  67. data/app/assets/javascripts/wdl-viewer/jquery.ba-throttle-debounce.min.js +9 -0
  68. data/app/assets/javascripts/wdl-viewer/jquery.hammer.min.js +7 -0
  69. data/app/assets/javascripts/wdl-viewer/modernizr-wdl.min.js +3 -0
  70. data/app/assets/javascripts/wdl-viewer/wdl-search.js +33 -0
  71. data/app/assets/javascripts/wdl-viewer/wdl-viewer_commonwealth.js +1147 -0
  72. data/app/assets/stylesheets/blacklight_advanced_search.css +5 -0
  73. data/app/assets/stylesheets/blacklight_gallery.css +1 -0
  74. data/app/assets/stylesheets/blacklight_maps.css +1 -0
  75. data/app/assets/stylesheets/bootstrap-accessibility-plugin/bootstrap-accessibility.css +105 -0
  76. data/app/assets/stylesheets/commonwealth-vlr-engine/advanced_search.scss +139 -0
  77. data/app/assets/stylesheets/commonwealth-vlr-engine/basic_search.scss +47 -0
  78. data/app/assets/stylesheets/commonwealth-vlr-engine/book_viewer.scss +576 -0
  79. data/app/assets/stylesheets/commonwealth-vlr-engine/carousel.scss +94 -0
  80. data/app/assets/stylesheets/commonwealth-vlr-engine/cmmnwlth_defaults.scss +45 -0
  81. data/app/assets/stylesheets/commonwealth-vlr-engine/cmmnwlth_shared.scss +75 -0
  82. data/app/assets/stylesheets/commonwealth-vlr-engine/collections.scss +563 -0
  83. data/app/assets/stylesheets/commonwealth-vlr-engine/commonwealth-vlr-engine.css +32 -0
  84. data/app/assets/stylesheets/commonwealth-vlr-engine/facets.scss +111 -0
  85. data/app/assets/stylesheets/commonwealth-vlr-engine/feedback.scss +10 -0
  86. data/app/assets/stylesheets/commonwealth-vlr-engine/folders.scss +276 -0
  87. data/app/assets/stylesheets/commonwealth-vlr-engine/footer.scss +47 -0
  88. data/app/assets/stylesheets/commonwealth-vlr-engine/header.scss +329 -0
  89. data/app/assets/stylesheets/commonwealth-vlr-engine/home.scss +269 -0
  90. data/app/assets/stylesheets/commonwealth-vlr-engine/index.scss +580 -0
  91. data/app/assets/stylesheets/commonwealth-vlr-engine/institutions.scss +246 -0
  92. data/app/assets/stylesheets/commonwealth-vlr-engine/pages.scss +31 -0
  93. data/app/assets/stylesheets/commonwealth-vlr-engine/search_inside.scss +172 -0
  94. data/app/assets/stylesheets/commonwealth-vlr-engine/searches.scss +55 -0
  95. data/app/assets/stylesheets/commonwealth-vlr-engine/show.scss +840 -0
  96. data/app/assets/stylesheets/commonwealth-vlr-engine/signin.scss +43 -0
  97. data/app/assets/stylesheets/commonwealth-vlr-engine/users.scss +18 -0
  98. data/app/assets/stylesheets/commonwealth-vlr-engine/vlr_dependencies.css +8 -0
  99. data/app/assets/stylesheets/ie_fixes.css +16 -0
  100. data/app/assets/stylesheets/openseadragon.css +1 -0
  101. data/app/assets/stylesheets/wdl-viewer/fd-slider.min.css +2 -0
  102. data/app/controllers/blacklight_advanced_search/advanced_controller.rb +66 -0
  103. data/app/controllers/bookmarks_controller.rb +38 -0
  104. data/app/controllers/collections_controller.rb +128 -0
  105. data/app/controllers/commonwealth_vlr_engine/application_controller.rb +8 -0
  106. data/app/controllers/feedback_controller.rb +39 -0
  107. data/app/controllers/folder_items_actions_controller.rb +72 -0
  108. data/app/controllers/folder_items_controller.rb +90 -0
  109. data/app/controllers/folders_controller.rb +132 -0
  110. data/app/controllers/iiif_manifest_controller.rb +74 -0
  111. data/app/controllers/image_viewer_controller.rb +34 -0
  112. data/app/controllers/institutions_controller.rb +62 -0
  113. data/app/controllers/ocr_search_controller.rb +78 -0
  114. data/app/controllers/pages_controller.rb +5 -0
  115. data/app/controllers/users/omniauth_callbacks_controller.rb +10 -0
  116. data/app/controllers/users/registrations_controller.rb +3 -0
  117. data/app/controllers/users/sessions_controller.rb +3 -0
  118. data/app/controllers/users_controller.rb +27 -0
  119. data/app/helpers/blacklight_maps_helper.rb +3 -0
  120. data/app/helpers/collections_helper.rb +3 -0
  121. data/app/helpers/commonwealth_vlr_engine/application_helper.rb +200 -0
  122. data/app/helpers/commonwealth_vlr_engine/blacklight_helper.rb +35 -0
  123. data/app/helpers/commonwealth_vlr_engine/blacklight_url_helper.rb +53 -0
  124. data/app/helpers/commonwealth_vlr_engine/catalog_helper.rb +414 -0
  125. data/app/helpers/commonwealth_vlr_engine/collections_helper_behavior.rb +19 -0
  126. data/app/helpers/commonwealth_vlr_engine/component_helper.rb +22 -0
  127. data/app/helpers/commonwealth_vlr_engine/facets_helper.rb +20 -0
  128. data/app/helpers/commonwealth_vlr_engine/feedback_helper_behavior.rb +14 -0
  129. data/app/helpers/commonwealth_vlr_engine/folders_helper_behavior.rb +9 -0
  130. data/app/helpers/commonwealth_vlr_engine/image_viewer_helper_behavior.rb +14 -0
  131. data/app/helpers/commonwealth_vlr_engine/institutions_helper_behavior.rb +31 -0
  132. data/app/helpers/commonwealth_vlr_engine/layout_helper.rb +22 -0
  133. data/app/helpers/commonwealth_vlr_engine/ocr_search_helper_behavior.rb +48 -0
  134. data/app/helpers/commonwealth_vlr_engine/pages_helper_behavior.rb +38 -0
  135. data/app/helpers/commonwealth_vlr_engine/vlr_blacklight_maps_helper_behavior.rb +59 -0
  136. data/app/helpers/feedback_helper.rb +3 -0
  137. data/app/helpers/folders_helper.rb +3 -0
  138. data/app/helpers/image_viewer_helper.rb +3 -0
  139. data/app/helpers/institutions_helper.rb +3 -0
  140. data/app/helpers/ocr_search_helper.rb +3 -0
  141. data/app/helpers/pages_helper.rb +3 -0
  142. data/app/mailers/notifier.rb +5 -0
  143. data/app/models/carousel_slide.rb +7 -0
  144. data/app/models/record_mailer.rb +18 -0
  145. data/app/models/user.rb +15 -0
  146. data/app/views/advanced/_advanced_search_date.html.erb +23 -0
  147. data/app/views/advanced/_advanced_search_facets.html.erb +5 -0
  148. data/app/views/advanced/_advanced_search_fields.html.erb +39 -0
  149. data/app/views/advanced/_advanced_search_form.html.erb +51 -0
  150. data/app/views/advanced/_advanced_search_help.html.erb +13 -0
  151. data/app/views/advanced/_facet_layout.html.erb +9 -0
  152. data/app/views/advanced/_facet_limit.html.erb +15 -0
  153. data/app/views/advanced/index.html.erb +29 -0
  154. data/app/views/blacklight_advanced_search/_facet_limit.html.erb +12 -0
  155. data/app/views/bookmarks/_tools.html.erb +25 -0
  156. data/app/views/bookmarks/index.html.erb +64 -0
  157. data/app/views/bookmarks/update.js.erb +1 -0
  158. data/app/views/bpluser/folders/_folder.html.erb +36 -0
  159. data/app/views/catalog/_add_this.html.erb +10 -0
  160. data/app/views/catalog/_az_links.html.erb +15 -0
  161. data/app/views/catalog/_basic_search.html.erb +67 -0
  162. data/app/views/catalog/_citation.html.erb +50 -0
  163. data/app/views/catalog/_constraints.html.erb +26 -0
  164. data/app/views/catalog/_document_collections_gallery.html.erb +7 -0
  165. data/app/views/catalog/_facet_limit_series.html.erb +21 -0
  166. data/app/views/catalog/_facets.html.erb +31 -0
  167. data/app/views/catalog/_facets_series.html.erb +4 -0
  168. data/app/views/catalog/_folder_item_control.html.erb +64 -0
  169. data/app/views/catalog/_index_collections_gallery.html.erb +12 -0
  170. data/app/views/catalog/_index_gallery.html.erb +11 -0
  171. data/app/views/catalog/_index_header_default.html.erb +22 -0
  172. data/app/views/catalog/_index_list_collection.html.erb +33 -0
  173. data/app/views/catalog/_index_list_default.html.erb +13 -0
  174. data/app/views/catalog/_index_map_institutions.html.erb +10 -0
  175. data/app/views/catalog/_index_masonry.html.erb +8 -0
  176. data/app/views/catalog/_index_slideshow.html.erb +18 -0
  177. data/app/views/catalog/_more_like_this.html.erb +9 -0
  178. data/app/views/catalog/_opengraph.html.erb +16 -0
  179. data/app/views/catalog/_previous_next_doc.html.erb +22 -0
  180. data/app/views/catalog/_results_pagination.html.erb +9 -0
  181. data/app/views/catalog/_search_form.html.erb +23 -0
  182. data/app/views/catalog/_search_header.html.erb +5 -0
  183. data/app/views/catalog/_show_default.html.erb +75 -0
  184. data/app/views/catalog/_show_main_content.html.erb +27 -0
  185. data/app/views/catalog/_show_more_like_this.html.erb +15 -0
  186. data/app/views/catalog/_show_partials/_show_book_viewer_link.html.erb +25 -0
  187. data/app/views/catalog/_show_partials/_show_default_img.html.erb +32 -0
  188. data/app/views/catalog/_show_partials/_show_default_metadata.html.erb +486 -0
  189. data/app/views/catalog/_show_partials/_show_default_simple_img_viewer.html.erb +45 -0
  190. data/app/views/catalog/_show_partials/_show_downloads.html.erb +14 -0
  191. data/app/views/catalog/_show_partials/_show_flagged_notice.html.erb +29 -0
  192. data/app/views/catalog/_show_partials/_show_multi_img.html.erb +42 -0
  193. data/app/views/catalog/_show_partials/_show_multi_img_pagination.html.erb +20 -0
  194. data/app/views/catalog/_show_partials/_show_oai_item_img.html.erb +5 -0
  195. data/app/views/catalog/_show_partials/_show_oai_item_link.html.erb +8 -0
  196. data/app/views/catalog/_show_partials/_show_prev_next_carousel_links.html.erb +17 -0
  197. data/app/views/catalog/_show_partials/_show_volumes.html.erb +52 -0
  198. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  199. data/app/views/catalog/_show_tools.html.erb +42 -0
  200. data/app/views/catalog/_zero_results.html.erb +20 -0
  201. data/app/views/catalog/email.html.erb +6 -0
  202. data/app/views/catalog/index.html.erb +17 -0
  203. data/app/views/catalog/metadata_view.html.erb +7 -0
  204. data/app/views/catalog/show.html.erb +13 -0
  205. data/app/views/collections/_search_form_collection.html.erb +23 -0
  206. data/app/views/collections/index.html.erb +30 -0
  207. data/app/views/collections/show.html.erb +116 -0
  208. data/app/views/devise/confirmations/new.html.erb +14 -0
  209. data/app/views/devise/mailer/reset_password_instructions.html.erb +13 -0
  210. data/app/views/devise/passwords/edit.html.erb +33 -0
  211. data/app/views/devise/passwords/new.html.erb +31 -0
  212. data/app/views/devise/registrations/edit.html.erb +83 -0
  213. data/app/views/devise/registrations/new.html.erb +53 -0
  214. data/app/views/devise/sessions/new.html.erb +75 -0
  215. data/app/views/devise/shared/_links.erb +29 -0
  216. data/app/views/feedback/complete.html.erb +9 -0
  217. data/app/views/feedback/show.html.erb +61 -0
  218. data/app/views/folder_items/create.js.erb +1 -0
  219. data/app/views/folder_items/destroy.js.erb +1 -0
  220. data/app/views/folder_items/item_actions.js.erb +2 -0
  221. data/app/views/folder_items/update.js.erb +1 -0
  222. data/app/views/folders/_in_folder.html.erb +2 -0
  223. data/app/views/folders/_new_edit_form_fields.html.erb +36 -0
  224. data/app/views/folders/edit.html.erb +25 -0
  225. data/app/views/folders/index.html.erb +73 -0
  226. data/app/views/folders/new.html.erb +27 -0
  227. data/app/views/folders/public_list.html.erb +44 -0
  228. data/app/views/folders/show.html.erb +98 -0
  229. data/app/views/image_viewer/_book_viewer_help.html.erb +125 -0
  230. data/app/views/image_viewer/_render_book_viewer.html.erb +185 -0
  231. data/app/views/image_viewer/book_viewer.html.erb +57 -0
  232. data/app/views/image_viewer/show.js.erb +19 -0
  233. data/app/views/institutions/_intro_text.html.erb +1 -0
  234. data/app/views/institutions/_map_institutions_search.html.erb +9 -0
  235. data/app/views/institutions/_search_form_institution.html.erb +24 -0
  236. data/app/views/institutions/index.html.erb +31 -0
  237. data/app/views/institutions/show.html.erb +104 -0
  238. data/app/views/layouts/_google_analytics.html.erb +9 -0
  239. data/app/views/layouts/book_viewer.html.erb +37 -0
  240. data/app/views/layouts/commonwealth-vlr-engine.html.erb +59 -0
  241. data/app/views/notifier/feedback.text.erb +6 -0
  242. data/app/views/ocr_search/_index_ocr_list.html.erb +17 -0
  243. data/app/views/ocr_search/_search_form_ocr.html.erb +23 -0
  244. data/app/views/ocr_search/_snippets_more.html.erb +15 -0
  245. data/app/views/ocr_search/_zero_results_ocr.html.erb +9 -0
  246. data/app/views/ocr_search/index.html.erb +49 -0
  247. data/app/views/pages/_carousel.html.erb +46 -0
  248. data/app/views/pages/_home_partials/_banner.html.erb +23 -0
  249. data/app/views/pages/_home_partials/_browse.html.erb +55 -0
  250. data/app/views/pages/_home_partials/_context.html.erb +24 -0
  251. data/app/views/pages/_home_partials/_home_content.html.erb +14 -0
  252. data/app/views/pages/about.html.erb +10 -0
  253. data/app/views/pages/about_site.html.erb +6 -0
  254. data/app/views/pages/explore.html.erb +32 -0
  255. data/app/views/pages/home.html.erb +3 -0
  256. data/app/views/record_mailer/email_record.text.erb +7 -0
  257. data/app/views/saved_searches/index.html.erb +60 -0
  258. data/app/views/search_history/index.html.erb +59 -0
  259. data/app/views/shared/_error_messages.html.erb +9 -0
  260. data/app/views/shared/_flash_msg_maintenance.html.erb +6 -0
  261. data/app/views/shared/_folder_item_actions.html.erb +66 -0
  262. data/app/views/shared/_folder_tools.html.erb +4 -0
  263. data/app/views/shared/_footer.html.erb +14 -0
  264. data/app/views/shared/_header_navbar.html.erb +34 -0
  265. data/app/views/shared/_nav_links.html.erb +58 -0
  266. data/app/views/shared/_search_form_header.html.erb +16 -0
  267. data/app/views/shared/_tools.html.erb +14 -0
  268. data/app/views/shared/_user_util_links.html.erb +43 -0
  269. data/app/views/users/show.html.erb +33 -0
  270. data/commonwealth-vlr-engine.gemspec +47 -0
  271. data/config/initializers/patch_blacklight_advanced_search.rb +74 -0
  272. data/config/initializers/patch_blacklight_maps.rb +20 -0
  273. data/config/jetty.yml +7 -0
  274. data/config/locales/commonwealth-vlr-engine.en.yml +463 -0
  275. data/config/routes.rb +92 -0
  276. data/lib/commonwealth-vlr-engine.rb +55 -0
  277. data/lib/commonwealth-vlr-engine/commonwealth_search_builder.rb +66 -0
  278. data/lib/commonwealth-vlr-engine/controller.rb +69 -0
  279. data/lib/commonwealth-vlr-engine/controller_override.rb +238 -0
  280. data/lib/commonwealth-vlr-engine/engine.rb +40 -0
  281. data/lib/commonwealth-vlr-engine/finder.rb +285 -0
  282. data/lib/commonwealth-vlr-engine/iiif_manifest.rb +189 -0
  283. data/lib/commonwealth-vlr-engine/notifier.rb +33 -0
  284. data/lib/commonwealth-vlr-engine/pages.rb +33 -0
  285. data/lib/commonwealth-vlr-engine/render_constraints_override.rb +57 -0
  286. data/lib/commonwealth-vlr-engine/route_sets.rb +49 -0
  287. data/lib/commonwealth-vlr-engine/routes.rb +21 -0
  288. data/lib/commonwealth-vlr-engine/version.rb +3 -0
  289. data/lib/generators/commonwealth_vlr_engine/controller_generator.rb +92 -0
  290. data/lib/generators/commonwealth_vlr_engine/environment_generator.rb +49 -0
  291. data/lib/generators/commonwealth_vlr_engine/install_generator.rb +57 -0
  292. data/lib/generators/commonwealth_vlr_engine/localassets_generator.rb +29 -0
  293. data/lib/generators/commonwealth_vlr_engine/model_generator.rb +65 -0
  294. data/lib/generators/commonwealth_vlr_engine/routes_generator.rb +39 -0
  295. data/lib/generators/commonwealth_vlr_engine/templates/commonwealth_vlr_engine.css.scss +4 -0
  296. data/lib/generators/commonwealth_vlr_engine/templates/config/contact_emails.yml.sample +13 -0
  297. data/lib/generators/commonwealth_vlr_engine/templates/config/fedora.yml.sample +6 -0
  298. data/lib/generators/commonwealth_vlr_engine/templates/config/geojson_static_file.yml.sample +11 -0
  299. data/lib/generators/commonwealth_vlr_engine/templates/config/google_analytics.yml.sample +10 -0
  300. data/lib/generators/commonwealth_vlr_engine/templates/config/iiif_server.yml.sample +10 -0
  301. data/lib/generators/commonwealth_vlr_engine/templates/config/initializers/a_load_commonwealth_vlr_configs.rb +14 -0
  302. data/lib/generators/commonwealth_vlr_engine/templates/config/initializers/devise.rb +269 -0
  303. data/lib/generators/commonwealth_vlr_engine/templates/config/initializers/secret_token.rb +8 -0
  304. data/lib/generators/commonwealth_vlr_engine/templates/config/locales/blacklight.en.yml +44 -0
  305. data/lib/generators/commonwealth_vlr_engine/templates/config/locales/devise.en.yml +12 -0
  306. data/lib/generators/commonwealth_vlr_engine/templates/config/omniauth-facebook.yml.sample +14 -0
  307. data/lib/generators/commonwealth_vlr_engine/templates/config/omniauth-polaris.yml.sample +20 -0
  308. data/lib/generators/commonwealth_vlr_engine/templates/config/vlr.yml +13 -0
  309. data/lib/generators/commonwealth_vlr_engine/yml_generator.rb +29 -0
  310. data/lib/railties/commonwealth_vlr_engine.rake +6 -0
  311. data/solr_conf/conf/schema.xml +476 -0
  312. data/solr_conf/conf/solrconfig.xml +286 -0
  313. data/spec/controllers/catalog_controller_spec.rb +67 -0
  314. data/spec/controllers/collections_controller_spec.rb +127 -0
  315. data/spec/controllers/feedback_controller_spec.rb +51 -0
  316. data/spec/controllers/folder_items_actions_controller_spec.rb +99 -0
  317. data/spec/controllers/folder_items_controller_spec.rb +90 -0
  318. data/spec/controllers/folders_controller_spec.rb +368 -0
  319. data/spec/controllers/iiif_manifest_controller_spec.rb +85 -0
  320. data/spec/controllers/image_viewer_controller_spec.rb +50 -0
  321. data/spec/controllers/institutions_controller_spec.rb +64 -0
  322. data/spec/controllers/ocr_search_controller_spec.rb +71 -0
  323. data/spec/controllers/pages_controller_spec.rb +58 -0
  324. data/spec/controllers/users_controller_spec.rb +62 -0
  325. data/spec/features/catalog/_az_links_spec.rb +27 -0
  326. data/spec/features/catalog/_show_partials/_show_book_viewer_link_spec.rb +47 -0
  327. data/spec/features/catalog/_show_partials/_show_default_simple_img_viewer_spec.rb +19 -0
  328. data/spec/features/catalog/_show_partials/_show_flagged_notice_spec.rb +23 -0
  329. data/spec/features/catalog/_show_partials/_show_multi_img_spec.rb +18 -0
  330. data/spec/features/catalog/_show_partials/_show_volumes_spec.rb +24 -0
  331. data/spec/features/collections/index_spec.rb +35 -0
  332. data/spec/features/feedback/show_spec.rb +47 -0
  333. data/spec/features/image_viewer/book_viewer_spec.rb +67 -0
  334. data/spec/features/institutions/index_spec.rb +31 -0
  335. data/spec/features/institutions/map_view_spec.rb +37 -0
  336. data/spec/features/more_like_this_search_spec.rb +23 -0
  337. data/spec/features/ocr_search/index_spec.rb +89 -0
  338. data/spec/fixtures/sample_rss_feed.xml +56 -0
  339. data/spec/fixtures/sample_solr_documents.yml +2748 -0
  340. data/spec/helpers/application_helper_spec.rb +114 -0
  341. data/spec/helpers/catalog_helper_spec.rb +386 -0
  342. data/spec/helpers/collections_helper_spec.rb +28 -0
  343. data/spec/helpers/component_helper_spec.rb +34 -0
  344. data/spec/helpers/folders_helper_spec.rb +31 -0
  345. data/spec/helpers/image_viewer_helper_spec.rb +15 -0
  346. data/spec/helpers/institutions_helper_spec.rb +53 -0
  347. data/spec/helpers/ocr_search_helper_spec.rb +70 -0
  348. data/spec/helpers/pages_helper_spec.rb +21 -0
  349. data/spec/lib/commonwealth-vlr-engine/commonwealth_search_builder_spec.rb +101 -0
  350. data/spec/lib/commonwealth-vlr-engine/controller_override_spec.rb +41 -0
  351. data/spec/lib/commonwealth-vlr-engine/controller_spec.rb +33 -0
  352. data/spec/lib/commonwealth-vlr-engine/finder_spec.rb +140 -0
  353. data/spec/lib/commonwealth-vlr-engine/iiif_manifest_spec.rb +157 -0
  354. data/spec/lib/commonwealth-vlr-engine/render_constraints_override_spec.rb +97 -0
  355. data/spec/mailers/notifier_spec.rb +31 -0
  356. data/spec/models/carousel_slide_spec.rb +38 -0
  357. data/spec/spec_helper.rb +40 -0
  358. data/spec/tasks/vlr_engine_rake_spec.rb +28 -0
  359. data/spec/test_app_templates/lib/generators/test_app_generator.rb +23 -0
  360. data/tasks/vlr_engine.rake +46 -0
  361. metadata +788 -0
data/config/routes.rb ADDED
@@ -0,0 +1,92 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount Bpluser::Engine => '/bpluser'
4
+
5
+ # alias for map browse
6
+ get 'places', :to => 'catalog#map', :as => 'places_facet'
7
+
8
+ # formats browse
9
+ get 'formats', :to => 'catalog#formats_facet', :as => 'formats_facet'
10
+
11
+ # MODS metadata view
12
+ get 'search/:id/metadata_view', :to => 'catalog#metadata_view', :as => 'metadata_view_catalog'
13
+
14
+ # collections
15
+ resources :collections, :only => [:index, :show]
16
+ get 'collections/facet/:id', :to => 'collections#facet', :as => 'collections_facet'
17
+
18
+ # institutions
19
+ resources :institutions, :only => [:index, :show]
20
+ get 'institutions/facet/:id', :to => 'institutions#facet', :as => 'institutions_facet'
21
+
22
+ # contact form
23
+ # for some reason feedback submit won't work w/o this addition
24
+ match 'feedback', :to => 'feedback#show', :via => [:get, :post]
25
+ get 'feedback/complete', :to => 'feedback#complete'
26
+
27
+ # folders
28
+ get 'folders/public', :to => 'folders#public_list', :as => 'public_folders'
29
+ resources :folders
30
+ delete 'folder/:id/clear', :to => 'folder_items#clear', :as => 'clear_folder_items'
31
+ put 'folder/:id/item_actions', :to => 'folder_items_actions#folder_item_actions', :as => 'selected_folder_items_actions'
32
+
33
+ # folder items
34
+ resources :folder_items
35
+
36
+ # user account management (not login/auth)
37
+ resources :users, :only => [:show, :index]
38
+
39
+ # multi-image viewers
40
+ get 'image_viewer/:id', :to => 'image_viewer#show', :as => 'image_viewer'
41
+ get 'book_viewer/:id', :to => 'image_viewer#book_viewer', :as => 'book_viewer'
42
+
43
+ # static pages
44
+ get 'explore', :to => 'pages#explore', :as => 'explore'
45
+ get 'about', :to => 'pages#about', :as => 'about'
46
+ get 'about_this_site', :to => 'pages#about_site', :as => 'about_site'
47
+
48
+ # IIIF manifest
49
+ get 'search/:id/manifest', :to => 'iiif_manifest#manifest', :as => 'iiif_manifest'
50
+ get 'search/:id/canvas/:canvas_object_id', :to => 'iiif_manifest#canvas', :as => 'iiif_canvas'
51
+ get 'search/:id/annotation/:annotation_object_id', :to => 'iiif_manifest#annotation', :as => 'iiif_annotation'
52
+ get 'search/:id/iiif_collection', :to => 'iiif_manifest#collection', :as => 'iiif_collection'
53
+
54
+ # OCR search results
55
+ get 'search/:id/fulltext', :to => 'ocr_search#index', :as => 'ocr_search'
56
+
57
+ # DEPRECATED ROUTES AND EXAMPLES
58
+
59
+ # this is generated into local app via CommonwealthVlrEngine::RoutesGenerator
60
+ #devise_for :users, :controllers => {:omniauth_callbacks => "users/omniauth_callbacks", :registrations => "users/registrations", :sessions => "users/sessions"}
61
+
62
+ # this is added to Blacklight::Routes via CommonwealthVlrEngine::Routes
63
+ #put 'bookmarks/item_actions', :to => 'folder_items_actions#folder_item_actions', :as => 'selected_bookmarks_actions'
64
+
65
+ # custom 'search' path routes are added to Blacklight::Routes::RouteSets via CommonwealthVlrEngine::RouteSets
66
+ # copy the below into local app to add all BL routes manually (remove blacklight_for call)
67
+ #delete 'bookmarks/clear', :to => 'bookmarks#clear', :as => 'clear_bookmarks'
68
+ #resources :bookmarks
69
+ #get 'search_history', :to => 'search_history#index', :as => 'search_history'
70
+ #delete 'search_history/clear', :to => 'search_history#clear', :as => 'clear_search_history'
71
+ #delete 'saved_searches/clear', :to => 'saved_searches#clear', :as => 'clear_saved_searches'
72
+ #get 'saved_searches', :to => 'saved_searches#index', :as => 'saved_searches'
73
+ #put 'saved_searches/save/:id', :to => 'saved_searches#save', :as => 'save_search'
74
+ #delete 'saved_searches/forget/:id', :to => 'saved_searches#forget', :as => 'forget_search'
75
+ #post 'saved_searches/forget/:id', :to => 'saved_searches#forget'
76
+ #get 'search/opensearch', :to => 'catalog#opensearch', :as => 'opensearch_catalog'
77
+ #get 'search/citation', :to => 'catalog#citation', :as => 'citation_catalog'
78
+ #get 'search/email', :as => 'email_catalog'
79
+ #post 'search/email'
80
+ #match 'search/email', :to => 'catalog#email', :as => 'email_catalog', :via => [:get, :post]
81
+ #get 'search/facet/:id', :to => 'catalog#facet', :as => 'catalog_facet'
82
+ #get 'search', :to => 'catalog#index', :as => 'catalog_index'
83
+ #resources :solr_document, :path => 'search', :controller => 'catalog', :only => [:show, :update] do
84
+ # member do
85
+ # post 'track'
86
+ # end
87
+ #end
88
+ # :show and :update are for backwards-compatibility with catalog_url named routes
89
+ #resources :catalog, :only => [:show, :update]
90
+ # end local BL routes override
91
+
92
+ end
@@ -0,0 +1,55 @@
1
+ require 'commonwealth-vlr-engine/engine'
2
+ require 'commonwealth-vlr-engine/version'
3
+
4
+ module CommonwealthVlrEngine
5
+
6
+ require 'commonwealth-vlr-engine/controller_override'
7
+ require 'commonwealth-vlr-engine/commonwealth_search_builder'
8
+ require 'commonwealth-vlr-engine/controller'
9
+ require 'commonwealth-vlr-engine/render_constraints_override'
10
+ require 'commonwealth-vlr-engine/pages'
11
+ require 'commonwealth-vlr-engine/routes'
12
+ require 'commonwealth-vlr-engine/route_sets'
13
+ require 'commonwealth-vlr-engine/finder'
14
+ require 'commonwealth-vlr-engine/notifier'
15
+ require 'commonwealth-vlr-engine/iiif_manifest'
16
+
17
+ def self.config
18
+ @config ||= YAML::load(File.open(config_path))[env]
19
+ .with_indifferent_access
20
+ end
21
+
22
+ def self.app_root
23
+ return @app_root if @app_root
24
+ @app_root = Rails.root if defined?(Rails) and defined?(Rails.root)
25
+ @app_root ||= APP_ROOT if defined?(APP_ROOT)
26
+ @app_root ||= '.'
27
+ end
28
+
29
+ def self.env
30
+ return @env if @env
31
+ #The following commented line always returns "test" in a rails c production console. Unsure of how to fix this yet...
32
+ #@env = ENV["RAILS_ENV"] = "test" if ENV
33
+ @env ||= Rails.env if defined?(Rails) and defined?(Rails.root)
34
+ @env ||= 'development'
35
+ end
36
+
37
+ def self.config_path
38
+ File.join(app_root, 'config', 'vlr.yml')
39
+ end
40
+
41
+ def self.inject!
42
+
43
+ CatalogController.send(:include, CommonwealthVlrEngine::RenderConstraintsOverride)
44
+ CatalogController.send(:helper, CommonwealthVlrEngine::RenderConstraintsOverride) unless
45
+ CatalogController.helpers.is_a?(CommonwealthVlrEngine::RenderConstraintsOverride)
46
+
47
+ # inject into SearchHistory and SavedSearches so mlt queries display properly
48
+ SearchHistoryController.send(:helper, CommonwealthVlrEngine::RenderConstraintsOverride) unless
49
+ SearchHistoryController.helpers.is_a?(CommonwealthVlrEngine::RenderConstraintsOverride)
50
+ SavedSearchesController.send(:helper, CommonwealthVlrEngine::RenderConstraintsOverride) unless
51
+ SavedSearchesController.helpers.is_a?(CommonwealthVlrEngine::RenderConstraintsOverride)
52
+ end
53
+
54
+ end
55
+
@@ -0,0 +1,66 @@
1
+ module CommonwealthVlrEngine
2
+ module CommonwealthSearchBuilder
3
+
4
+ # keep file assets from appearing in search results
5
+ def exclude_unwanted_models(solr_parameters = {})
6
+ solr_parameters[:fq] ||= []
7
+ solr_parameters[:fq] << '-has_model_ssim:"info:fedora/afmodel:Bplmodels_File"'
8
+ end
9
+
10
+ # keep draft/review and in-process items from appearing in search results
11
+ def exclude_unpublished_items(solr_parameters = {})
12
+ solr_parameters[:fq] ||= []
13
+ solr_parameters[:fq] << '-workflow_state_ssi:"draft"'
14
+ solr_parameters[:fq] << '-workflow_state_ssi:"needs_review"'
15
+ solr_parameters[:fq] << '-processing_state_ssi:"derivatives"'
16
+ # can't implement below until all records have this field
17
+ # solr_parameters[:fq] << '+workflow_state_ssi:"published"'
18
+ # solr_parameters[:fq] << '+processing_state_ssi:"complete"'
19
+ end
20
+
21
+ # keep Institution objects out of the search results
22
+ def exclude_institutions(solr_parameters = {})
23
+ solr_parameters[:fq] ||= []
24
+ solr_parameters[:fq] << '-active_fedora_model_suffix_ssi:"Institution"'
25
+ end
26
+
27
+ # don't return flagged items (for series images on collections#show)
28
+ def flagged_filter(solr_parameters = {})
29
+ solr_parameters[:fq] ||= []
30
+ solr_parameters[:fq] << "-#{blacklight_config.flagged_field}:[* TO *]"
31
+ end
32
+
33
+ # used by InstitutionsController#index
34
+ def institutions_filter(solr_parameters = {})
35
+ solr_parameters[:fq] ||= []
36
+ solr_parameters[:fq] << "+active_fedora_model_suffix_ssi:\"Institution\""
37
+ end
38
+
39
+ # for 'more like this' search -- set solr id param to params[:mlt_id]
40
+ def set_solr_id_for_mlt(solr_parameters = {})
41
+ solr_parameters[:id] = blacklight_params[:mlt_id]
42
+ end
43
+
44
+ # used by CollectionsController#index
45
+ def collections_filter(solr_parameters = {})
46
+ solr_parameters[:fq] ||= []
47
+ solr_parameters[:fq] << "+active_fedora_model_suffix_ssi:\"Collection\""
48
+ end
49
+
50
+ # keep Volume objects out of the search results
51
+ def exclude_volumes(solr_parameters = {})
52
+ solr_parameters[:fq] ||= []
53
+ solr_parameters[:fq] << '-active_fedora_model_suffix_ssi:"Volume"'
54
+ end
55
+
56
+ # set params for ocr field searching
57
+ def ocr_search_params(solr_parameters = {})
58
+ solr_parameters[:facet] = false
59
+ solr_parameters[:hl] = true
60
+ solr_parameters[:'hl.fl'] = blacklight_config.ocr_search_field
61
+ solr_parameters[:'hl.fragsize'] = 135
62
+ solr_parameters[:'hl.snippets'] = 10
63
+ end
64
+
65
+ end
66
+ end
@@ -0,0 +1,69 @@
1
+ # -*- encoding : utf-8 -*-
2
+ #
3
+ # Filters added to this controller apply to all controllers in the hosting application
4
+ # as this module is mixed-in to the application controller in the hosting app on installation.
5
+ module CommonwealthVlrEngine
6
+ module Controller
7
+
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+
12
+ after_filter :store_location
13
+
14
+ # extra head content
15
+ helper_method :create_img_sequence
16
+
17
+ end
18
+
19
+ # redirect after login to previous non-login page
20
+ # TODO figure out why it doesn't work for Polaris or Facebook logins
21
+ def store_location
22
+ # store last url - this is needed for post-login redirect to whatever the user last visited.
23
+ if (request.path != "/users/sign_in" &&
24
+ request.path != "/users/sign_up" &&
25
+ request.path != "/users/password" &&
26
+ request.path != "/users/password/new" &&
27
+ request.path != "/users/password/edit" &&
28
+ request.path != "/users/confirmation" &&
29
+ request.path != "/users/sign_out" &&
30
+ !request.fullpath.match(/\/users\/auth\//) &&
31
+ !request.xhr?) # don't store ajax calls
32
+ session[:previous_url] = request.fullpath
33
+ end
34
+ end
35
+
36
+ def after_sign_in_path_for(resource)
37
+ session[:previous_url] || root_path
38
+ end
39
+
40
+ def create_img_sequence(image_files, current_img_pid)
41
+ page_sequence = {}
42
+ page_sequence[:current] = current_img_pid
43
+ page_sequence[:index] = image_files.index(current_img_pid) + 1
44
+ page_sequence[:total] = image_files.length
45
+ page_sequence[:prev] = page_sequence[:index]-2 > -1 ? image_files[page_sequence[:index]-2] : nil
46
+ page_sequence[:next] = image_files[page_sequence[:index]].presence
47
+ page_sequence
48
+ end
49
+
50
+ # override of Blacklight::Controller#search_action_path
51
+ # for proper constraints linking in collections#index and institutions#index
52
+ def search_action_path *args
53
+ if args.first.is_a? Hash
54
+ args.first[:only_path] = true
55
+ # Rails 4.2 deprecated url helpers accepting string keys for 'controller' or 'action'
56
+ args[0] = args.first.except(:controller, :action)
57
+ end
58
+
59
+ if params[:controller] == 'institutions' && params[:action] == 'index'
60
+ institutions_url *args
61
+ elsif params[:controller] == 'collections' && (params[:action] == 'index' || params[:action] == 'facet')
62
+ collections_url *args
63
+ else
64
+ search_action_url *args
65
+ end
66
+ end
67
+
68
+ end
69
+ end
@@ -0,0 +1,238 @@
1
+ module CommonwealthVlrEngine
2
+ module ControllerOverride
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+
7
+ # adds behavior for retrieving files for an object
8
+ self.send(:include, CommonwealthVlrEngine::Finder)
9
+
10
+ if self.respond_to? :search_params_logic
11
+ search_params_logic.concat [:exclude_unwanted_models, :exclude_unpublished_items, :exclude_institutions, :exclude_volumes]
12
+ end
13
+
14
+ if self.blacklight_config.search_builder_class
15
+ self.blacklight_config.search_builder_class.send(:include,
16
+ CommonwealthVlrEngine::CommonwealthSearchBuilder
17
+ ) unless
18
+ self.blacklight_config.search_builder_class.include?(
19
+ CommonwealthVlrEngine::CommonwealthSearchBuilder
20
+ )
21
+ end
22
+
23
+ before_filter :get_object_files, :only => [:show]
24
+ before_filter :set_nav_context, :only => [:index]
25
+ before_filter :mlt_search, :only => [:index]
26
+ before_filter :add_institution_fields, :only => [:index, :facet]
27
+
28
+ helper_method :has_volumes?
29
+
30
+ # all the commonwealth-vlr-engine CatalogController config stuff goes here
31
+ configure_blacklight do |config|
32
+
33
+ #set default per-page
34
+ config.default_per_page = 20
35
+
36
+ #blacklight-gallery stuff
37
+ config.view.gallery.default = true
38
+ config.view.gallery.partials = [:index_header]
39
+ config.view.gallery.icon_class = 'glyphicon-th-large'
40
+ config.view.masonry.partials = [:index_header]
41
+ config.view.slideshow.partials = [:index]
42
+
43
+ # blacklight-maps stuff
44
+ config.view.maps.geojson_field = 'subject_geojson_facet_ssim'
45
+ config.view.maps.coordinates_field = 'subject_coordinates_geospatial'
46
+ config.view.maps.placename_field = 'subject_geographic_ssim'
47
+ config.view.maps.maxzoom = 13
48
+ config.view.maps.show_initial_zoom = 9
49
+ config.view.maps.facet_mode = 'geojson'
50
+
51
+ # helper that returns thumbnail URLs
52
+ config.index.thumbnail_method = :create_thumb_img_element
53
+
54
+ # configuration for search results/index views
55
+ config.index.partials = [:thumbnail, :index_header, :index]
56
+ config.index.document_actions = nil # don't show bookmark control
57
+
58
+ # solr field configuration for document/show views
59
+ config.show.title_field = 'title_info_primary_tsi'
60
+ config.show.display_type_field = 'active_fedora_model_suffix_ssi'
61
+
62
+ # solr field for flagged/inappropriate content
63
+ config.flagged_field = 'flagged_content_ssi'
64
+
65
+ # advanced search facet limits
66
+ config.advanced_search = {
67
+ :qt => 'search',
68
+ :form_solr_parameters => {
69
+ 'facet.field' => ['genre_basic_ssim', 'collection_name_ssim'],
70
+ 'facet.limit' => -1, # return all facet values
71
+ 'facet.sort' => 'index' # sort by byte order of values
72
+ }
73
+ }
74
+
75
+ # collection name field
76
+ config.collection_field = 'collection_name_ssim'
77
+ # institution name field
78
+ config.institution_field = 'institution_name_ssim'
79
+
80
+ # book stuff
81
+ config.ocr_search_field = 'ocr_tsiv'
82
+ config.page_num_field = 'page_num_label_ssi'
83
+
84
+ config.default_solr_params = {:qt => 'search', :rows => 20}
85
+
86
+ # solr field configuration for search results/index views
87
+ config.index.title_field = 'title_info_primary_tsi'
88
+ config.index.display_type_field = 'active_fedora_model_suffix_ssi'
89
+
90
+ # solr fields that will be treated as facets by the blacklight application
91
+ config.add_facet_field 'subject_facet_ssim', :label => 'Topic', :limit => 8, :sort => 'count', :collapse => false
92
+ config.add_facet_field 'subject_geographic_ssim', :label => 'Place', :limit => 8, :sort => 'count', :collapse => false
93
+ config.add_facet_field 'date_facet_ssim', :label => 'Date', :limit => 8, :sort => 'index', :collapse => false
94
+ config.add_facet_field 'genre_basic_ssim', :label => 'Format', :limit => 8, :sort => 'count', :helper_method => :render_format, :collapse => false
95
+ config.add_facet_field 'collection_name_ssim', :label => 'Collection', :limit => 8, :sort => 'count', :collapse => false
96
+ # link_to_facet fields (not in facets sidebar of search results)
97
+ config.add_facet_field 'related_item_host_ssim', :label => 'Collection', :include_in_request => false # Collection (local)
98
+ config.add_facet_field 'genre_specific_ssim', :label => 'Genre', :include_in_request => false
99
+ config.add_facet_field 'related_item_series_ssim', :label => 'Series', :limit => 300, :sort => 'index', :include_in_request => false
100
+ config.add_facet_field 'related_item_subseries_ssim', :label => 'Subseries', :include_in_request => false
101
+ config.add_facet_field 'related_item_subsubseries_ssim', :label => 'Sub-subseries', :include_in_request => false
102
+ config.add_facet_field 'institution_name_ssim', :label => 'Institution', :include_in_request => false
103
+ config.add_facet_field 'name_facet_ssim', :label => 'Name', :include_in_request => false
104
+ # facet for blacklight-maps catalog#index map view
105
+ # have to use '-2' to get all values
106
+ # because Blacklight::RequestBuilders#solr_facet_params adds '+1' to value
107
+ config.add_facet_field 'subject_geojson_facet_ssim', :limit => -2, :label => 'Coordinates', :show => false
108
+
109
+ # solr fields to be displayed in the index (search results) view
110
+ config.add_index_field 'genre_basic_ssim', :label => 'Format', :helper_method => :render_format_index
111
+ config.add_index_field 'collection_name_ssim', :label => 'Collection', :helper_method => :index_collection_link
112
+ config.add_index_field 'date_start_tsim', :label => 'Date', :helper_method => :index_date_value
113
+
114
+ # "fielded" search configuration. Used by pulldown among other places.
115
+ config.add_search_field('all_fields') do |field|
116
+ field.label = 'All Fields'
117
+ field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
118
+ end
119
+
120
+ config.add_search_field('title') do |field|
121
+ field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
122
+ field.solr_local_parameters = {
123
+ :qf => '$title_qf',
124
+ :pf => '$title_pf'
125
+ }
126
+ end
127
+
128
+ config.add_search_field('subject') do |field|
129
+ field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
130
+ field.qt = 'search'
131
+ field.solr_local_parameters = {
132
+ :qf => '$subject_qf',
133
+ :pf => '$subject_pf'
134
+ }
135
+ end
136
+
137
+ config.add_search_field('place') do |field|
138
+ field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
139
+ field.solr_local_parameters = {
140
+ :qf => '$place_qf',
141
+ :pf => '$place_pf'
142
+ }
143
+ end
144
+
145
+ config.add_search_field('creator') do |field|
146
+ field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
147
+ field.solr_local_parameters = {
148
+ :qf => '$author_qf',
149
+ :pf => '$author_pf'
150
+ }
151
+ end
152
+
153
+ # "sort results by" select (pulldown)
154
+ config.add_sort_field 'score desc, title_info_primary_ssort asc', :label => 'relevance'
155
+ config.add_sort_field 'title_info_primary_ssort asc, date_start_dtsi asc', :label => 'title'
156
+ config.add_sort_field 'date_start_dtsi asc, title_info_primary_ssort asc', :label => 'date (asc)'
157
+ config.add_sort_field 'date_start_dtsi desc, title_info_primary_ssort asc', :label => 'date (desc)'
158
+
159
+ end
160
+
161
+ # displays the MODS XML record. copied from blacklight-marc 'librarian_view'
162
+ # for some reason won't work if not in the 'included' block
163
+ def metadata_view
164
+ @response, @document = fetch(params[:id])
165
+
166
+ respond_to do |format|
167
+ format.html
168
+ format.js { render :layout => false }
169
+ end
170
+ end
171
+
172
+ # modify facet settings for Collections#show and Institutions#show
173
+ def relation_base_blacklight_config
174
+ # don't show collection facet
175
+ blacklight_config.facet_fields['collection_name_ssim'].show = false
176
+ blacklight_config.facet_fields['collection_name_ssim'].if = false
177
+ # collapse remaining facets
178
+ blacklight_config.facet_fields['subject_facet_ssim'].collapse = true
179
+ blacklight_config.facet_fields['subject_geographic_ssim'].collapse = true
180
+ blacklight_config.facet_fields['date_facet_ssim'].collapse = true
181
+ blacklight_config.facet_fields['genre_basic_ssim'].collapse = true
182
+ end
183
+
184
+ end
185
+
186
+ # displays values and pagination links for Format field
187
+ def formats_facet
188
+ @nav_li_active = 'explore'
189
+
190
+ @facet = blacklight_config.facet_fields['genre_basic_ssim']
191
+ @response = get_facet_field_response(@facet.key, params)
192
+ @display_facet = @response.aggregations[@facet.key]
193
+
194
+ @pagination = facet_paginator(@facet, @display_facet)
195
+
196
+ render :facet
197
+ end
198
+
199
+ # if this is 'more like this' search, solr id = params[:mlt_id]
200
+ def mlt_search
201
+ if params[:mlt_id]
202
+ CatalogController.search_params_logic += [:set_solr_id_for_mlt] unless CatalogController.search_params_logic.include? :set_solr_id_for_mlt
203
+ end
204
+ end
205
+
206
+ # TODO: refactor how views access files/volumes/etc.
207
+ def get_object_files
208
+ @object_files = get_files(params[:id])
209
+ end
210
+
211
+ def set_nav_context
212
+ @nav_li_active = 'search'
213
+ end
214
+
215
+ # add institutions if configured
216
+ def add_institution_fields
217
+ if t('blacklight.home.browse.institutions.enabled')
218
+ blacklight_config.add_facet_field 'physical_location_ssim', :label => 'Institution', :limit => 8, :sort => 'count', :collapse => false
219
+ blacklight_config.add_index_field 'institution_name_ssim', :label => 'Institution', :helper_method => :index_institution_link
220
+ end
221
+ end
222
+
223
+ # TODO: refactor how views access files/volumes/etc.
224
+ # returns the child volumes for Book objects (if they exist)
225
+ # needs to be in this module because CommonwealthVlrEngine::Finder methods aren't accessible in helpers/views
226
+ def has_volumes?(document)
227
+ case document[blacklight_config.show.display_type_field.to_sym]
228
+ when 'Book'
229
+ volumes = get_volume_objects(document.id)
230
+ else
231
+ volumes = nil
232
+ end
233
+ volumes.presence
234
+ end
235
+
236
+ end
237
+
238
+ end