commonwealth-vlr-engine 0.0.1 → 0.0.2

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.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/app/assets/stylesheets/commonwealth-vlr-engine/advanced_search.scss +1 -1
  4. data/app/assets/stylesheets/commonwealth-vlr-engine/basic_search.scss +6 -1
  5. data/app/assets/stylesheets/commonwealth-vlr-engine/commonwealth-vlr-engine.css +1 -0
  6. data/app/assets/stylesheets/commonwealth-vlr-engine/folders.scss +1 -1
  7. data/app/assets/stylesheets/commonwealth-vlr-engine/header.scss +9 -0
  8. data/app/assets/stylesheets/commonwealth-vlr-engine/home.scss +9 -0
  9. data/app/assets/stylesheets/commonwealth-vlr-engine/twitter_typeahead.scss +9 -0
  10. data/app/controllers/blacklight_advanced_search/advanced_controller.rb +12 -48
  11. data/app/controllers/bookmarks_controller.rb +8 -8
  12. data/app/controllers/collections_controller.rb +10 -26
  13. data/app/controllers/folder_items_actions_controller.rb +2 -2
  14. data/app/controllers/folders_controller.rb +10 -6
  15. data/app/controllers/image_viewer_controller.rb +2 -2
  16. data/app/controllers/institutions_controller.rb +13 -12
  17. data/app/controllers/ocr_search_controller.rb +2 -8
  18. data/app/controllers/saved_searches_controller.rb +8 -0
  19. data/app/controllers/search_history_controller.rb +8 -0
  20. data/app/helpers/commonwealth_vlr_engine/application_helper.rb +37 -37
  21. data/app/helpers/commonwealth_vlr_engine/blacklight_helper.rb +3 -11
  22. data/app/helpers/commonwealth_vlr_engine/blacklight_url_helper.rb +1 -16
  23. data/app/helpers/commonwealth_vlr_engine/catalog_helper.rb +1 -1
  24. data/app/helpers/commonwealth_vlr_engine/collections_helper_behavior.rb +1 -1
  25. data/app/helpers/commonwealth_vlr_engine/institutions_helper_behavior.rb +2 -2
  26. data/app/helpers/commonwealth_vlr_engine/vlr_blacklight_maps_helper_behavior.rb +10 -6
  27. data/app/views/advanced/_advanced_search_fields.html.erb +2 -2
  28. data/app/views/advanced/_advanced_search_form.html.erb +2 -2
  29. data/app/views/advanced/index.html.erb +1 -1
  30. data/app/views/bookmarks/index.html.erb +1 -1
  31. data/app/views/catalog/_basic_search.html.erb +5 -3
  32. data/app/views/catalog/_constraints.html.erb +1 -1
  33. data/app/views/catalog/_facet_limit_series.html.erb +7 -5
  34. data/app/views/catalog/_index_gallery.html.erb +1 -3
  35. data/app/views/catalog/{_index_map_institutions.html.erb → _index_mapview_institutions.html.erb} +0 -0
  36. data/app/views/catalog/_search_form.html.erb +14 -4
  37. data/app/views/catalog/_show_partials/_show_default_metadata.html.erb +9 -0
  38. data/app/views/catalog/_show_partials/_show_flagged_notice.html.erb +1 -1
  39. data/app/views/catalog/_show_tools.html.erb +2 -2
  40. data/app/views/catalog/_zero_results.html.erb +1 -1
  41. data/app/views/collections/_search_form_collection.html.erb +1 -1
  42. data/app/views/collections/show.html.erb +1 -1
  43. data/app/views/feedback/complete.html.erb +1 -1
  44. data/app/views/institutions/_search_form_institution.html.erb +1 -1
  45. data/app/views/layouts/commonwealth-vlr-engine.html.erb +2 -2
  46. data/app/views/ocr_search/_search_form_ocr.html.erb +1 -1
  47. data/app/views/pages/home.html.erb +2 -1
  48. data/app/views/saved_searches/index.html.erb +4 -4
  49. data/app/views/search_history/index.html.erb +5 -5
  50. data/app/views/shared/_folder_item_actions.html.erb +1 -2
  51. data/app/views/shared/_footer.html.erb +1 -1
  52. data/app/views/shared/_header_navbar.html.erb +1 -1
  53. data/app/views/shared/_nav_links.html.erb +2 -2
  54. data/app/views/shared/_search_form_header.html.erb +9 -3
  55. data/app/views/shared/_sitelinks_search_box.html.erb +12 -0
  56. data/app/views/shared/_tools.html.erb +2 -2
  57. data/app/views/shared/_user_util_links.html.erb +2 -2
  58. data/app/views/users/show.html.erb +2 -2
  59. data/commonwealth-vlr-engine.gemspec +4 -4
  60. data/config/initializers/assets.rb +2 -0
  61. data/config/locales/commonwealth-vlr-engine.en.yml +4 -0
  62. data/config/routes.rb +1 -0
  63. data/lib/commonwealth-vlr-engine.rb +6 -16
  64. data/lib/commonwealth-vlr-engine/controller_override.rb +82 -47
  65. data/lib/commonwealth-vlr-engine/engine.rb +6 -4
  66. data/lib/commonwealth-vlr-engine/render_constraints_override.rb +3 -2
  67. data/lib/commonwealth-vlr-engine/search_builder/collections_search_builder.rb +14 -0
  68. data/lib/commonwealth-vlr-engine/{commonwealth_search_builder.rb → search_builder/commonwealth_search_builder_behavior.rb} +9 -2
  69. data/lib/commonwealth-vlr-engine/search_builder/flagged_search_builder.rb +14 -0
  70. data/lib/commonwealth-vlr-engine/search_builder/institutions_search_builder.rb +11 -0
  71. data/lib/commonwealth-vlr-engine/search_builder/mlt_search_builder.rb +15 -0
  72. data/lib/commonwealth-vlr-engine/search_builder/ocr_search_builder.rb +10 -0
  73. data/lib/commonwealth-vlr-engine/version.rb +1 -1
  74. data/lib/generators/commonwealth_vlr_engine/controller_generator.rb +1 -2
  75. data/lib/generators/commonwealth_vlr_engine/localassets_generator.rb +1 -1
  76. data/lib/generators/commonwealth_vlr_engine/model_generator.rb +3 -16
  77. data/lib/generators/commonwealth_vlr_engine/routes_generator.rb +8 -0
  78. data/lib/generators/commonwealth_vlr_engine/templates/commonwealth_search_builder.rb +17 -0
  79. data/lib/generators/commonwealth_vlr_engine/templates/{commonwealth_vlr_engine.css.scss → commonwealth_vlr_engine.scss} +0 -0
  80. data/spec/controllers/catalog_controller_spec.rb +20 -3
  81. data/spec/controllers/collections_controller_spec.rb +2 -2
  82. data/spec/controllers/folder_items_actions_controller_spec.rb +2 -2
  83. data/spec/controllers/institutions_controller_spec.rb +13 -0
  84. data/spec/controllers/ocr_search_controller_spec.rb +4 -0
  85. data/spec/features/more_like_this_search_spec.rb +1 -1
  86. data/spec/features/ocr_search/index_spec.rb +1 -1
  87. data/spec/helpers/institutions_helper_spec.rb +10 -5
  88. data/spec/lib/commonwealth-vlr-engine/search_builder/collections_search_builder_spec.rb +19 -0
  89. data/spec/lib/commonwealth-vlr-engine/search_builder/commonwealth_search_builder_behavior_spec.rb +116 -0
  90. data/spec/lib/commonwealth-vlr-engine/search_builder/flagged_search_builder_spec.rb +19 -0
  91. data/spec/lib/commonwealth-vlr-engine/search_builder/institutions_search_builder_spec.rb +19 -0
  92. data/spec/lib/commonwealth-vlr-engine/search_builder/mlt_search_builder_spec.rb +19 -0
  93. data/spec/lib/commonwealth-vlr-engine/search_builder/ocr_search_builder_spec.rb +19 -0
  94. data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -0
  95. data/tasks/vlr_engine.rake +1 -1
  96. metadata +38 -23
  97. data/app/views/bookmarks/_tools.html.erb +0 -25
  98. data/app/views/catalog/_index_list_default.html.erb +0 -13
  99. data/lib/commonwealth-vlr-engine/route_sets.rb +0 -49
  100. data/lib/commonwealth-vlr-engine/routes.rb +0 -21
  101. data/spec/lib/commonwealth-vlr-engine/commonwealth_search_builder_spec.rb +0 -101
  102. data/spec/lib/commonwealth-vlr-engine/controller_override_spec.rb +0 -41
@@ -20,14 +20,14 @@
20
20
  <% if @document.respond_to?( :to_email_text ) %>
21
21
  <li class="email">
22
22
  <%= link_to content_tag(:span, '', :class => 'glyphicon glyphicon-envelope') + ' ' + t('blacklight.tools.email'),
23
- email_catalog_path(:id => @document),
23
+ email_solr_document_path(:id => @document),
24
24
  {:id => 'emailLink', :data => {:ajax_modal => 'trigger'}} %>
25
25
  </li>
26
26
  <%- end -%>
27
27
  <%# if (@document.respond_to?(:export_as_mla_citation_txt) || @document.respond_to?(:export_as_apa_citation_txt)) %>
28
28
  <li class="cite">
29
29
  <%= link_to content_tag(:span, '', :class => 'glyphicon glyphicon-list-alt') + ' ' + t('blacklight.tools.citation'),
30
- citation_catalog_path(:id => @document),
30
+ citation_solr_document_path(:id => @document),
31
31
  {:id => 'citeLink', :data => {:ajax_modal => 'trigger'}} %>
32
32
  </li>
33
33
  <%# end %>
@@ -10,7 +10,7 @@
10
10
  <li><%= t 'blacklight.search.zero_results.search_fields', :search_fields => search_field_label(params) %> --
11
11
  <%= link_to t('blacklight.search.zero_results.search_everything',
12
12
  field: blacklight_config.default_search_field.label),
13
- url_for(params_for_search(:search_field=>blacklight_config.default_search_field.key)) %>
13
+ url_for(search_state.params_for_search(:search_field=>blacklight_config.default_search_field.key)) %>
14
14
  </li>
15
15
  <%- end %>
16
16
 
@@ -2,7 +2,7 @@
2
2
  <%= form_tag search_action_url,
3
3
  :method => :get,
4
4
  :class => 'search-query-form form-inline collection-search' do %>
5
- <%= render_hash_as_hidden_fields(params_for_search(:f => params[:f]).except('q', 'search_field', 'qt', 'page')) %>
5
+ <%= render_hash_as_hidden_fields(search_state.params_for_search(:f => params[:f]).except('q', 'search_field', 'qt', 'page')) %>
6
6
 
7
7
  <div class="input-group pull-left">
8
8
  <label for="q_coll" class="sr-only"><%= t('blacklight.search.form.collection') %></label>
@@ -82,7 +82,7 @@
82
82
  <% unless @response.aggregations[map_facet_field].items.empty? %>
83
83
  <div id="blacklight-collection-map-container">
84
84
  <h4><%= t('blacklight.collections.map.title') %></h4>
85
- <%= render :partial => 'catalog/index_map',
85
+ <%= render :partial => 'catalog/index_mapview',
86
86
  :locals => {:geojson_features => serialize_geojson(map_facet_values,
87
87
  'index')} %>
88
88
  </div>
@@ -4,6 +4,6 @@
4
4
  <h4><%= t('blacklight.feedback.complete.title') %></h4>
5
5
 
6
6
  <ul>
7
- <li><%= link_to t('blacklight.back_to_search'), catalog_index_path %></li>
7
+ <li><%= link_to t('blacklight.back_to_search'), search_catalog_path %></li>
8
8
  </ul>
9
9
  </div>
@@ -3,7 +3,7 @@
3
3
  :method => :get,
4
4
  :class => 'search-query-form form-inline institution-search' do %>
5
5
 
6
- <%= render_hash_as_hidden_fields(params_for_search(:f => params[:f]).except('q', 'search_field', 'qt', 'page')) %>
6
+ <%= render_hash_as_hidden_fields(search_state.params_for_search(:f => params[:f]).except('q', 'search_field', 'qt', 'page')) %>
7
7
 
8
8
  <div class="input-group pull-left">
9
9
  <label for="q_inst" class="sr-only"><%= t('blacklight.search.form.institution') %></label>
@@ -18,7 +18,7 @@
18
18
 
19
19
  <title><%= render_page_title %></title>
20
20
  <%= opensearch_description_tag application_name, opensearch_catalog_url(:format => 'xml') %>
21
- <%= favicon_link_tag 'favicon.ico' %>
21
+ <%= favicon_link_tag %>
22
22
  <%= favicon_link_tag 'dc_mobile-icons_60x60.png', :rel => 'apple-touch-icon', :type => 'image/png' %>
23
23
  <%= favicon_link_tag 'dc_mobile-icons_76x76.png', :rel => 'apple-touch-icon', :type => 'image/png', :sizes => '76x76' %>
24
24
  <%= favicon_link_tag 'dc_mobile-icons_120x120.png', :rel => 'apple-touch-icon', :type => 'image/png', :sizes => '120x120' %>
@@ -43,7 +43,7 @@
43
43
  <%= render :partial => 'shared/ajax_modal' %>
44
44
 
45
45
  <!-- /container -->
46
- <div id="main-container" class="container">
46
+ <div id="main-container" class="<%= container_classes %>">
47
47
 
48
48
  <%= content_tag :h1, application_name, class: 'sr-only application-heading' %>
49
49
 
@@ -3,7 +3,7 @@
3
3
  :method => :get,
4
4
  :class => 'ocr-search-form',
5
5
  :data => {:ajax_modal => 'preserve'} do %>
6
- <%= render_hash_as_hidden_fields(params_for_search(:id => params[:id]).except('q', 'ocr_q', 'search_field', 'qt', 'page')) %>
6
+ <%= render_hash_as_hidden_fields(search_state.params_for_search(:id => params[:id]).except('q', 'ocr_q', 'search_field', 'qt', 'page')) %>
7
7
 
8
8
  <div class="input-group pull-left">
9
9
  <label for="q_ocr" class="sr-only"><%= t('blacklight.ocr.search.form.q') %></label>
@@ -1,3 +1,4 @@
1
1
  <%# putting this in a partial so it can be called from catalog#index %>
2
2
  <%# when no search params present %>
3
- <%= render :partial => 'pages/_home_partials/home_content' %>
3
+ <%= render 'pages/_home_partials/home_content' %>
4
+ <%= render 'shared/sitelinks_search_box' %>
@@ -1,4 +1,4 @@
1
- <% @page_title = t('blacklight.saved_searches.title') + " - " + application_name %>
1
+ <% @page_title = t('blacklight.saved_searches.page_title', :application_name => application_name) %>
2
2
  <div class="col-sm-9" id="searches_content">
3
3
 
4
4
  <div id="breadcrumb">
@@ -32,7 +32,7 @@
32
32
  <%= t('blacklight.saved_searches.list_title') %>
33
33
  <small>
34
34
  [<%= link_to t('blacklight.saved_searches.clear.action_title'),
35
- clear_saved_searches_path,
35
+ blacklight.clear_saved_searches_path,
36
36
  :class => 'clear_all',
37
37
  :method => :delete,
38
38
  :data => { :confirm => t('blacklight.saved_searches.clear.action_confirm') } %>]
@@ -43,10 +43,10 @@
43
43
  <tr>
44
44
  <td><%= link_to_previous_search(search.query_params) %></td>
45
45
  <td><%# button_to content_tag(:i, '', :class => 'icon-remove'),
46
- forget_search_path(search.id) %>
46
+ blacklight.forget_search_path(search.id) %>
47
47
  <%= link_to(content_tag(:span, '',
48
48
  :class => 'glyphicon glyphicon-remove'),
49
- forget_search_path(search.id),
49
+ blacklight.forget_search_path(search.id),
50
50
  :class => 'delete_search',
51
51
  :method => 'post',
52
52
  :title => t('blacklight.saved_searches.delete'))
@@ -1,4 +1,4 @@
1
- <% @page_title = t('blacklight.search_history.title') + " - " + application_name %>
1
+ <% @page_title = t('blacklight.search_history.page_title', :application_name => application_name) %>
2
2
  <div class="col-sm-9" id="search_history_content">
3
3
  <%# sidebar_items << capture do %>
4
4
  <!-- <p><%# link_back_to_catalog %></p> -->
@@ -30,7 +30,7 @@
30
30
  <%=t('blacklight.search_history.recent')%>
31
31
  <small>
32
32
  [<%= link_to t('blacklight.search_history.clear.action_title'),
33
- clear_search_history_path,
33
+ blacklight.clear_search_history_path,
34
34
  :id => 'clear_search_history',
35
35
  :method => :delete,
36
36
  :data => { :confirm => t('blacklight.search_history.clear.action_confirm') } %>]
@@ -43,12 +43,12 @@
43
43
  <%- if has_user_authentication_provider? -%>
44
44
  <td class="actions">
45
45
  <%- if current_or_guest_user && search.saved? -%>
46
- <%# button_to t('blacklight.search_history.forget'), forget_search_path(search.id), :class => 'btn btn-default' %>
46
+ <%# button_to t('blacklight.search_history.forget'), blacklight.forget_search_path(search.id), :class => 'btn btn-default' %>
47
47
  <%= content_tag(:span, '', :class => 'glyphicon glyphicon-ok') %>
48
48
  In your <%= link_to t('blacklight.saved_searches.title'),
49
- saved_searches_path %>
49
+ blacklight.saved_searches_path %>
50
50
  <%- else -%>
51
- <%= button_to t('blacklight.search_history.save'), save_search_path(search.id), :method => :put, :class => 'btn btn-default' %>
51
+ <%= button_to t('blacklight.search_history.save'), blacklight.save_search_path(search.id), :method => :put, :class => 'btn btn-default' %>
52
52
  <%- end -%>
53
53
  </td>
54
54
  <%- end -%>
@@ -18,7 +18,6 @@
18
18
  <% end %>
19
19
 
20
20
  <% if current_user && !current_user.folders.empty? %>
21
- <% existing_folders = current_user.folders %>
22
21
  <div class="btn-group folder-item-control" id="copy_folder_item_control">
23
22
  <span class="btn btn-default dropdown-toggle" data-toggle="dropdown">
24
23
  <%= content_tag(:span, '', :class => 'glyphicon glyphicon-random') + ' ' + t('blacklight.tools.copy_to') %> <span class="caret"></span>
@@ -39,7 +38,7 @@
39
38
  <% end %>
40
39
  </li>
41
40
  <% end %>
42
- <% existing_folders.each do |folder| %>
41
+ <% current_user.folders.each do |folder| %>
43
42
  <% if @folder && folder.id == @folder.id %>
44
43
  <%# do nothing %>
45
44
  <% else %>
@@ -1,4 +1,4 @@
1
- <div id="footer" class="container">
1
+ <div id="footer" class="<%= container_classes %>">
2
2
  <div class="row">
3
3
  <div id="footer_logo" class="col-sm-3 hidden-xs">
4
4
  <%= link_to application_name, root_path, :id => 'footer_logo_link' %>
@@ -1,5 +1,5 @@
1
1
  <div id="header-navbar" class="navbar" role="navigation">
2
- <div class="container">
2
+ <div class="<%= container_classes %>">
3
3
  <div class="navbar-header">
4
4
  <button id="nav_collapse_button" type="button" class="navbar-toggle btn collapsed" data-toggle="collapse" data-target="#user-util-collapse">
5
5
  <span class="glyphicon glyphicon-search"></span>
@@ -1,9 +1,9 @@
1
1
  <% nav_links = {
2
2
  :search => {
3
3
  :basic => {:nav_link_title => t('blacklight.search.nav.basic'),
4
- :nav_link_path => catalog_index_path},
4
+ :nav_link_path => search_catalog_path},
5
5
  :advanced => {:nav_link_title => t('blacklight.search.nav.advanced'),
6
- :nav_link_path => advanced_search_path}
6
+ :nav_link_path => blacklight_advanced_search_engine.advanced_search_path}
7
7
  },
8
8
  :explore => {},
9
9
  :about => {
@@ -1,9 +1,15 @@
1
1
  <%= form_tag search_action_url, :method => :get, :class => 'header-search-form form-inline' do %>
2
- <%= render_hash_as_hidden_fields(params_for_search(:search_field => default_search_field[:key]).except('q', 'qt', 'page', 'utf8', 'f', 'sort', 'mlt_id', 'coordinates', 'spatial_search_type', 'view')) %>
2
+ <%= render_hash_as_hidden_fields(search_state.params_for_search(:search_field => default_search_field[:key]).except('q', 'qt', 'page', 'utf8', 'f', 'sort', 'mlt_id', 'coordinates', 'spatial_search_type', 'view')) %>
3
3
 
4
4
  <div class="input-group pull-left">
5
- <label for="q" class="sr-only"><%= t('blacklight.search.form.q') %></label>
6
- <%= text_field_tag :q, nil, :placeholder => t('blacklight.search.form.q'), :class => 'search_q q form-control input-sm', :id => 'q'%>
5
+ <label for="q" class="sr-only"><%= t('blacklight.search.form.search.label') %></label>
6
+ <%= text_field_tag :q,
7
+ nil,
8
+ placeholder: t('blacklight.search.form.search.placeholder'),
9
+ class: 'search_q q form-control input-sm',
10
+ id: 'q',
11
+ data: { autocomplete_enabled: autocomplete_enabled?,
12
+ autocomplete_path: blacklight.suggest_index_path } %>
7
13
  <span class="input-group-btn">
8
14
  <button type="submit" class="btn btn-primary search-btn btn-xs" id="search">
9
15
  <span class="submit-search-text"><%=t('blacklight.search.form.submit')%></span>
@@ -0,0 +1,12 @@
1
+ <script type="application/ld+json">
2
+ {
3
+ "@context": "http://schema.org",
4
+ "@type": "WebSite",
5
+ "url": "<%= root_url %>",
6
+ "potentialAction": {
7
+ "@type": "SearchAction",
8
+ "target": "<%= search_catalog_url %>?q={search_term_string}",
9
+ "query-input": "required name=search_term_string"
10
+ }
11
+ }
12
+ </script>
@@ -2,12 +2,12 @@
2
2
  <ul class="folderItemToolsList">
3
3
  <li class="cite">
4
4
  <%= link_to content_tag(:span, '', :class => 'glyphicon glyphicon-list-alt') + ' ' + t('blacklight.tools.citation'),
5
- citation_catalog_path(:id => ''),
5
+ citation_solr_documents_path(:id => ''),
6
6
  {:id => 'citeLink', :name => 'citation', :class => 'lightboxLink btn btn-default'} %>
7
7
  </li>
8
8
  <li class="email">
9
9
  <%= link_to content_tag(:span, '', :class => 'glyphicon glyphicon-envelope') + ' ' + t('blacklight.tools.email'),
10
- email_catalog_path(:id => ''),
10
+ email_solr_documents_path(:id => ''),
11
11
  :class => 'lightboxLink btn btn-default',
12
12
  :id => 'emailLink' %>
13
13
  </li>
@@ -10,8 +10,8 @@
10
10
  </button>
11
11
  <ul id="user-util-links-list" class="dropdown-menu">
12
12
  <li><%= link_to t('blacklight.header_links.folders'), folders_path %></li>
13
- <li><%= link_to t('blacklight.header_links.saved_searches'), saved_searches_path %></li>
14
- <li><%= link_to t('blacklight.header_links.search_history'), search_history_path %></li>
13
+ <li><%= link_to t('blacklight.header_links.saved_searches'), blacklight.saved_searches_path %></li>
14
+ <li><%= link_to t('blacklight.header_links.search_history'), blacklight.search_history_path %></li>
15
15
  <li><%= link_to t('devise.registrations.edit'), edit_user_registration_path %></li>
16
16
  <li><%= link_to t('blacklight.header_links.logout'), destroy_user_session_path %></li>
17
17
  </ul>
@@ -10,11 +10,11 @@
10
10
  <%= t('blacklight.folders.intro') %>
11
11
  </li>
12
12
  <li>
13
- <h4><%= link_to t('blacklight.header_links.saved_searches'), saved_searches_path %></h4>
13
+ <h4><%= link_to t('blacklight.header_links.saved_searches'), blacklight.saved_searches_path %></h4>
14
14
  <%= t('blacklight.saved_searches.intro') %>
15
15
  </li>
16
16
  <li>
17
- <h4><%= link_to t('blacklight.header_links.search_history'), search_history_path %></h4>
17
+ <h4><%= link_to t('blacklight.header_links.search_history'), blacklight.search_history_path %></h4>
18
18
  <%= t('blacklight.search_history.intro') %>
19
19
  </li>
20
20
  <li>
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ['lib']
19
19
 
20
20
  spec.add_dependency 'rails', '~>4.2.0'
21
- spec.add_dependency 'blacklight', '~>5.14.0'
22
- spec.add_dependency 'blacklight_advanced_search', '5.1.4'
23
- spec.add_dependency 'blacklight-gallery', '0.4.0'
24
- spec.add_dependency 'blacklight-maps', '0.4.0'
21
+ spec.add_dependency 'blacklight', '>= 6.1.0'
22
+ spec.add_dependency 'blacklight_advanced_search', '6.0.2'
23
+ spec.add_dependency 'blacklight-gallery', '0.5.0'
24
+ spec.add_dependency 'blacklight-maps', '0.5.0'
25
25
  spec.add_dependency 'bootstrap-sass', '~> 3.0'
26
26
  spec.add_dependency 'font-awesome-sass', '4.1.0'
27
27
  spec.add_dependency 'bpluser'
@@ -0,0 +1,2 @@
1
+ #Rails.application.config.assets.paths << CommonwealthVlrEngine::Engine.root.join('app','assets','images')
2
+ #Rails.application.config.assets.paths << CommonwealthVlrEngine::Engine.root.join('app','assets','images','openseadragon')
@@ -191,6 +191,9 @@ en:
191
191
  success: 'All items removed.'
192
192
  failure: 'Items could not be removed. Please try again later.'
193
193
 
194
+ formats:
195
+ page_title: 'Formats - %{application_name}'
196
+
194
197
  footer:
195
198
  address: '123 Main Street, Anywhere, MA 01234'
196
199
 
@@ -281,6 +284,7 @@ en:
281
284
  note_date: 'Notes (date)'
282
285
  note_ownership: 'Notes (ownership)'
283
286
  note_performers: 'Performers'
287
+ note_physical: 'Notes (object)'
284
288
  note_reference: 'Notes (citation)'
285
289
  note_resp: 'Name on Item'
286
290
  publisher: 'Publisher'
@@ -1,6 +1,7 @@
1
1
  Rails.application.routes.draw do
2
2
 
3
3
  mount Bpluser::Engine => '/bpluser'
4
+ mount BlacklightAdvancedSearch::Engine => '/'
4
5
 
5
6
  # alias for map browse
6
7
  get 'places', :to => 'catalog#map', :as => 'places_facet'
@@ -4,12 +4,15 @@ require 'commonwealth-vlr-engine/version'
4
4
  module CommonwealthVlrEngine
5
5
 
6
6
  require 'commonwealth-vlr-engine/controller_override'
7
- require 'commonwealth-vlr-engine/commonwealth_search_builder'
7
+ require 'commonwealth-vlr-engine/search_builder/commonwealth_search_builder_behavior'
8
+ require 'commonwealth-vlr-engine/search_builder/institutions_search_builder'
9
+ require 'commonwealth-vlr-engine/search_builder/collections_search_builder'
10
+ require 'commonwealth-vlr-engine/search_builder/flagged_search_builder'
11
+ require 'commonwealth-vlr-engine/search_builder/ocr_search_builder'
12
+ require 'commonwealth-vlr-engine/search_builder/mlt_search_builder'
8
13
  require 'commonwealth-vlr-engine/controller'
9
14
  require 'commonwealth-vlr-engine/render_constraints_override'
10
15
  require 'commonwealth-vlr-engine/pages'
11
- require 'commonwealth-vlr-engine/routes'
12
- require 'commonwealth-vlr-engine/route_sets'
13
16
  require 'commonwealth-vlr-engine/finder'
14
17
  require 'commonwealth-vlr-engine/notifier'
15
18
  require 'commonwealth-vlr-engine/iiif_manifest'
@@ -38,18 +41,5 @@ module CommonwealthVlrEngine
38
41
  File.join(app_root, 'config', 'vlr.yml')
39
42
  end
40
43
 
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
44
  end
55
45
 
@@ -4,21 +4,15 @@ module CommonwealthVlrEngine
4
4
 
5
5
  included do
6
6
 
7
- # adds behavior for retrieving files for an object
8
7
  self.send(:include, CommonwealthVlrEngine::Finder)
8
+ self.send(:include, CommonwealthVlrEngine::RenderConstraintsOverride)
9
+ self.send(:helper, CommonwealthVlrEngine::RenderConstraintsOverride)
9
10
 
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
11
+ # add BlacklightAdvancedSearch
12
+ self.send(:include, BlacklightAdvancedSearch::Controller)
13
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
14
+ # add BlacklightMaps
15
+ self.send(:include, BlacklightMaps::ControllerOverride)
22
16
 
23
17
  before_filter :get_object_files, :only => [:show]
24
18
  before_filter :set_nav_context, :only => [:index]
@@ -62,10 +56,12 @@ module CommonwealthVlrEngine
62
56
  # solr field for flagged/inappropriate content
63
57
  config.flagged_field = 'flagged_content_ssi'
64
58
 
65
- # advanced search facet limits
59
+ # advanced search configuration
66
60
  config.advanced_search = {
67
- :qt => 'search',
68
- :form_solr_parameters => {
61
+ qt: 'search',
62
+ url_key: 'advanced',
63
+ query_parser: 'dismax',
64
+ form_solr_parameters: {
69
65
  'facet.field' => ['genre_basic_ssim', 'collection_name_ssim'],
70
66
  'facet.limit' => -1, # return all facet values
71
67
  'facet.sort' => 'index' # sort by byte order of values
@@ -88,28 +84,28 @@ module CommonwealthVlrEngine
88
84
  config.index.display_type_field = 'active_fedora_model_suffix_ssi'
89
85
 
90
86
  # 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
87
+ config.add_facet_field 'subject_facet_ssim', label: 'Topic', limit: 8, sort: 'count', collapse: false
88
+ config.add_facet_field 'subject_geographic_ssim', label: 'Place', limit: 8, sort: 'count', collapse: false
89
+ config.add_facet_field 'date_facet_ssim', label: 'Date', limit: 8, sort: 'index', collapse: false
90
+ config.add_facet_field 'genre_basic_ssim', label: 'Format', limit: 8, sort: 'count', helper_method: :render_format, collapse: false
91
+ config.add_facet_field 'collection_name_ssim', label: 'Collection', limit: 8, sort: 'count', collapse: false
96
92
  # 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
93
+ config.add_facet_field 'related_item_host_ssim', label: 'Collection', include_in_request: false # Collection (local)
94
+ config.add_facet_field 'genre_specific_ssim', label: 'Genre', include_in_request: false
95
+ config.add_facet_field 'related_item_series_ssim', label: 'Series', limit: 300, sort: 'index', include_in_request: false
96
+ config.add_facet_field 'related_item_subseries_ssim', label: 'Subseries', include_in_request: false
97
+ config.add_facet_field 'related_item_subsubseries_ssim', label: 'Sub-subseries', include_in_request: false
98
+ config.add_facet_field 'institution_name_ssim', label: 'Institution', include_in_request: false
99
+ config.add_facet_field 'name_facet_ssim', label: 'Name', include_in_request: false
104
100
  # facet for blacklight-maps catalog#index map view
105
101
  # have to use '-2' to get all values
106
102
  # 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
103
+ config.add_facet_field 'subject_geojson_facet_ssim', limit: -2, label: 'Coordinates', show: false
108
104
 
109
105
  # 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
106
+ config.add_index_field 'genre_basic_ssim', label: 'Format', helper_method: :render_format_index
107
+ config.add_index_field 'collection_name_ssim', label: 'Collection', helper_method: :index_collection_link
108
+ config.add_index_field 'date_start_tsim', label: 'Date', helper_method: :index_date_value
113
109
 
114
110
  # "fielded" search configuration. Used by pulldown among other places.
115
111
  config.add_search_field('all_fields') do |field|
@@ -120,8 +116,8 @@ module CommonwealthVlrEngine
120
116
  config.add_search_field('title') do |field|
121
117
  field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
122
118
  field.solr_local_parameters = {
123
- :qf => '$title_qf',
124
- :pf => '$title_pf'
119
+ qf: '$title_qf',
120
+ pf: '$title_pf'
125
121
  }
126
122
  end
127
123
 
@@ -129,32 +125,32 @@ module CommonwealthVlrEngine
129
125
  field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
130
126
  field.qt = 'search'
131
127
  field.solr_local_parameters = {
132
- :qf => '$subject_qf',
133
- :pf => '$subject_pf'
128
+ qf: '$subject_qf',
129
+ pf: '$subject_pf'
134
130
  }
135
131
  end
136
132
 
137
133
  config.add_search_field('place') do |field|
138
134
  field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
139
135
  field.solr_local_parameters = {
140
- :qf => '$place_qf',
141
- :pf => '$place_pf'
136
+ qf: '$place_qf',
137
+ pf: '$place_pf'
142
138
  }
143
139
  end
144
140
 
145
141
  config.add_search_field('creator') do |field|
146
142
  field.solr_parameters = { :'spellcheck.dictionary' => 'default' }
147
143
  field.solr_local_parameters = {
148
- :qf => '$author_qf',
149
- :pf => '$author_pf'
144
+ qf: '$author_qf',
145
+ pf: '$author_pf'
150
146
  }
151
147
  end
152
148
 
153
149
  # "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)'
150
+ config.add_sort_field 'score desc, title_info_primary_ssort asc', label: 'relevance'
151
+ config.add_sort_field 'title_info_primary_ssort asc, date_start_dtsi asc', label: 'title'
152
+ config.add_sort_field 'date_start_dtsi asc, title_info_primary_ssort asc', label: 'date (asc)'
153
+ config.add_sort_field 'date_start_dtsi desc, title_info_primary_ssort asc', label: 'date (desc)'
158
154
 
159
155
  end
160
156
 
@@ -186,11 +182,11 @@ module CommonwealthVlrEngine
186
182
  # displays values and pagination links for Format field
187
183
  def formats_facet
188
184
  @nav_li_active = 'explore'
185
+ @page_title = t('blacklight.formats.page_title', :application_name => t('blacklight.application_name'))
189
186
 
190
187
  @facet = blacklight_config.facet_fields['genre_basic_ssim']
191
188
  @response = get_facet_field_response(@facet.key, params)
192
189
  @display_facet = @response.aggregations[@facet.key]
193
-
194
190
  @pagination = facet_paginator(@facet, @display_facet)
195
191
 
196
192
  render :facet
@@ -199,7 +195,7 @@ module CommonwealthVlrEngine
199
195
  # if this is 'more like this' search, solr id = params[:mlt_id]
200
196
  def mlt_search
201
197
  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
198
+ blacklight_config.search_builder_class = CommonwealthMltSearchBuilder
203
199
  end
204
200
  end
205
201
 
@@ -215,8 +211,8 @@ module CommonwealthVlrEngine
215
211
  # add institutions if configured
216
212
  def add_institution_fields
217
213
  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
214
+ blacklight_config.add_facet_field 'physical_location_ssim', label: 'Institution', limit: 8, sort: 'count', collapse: false
215
+ blacklight_config.add_index_field 'institution_name_ssim', label: 'Institution', helper_method: :index_institution_link
220
216
  end
221
217
  end
222
218
 
@@ -233,6 +229,45 @@ module CommonwealthVlrEngine
233
229
  volumes.presence
234
230
  end
235
231
 
232
+ protected
233
+ ##
234
+ # When a user logs in, transfer any saved searches or bookmarks to the current_user
235
+ def transfer_guest_user_actions_to_current_user
236
+ return unless respond_to? :current_user and respond_to? :guest_user and current_user and guest_user
237
+ current_user_searches = current_user.searches.pluck(:query_params)
238
+ current_user_bookmarks = current_user.bookmarks.pluck(:document_id)
239
+
240
+ guest_user.searches.reject { |s| current_user_searches.include?(s.query_params)}.each do |s|
241
+ current_user.searches << s
242
+ s.save!
243
+ end
244
+
245
+ guest_user.bookmarks.reject { |b| current_user_bookmarks.include?(b.document_id)}.each do |b|
246
+ current_user.bookmarks << b
247
+ b.save!
248
+ end
249
+
250
+ #Custom code to transfer over folders
251
+ guest_user.folders.each do |folder|
252
+ target_folder = current_user.folders.where(:title=>folder.title)
253
+ if target_folder.blank?
254
+ target_folder = current_user.folders.create({title: folder.title, description: folder.description, visibility: folder.visibility})
255
+ target_folder.save!
256
+ else
257
+ target_folder = target_folder.first
258
+ end
259
+ folder.folder_items.each do |item_to_add|
260
+ unless target_folder.has_folder_item(item_to_add.document_id)
261
+ target_folder.folder_items.create(:document_id => item_to_add.document_id) and target_folder.touch
262
+ target_folder.save!
263
+ end
264
+ end
265
+ end
266
+
267
+ # let guest_user know we've moved some bookmarks from under it
268
+ guest_user.reload if guest_user.persisted?
269
+ end
270
+
236
271
  end
237
272
 
238
273
  end