commonwealth-vlr-engine 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81eafc50bc934b62d575ff630c9fbbe9fb60afe0
4
- data.tar.gz: 44961a50c7a222659f8463137265e6f2151ac22b
3
+ metadata.gz: fbc356706414c0b95805533c2ea00a3a7effe6ce
4
+ data.tar.gz: 11c89f4dcc69806d61f9ede8d50f9b96cf165662
5
5
  SHA512:
6
- metadata.gz: b0437c422051c52e463d8770a796691926dd14b6bc14eea75402d268b06d2a782b7bbedb44489e936e8e144e696d5bed21cf9dd853fbd5d9bca64b053957976b
7
- data.tar.gz: af8acb84d0073a49f1a0b07616867f36bad415b2f1b1dc5a1bca4fae35f7d27ce3a86a774b907740200259d3a624868eaa2dcc9794ad6fb0d893bcbe769544b4
6
+ metadata.gz: 782bfa9e350b5564b73eef9318cd52928f11e29a4ef0cb95ca7571fc3a378a540223773a40a2a040109926ead37a2804aa0d7603515487d7e013670d60648da9
7
+ data.tar.gz: 56e045a323e114dc8c2521c3be14369729a0b00c70cd12571ac308db7758b7794be4ff256fbf72ff09db9517e20d9383658472be3f8e7cb9ed35502bb54b0539
data/README.md CHANGED
@@ -36,3 +36,11 @@ $ rails generate commonwealth_vlr_engine:install
36
36
  $ rake db:migrate
37
37
  ```
38
38
  You will then need to configure various YAML files to point to existing Solr, Fedora, and IIIF image servers.
39
+
40
+ ## Blacklight Version Compatibility
41
+ The table below indicates which versions of Commonwealth-VLR-Engine are compatible with which versions of Blacklight.
42
+
43
+ VLR-Engine version | works with Blacklight version
44
+ ----------------------- | ---------------------
45
+ 0.0.2 | >= 6.1.0
46
+ 0.0.1 | >= 5.14.0 to < 6.*
@@ -82,7 +82,7 @@
82
82
  font-size: 12px;
83
83
 
84
84
  .facet-label {
85
- text-indent: -20px;
85
+ text-indent: -5px;
86
86
  padding-bottom: 4px;
87
87
  }
88
88
 
@@ -5,9 +5,14 @@
5
5
 
6
6
  #basic_search_form {
7
7
 
8
+ .twitter-typeahead {
9
+ width: 45%;
10
+ margin-right: 4px;
11
+ }
12
+
8
13
  #q_basic {
9
14
  @include box-shadow(0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05));
10
- width: 45%;
15
+ width: 100%;
11
16
  }
12
17
 
13
18
  #basic_search_indexes {
@@ -29,4 +29,5 @@
29
29
  @import 'searches';
30
30
  @import 'show';
31
31
  @import 'signin';
32
+ @import 'twitter_typeahead';
32
33
  @import 'users';
@@ -231,7 +231,7 @@ div.folder_show_container {
231
231
  }
232
232
 
233
233
  .document-title-heading {
234
- width: 93%;
234
+ width: 90%;
235
235
  padding-left: 5px;
236
236
  }
237
237
 
@@ -84,6 +84,15 @@
84
84
  display: none;
85
85
  }
86
86
 
87
+ .tt-menu {
88
+ min-width: 120px;
89
+
90
+ .tt-suggestion {
91
+ font-size: 12px;
92
+ }
93
+
94
+ }
95
+
87
96
  }
88
97
 
89
98
  }
@@ -50,6 +50,15 @@ body.blacklight-home {
50
50
  margin-right: 3px;
51
51
  }
52
52
 
53
+ .twitter-typeahead {
54
+
55
+ input {
56
+ border-bottom-left-radius: 3px;
57
+ border-top-left-radius: 3px;
58
+ }
59
+
60
+ }
61
+
53
62
  }
54
63
 
55
64
  }
@@ -0,0 +1,9 @@
1
+ /* site-wide typeahead styles for search forms */
2
+
3
+ .twitter-typeahead {
4
+
5
+ .tt-cursor {
6
+ background-color: $light_gray;
7
+ }
8
+
9
+ }
@@ -1,14 +1,6 @@
1
1
  # Need to sub-class CatalogController so we get all other plugins behavior
2
2
  # for our own "inside a search context" lookup of facets.
3
3
  class BlacklightAdvancedSearch::AdvancedController < CatalogController
4
- include AdvancedHelper # so we get the #advanced_search_context method
5
-
6
- # Blacklight uses #search_action_url to figure out the right URL for
7
- # the global search box
8
- def search_action_url options = {}
9
- catalog_index_url(options.except(:controller, :action))
10
- end
11
- helper_method :search_action_url
12
4
 
13
5
  def index
14
6
  @nav_li_active = 'search'
@@ -18,49 +10,21 @@ class BlacklightAdvancedSearch::AdvancedController < CatalogController
18
10
  end
19
11
 
20
12
  protected
21
- def get_advanced_search_facets
22
-
23
- search_context_params = {}
24
- if (advanced_search_context.length > 0 )
25
- # We have a search context, need to fetch facets from within
26
- # that context -- but we dont' want to search within any
27
- # existing :q or ADVANCED facets, so we remove those params.
28
- adv_keys = blacklight_config.search_fields.keys.map {|k| k.to_sym}
29
- trimmed_params = params.except *adv_keys
30
- trimmed_params.delete(:f_inclusive) # adv facets
31
13
 
32
- search_context_params = solr_search_params(trimmed_params)
33
-
34
- # Don't want to include the 'q' from basic search in our search
35
- # context. Kind of hacky becuase solr_search_params insists on
36
- # using controller.params, not letting us over-ride.
37
- search_context_params.delete(:q)
38
- search_context_params.delete("q")
14
+ # Override to use the engine routes
15
+ def search_action_url options = {}
16
+ blacklight_advanced_search_engine.url_for(options.merge(action: 'index'))
17
+ end
39
18
 
40
- # Also delete any facet-related params, or anything else
41
- # we want to set ourselves
42
- search_context_params.delete_if do |k, v|
43
- k = k.to_s
44
- (["facet.limit", "facet.sort", "f", "facets", "facet.fields", "per_page"].include?(k) ||
45
- k =~ /f\..+\.facet\.limit/ ||
46
- k =~ /f\..+\.facet\.sort/
47
- )
48
- end
19
+ def get_advanced_search_facets
20
+ # We want to find the facets available for the current search, but:
21
+ # * IGNORING current query (add in facets_for_advanced_search_form filter)
22
+ # * IGNORING current advanced search facets (remove add_advanced_search_to_solr filter)
23
+ response, _ = search_results(params) do |search_builder|
24
+ search_builder.except(:add_advanced_search_to_solr).append(:facets_for_advanced_search_form)
49
25
  end
50
26
 
51
- input = HashWithIndifferentAccess.new
52
- input.merge!( search_context_params )
53
-
54
- input[:per_page] = 0 # force
55
-
56
- # force if set
57
- input[:qt] = blacklight_config.advanced_search[:qt] if blacklight_config.advanced_search[:qt]
58
-
59
- input.merge!( blacklight_config.advanced_search[:form_solr_parameters] ) if blacklight_config.advanced_search[:form_solr_parameters]
60
-
61
- # ensure empty query is all records, to fetch available facets on entire corpus
62
- input[:q] ||= '{!lucene}*:*'
63
-
64
- repository.search(input)
27
+ return response
65
28
  end
29
+
66
30
  end
@@ -1,15 +1,15 @@
1
- # -*- encoding : utf-8 -*-
1
+ # frozen_string_literal: true
2
2
  class BookmarksController < CatalogController
3
3
 
4
4
  include Blacklight::Bookmarks
5
5
 
6
6
  # LOCAL OVERRIDE to render update.js.erb partial when bookmark created
7
7
  def create
8
- if params[:bookmarks]
9
- @bookmarks = params[:bookmarks]
10
- else
11
- @bookmarks = [{ document_id: params[:id], document_type: blacklight_config.document_model.to_s }]
12
- end
8
+ @bookmarks = if params[:bookmarks]
9
+ params[:bookmarks]
10
+ else
11
+ [{ document_id: params[:id], document_type: blacklight_config.document_model.to_s }]
12
+ end
13
13
 
14
14
  current_or_guest_user.save! unless current_or_guest_user.persisted?
15
15
 
@@ -21,9 +21,9 @@ class BookmarksController < CatalogController
21
21
  # success ? render(json: { bookmarks: { count: current_or_guest_user.bookmarks.count }}) : render(:text => "", :status => "500")
22
22
  success ? render(:update) : render(:text => "", :status => "500")
23
23
  else
24
- if @bookmarks.length > 0 && success
24
+ if @bookmarks.any? && success
25
25
  flash[:notice] = I18n.t('blacklight.bookmarks.add.success', :count => @bookmarks.length)
26
- elsif @bookmarks.length > 0
26
+ elsif @bookmarks.any?
27
27
  flash[:error] = I18n.t('blacklight.bookmarks.add.failure', :count => @bookmarks.length)
28
28
  end
29
29
 
@@ -1,7 +1,7 @@
1
1
  class CollectionsController < CatalogController
2
2
 
3
3
  ##
4
- # Give Bookmarks access to the CatalogController configuration
4
+ # Give CollectionsController access to the CatalogController configuration
5
5
  include Blacklight::Configurable
6
6
  include Blacklight::SearchHelper
7
7
 
@@ -16,13 +16,13 @@ class CollectionsController < CatalogController
16
16
  # Blacklight uses #search_action_url to figure out the right URL for
17
17
  # the global search box
18
18
  def search_action_url options = {}
19
- catalog_index_url(options.except(:controller, :action))
19
+ search_catalog_url(options.except(:controller, :action))
20
20
  end
21
21
  helper_method :search_action_url
22
22
 
23
23
  def index
24
24
  @nav_li_active = 'explore'
25
- (@response, @document_list) = search_results(params, search_params_logic)
25
+ (@response, @document_list) = search_results(params)
26
26
  params[:view] = 'list'
27
27
  params[:sort] = 'title_info_primary_ssort asc'
28
28
 
@@ -40,7 +40,7 @@ class CollectionsController < CatalogController
40
40
  params[:f] = set_collection_facet_params(@collection_title, @document)
41
41
 
42
42
  # get the response for the facets representing items in collection
43
- (@response, @document_list) = search_results({:f => params[:f]}, search_params_logic)
43
+ (@response, @document_list) = search_results({:f => params[:f]})
44
44
 
45
45
  # get an image for the collection
46
46
  if @document[:exemplary_image_ssi]
@@ -70,7 +70,7 @@ class CollectionsController < CatalogController
70
70
 
71
71
  # filter out non-collection items
72
72
  def collections_limit
73
- self.search_params_logic += [:collections_filter]
73
+ blacklight_config.search_builder_class = CommonwealthCollectionsSearchBuilder
74
74
  end
75
75
 
76
76
  # find the title and pid for the object representing the collection image
@@ -92,15 +92,12 @@ class CollectionsController < CatalogController
92
92
  col_img_info
93
93
  end
94
94
 
95
- # find a representative image for a series
96
- # TODO better exception handling for items which don't have exemplary_image
95
+ # find a representative image/item for a series
97
96
  def get_series_image_obj(series_title,collection_title)
98
- self.search_params_logic += [:flagged_filter] unless self.search_params_logic.include?(:flagged_filter)
99
- series_doc_list = search_results(
100
- {:f => {'related_item_series_ssim' => series_title,
101
- blacklight_config.collection_field => collection_title},
102
- :rows => 1},
103
- search_params_logic)[1]
97
+ blacklight_config.search_builder_class = CommonwealthFlaggedSearchBuilder # ignore flagged items
98
+ series_doc_list = search_results({f: {'related_item_series_ssim' => series_title,
99
+ blacklight_config.collection_field => collection_title},
100
+ rows: 1})[1]
104
101
  series_doc_list.first
105
102
  end
106
103
  helper_method :get_series_image_obj
@@ -112,17 +109,4 @@ class CollectionsController < CatalogController
112
109
  facet_params
113
110
  end
114
111
 
115
- # Not using this for now
116
- # find a representative image for a collection if none is assigned
117
- # TODO better exception handling for items which don't have exemplary_image
118
- #def get_collection_image_pid(collection_title)
119
- # (@default_coll_img_resp, @default_coll_img_doc_list) = search_results(
120
- # {:f => {blacklight_config.collection_field => collection_title,
121
- # 'has_model_ssim' => 'info:fedora/afmodel:Bplmodels_ObjectBase'},
122
- # :rows => 1
123
- # })
124
- # @default_coll_img_doc_list.first[:exemplary_image_ssi]
125
- #end
126
- #helper_method :get_collection_image_pid
127
-
128
112
  end
@@ -13,10 +13,10 @@ class FolderItemsActionsController < ApplicationController
13
13
  case params[:commit]
14
14
  # email
15
15
  when t('blacklight.tools.email')
16
- redirect_to email_catalog_path(:id => items)
16
+ redirect_to email_solr_document_path(:id => items)
17
17
  # cite
18
18
  when t('blacklight.tools.citation')
19
- redirect_to citation_catalog_path(:id => items)
19
+ redirect_to citation_solr_document_path(:id => items)
20
20
  # remove
21
21
  when t('blacklight.tools.remove')
22
22
  if params[:origin] == "folders"
@@ -4,13 +4,14 @@ class FoldersController < CatalogController
4
4
  # Give Bookmarks access to the CatalogController configuration
5
5
  include Blacklight::Configurable
6
6
  include Blacklight::SearchHelper
7
+ include Blacklight::TokenBasedUser
7
8
 
8
9
  copy_blacklight_config_from(CatalogController)
9
10
 
10
11
  # Blacklight uses #search_action_url to figure out the right URL for
11
12
  # the global search box
12
13
  def search_action_url options = {}
13
- catalog_index_url(options.except(:controller, :action))
14
+ search_catalog_url(options.except(:controller, :action))
14
15
  end
15
16
  helper_method :search_action_url
16
17
 
@@ -19,12 +20,15 @@ class FoldersController < CatalogController
19
20
  before_filter :correct_user_for_folder, :only => [:update, :destroy]
20
21
 
21
22
  def index
22
- if current_user
23
- @folders = current_user.folders
23
+ flash[:notice] = flash[:notice].html_safe if flash[:notice].present? and flash[:notice] == %Q[Welcome! You're viewing Digital Stacks items using a link from a temporary card. To save these items to a free permanent account, click <a href="#{new_user_session_path}" title="Sign Up Link">Sign Up / Log In</a>.]
24
+ if current_or_guest_user
25
+ @folders = current_or_guest_user.folders
24
26
  end
25
27
  end
26
28
 
27
29
  def show
30
+ flash[:notice] = flash[:notice].html_safe if flash[:notice].present? and flash[:notice] == %Q[Welcome! You're viewing Digital Stacks items using a link from a temporary card. To save these items to a free permanent account, click <a href="#{new_user_session_path}" title="Sign Up Link">Sign Up / Log In</a>.]
31
+
28
32
  # @folder is set by correct_user_for_folder
29
33
  @folder_items = @folder.folder_items
30
34
  folder_items_ids = @folder_items.collect { |f_item| f_item.document_id.to_s }
@@ -58,7 +62,7 @@ class FoldersController < CatalogController
58
62
  # if @folder.save
59
63
  # flash[:success] = "Folder created; " + t('blacklight.folder_items.add.success')
60
64
  # current_user.folders.first.folder_items.create!(:document_id => params['id'].first)
61
- # redirect_to catalog_path(params['id']) unless request.xhr?
65
+ # redirect_to solr_document_path(params['id']) unless request.xhr?
62
66
  # else
63
67
  # flash[:error] = t('blacklight.folders.create.error.no_save')
64
68
  # end
@@ -122,8 +126,8 @@ class FoldersController < CatalogController
122
126
 
123
127
  def correct_user_for_folder
124
128
  @folder ||= Bpluser::Folder.find(params[:id])
125
- if current_user
126
- flash[:notice] = t('blacklight.folders.private') and redirect_to root_path unless current_user.folders.include?(@folder)
129
+ if current_or_guest_user
130
+ flash[:notice] = t('blacklight.folders.private') and redirect_to root_path unless current_or_guest_user.folders.include?(@folder)
127
131
  else
128
132
  flash[:notice] = t('blacklight.folders.private') and redirect_to root_path
129
133
  end
@@ -10,8 +10,8 @@ class ImageViewerController < CatalogController
10
10
  @page_sequence = get_page_sequence(@document.id, params[:view])
11
11
  respond_to do |format|
12
12
  format.js
13
- format.html { redirect_to catalog_path(@document.id,
14
- :view => params[:view]) }
13
+ format.html { redirect_to solr_document_path(@document.id,
14
+ :view => params[:view]) }
15
15
  end
16
16
  end
17
17
 
@@ -7,18 +7,21 @@ class InstitutionsController < CatalogController
7
7
 
8
8
  copy_blacklight_config_from(CatalogController)
9
9
 
10
+ before_filter :institutions_index_config, :only => [:index]
11
+ # remove collection facet and collapse others
12
+ before_filter :relation_base_blacklight_config, :only => [:show]
13
+
10
14
  # Blacklight uses #search_action_url to figure out the right URL for
11
15
  # the global search box
12
16
  def search_action_url options = {}
13
- catalog_index_url(options.except(:controller, :action))
17
+ search_catalog_url(options.except(:controller, :action))
14
18
  end
15
19
  helper_method :search_action_url
16
20
 
17
21
  def index
18
22
  @nav_li_active = 'explore'
19
- self.search_params_logic += [:institutions_filter]
20
23
  params[:per_page] = params[:per_page].presence || '50'
21
- (@response, @document_list) = search_results(params, search_params_logic)
24
+ (@response, @document_list) = search_results(params)
22
25
  params[:view] ||= 'list' # still need this or grid view is invoked
23
26
  params[:sort] = 'title_info_primary_ssort asc'
24
27
 
@@ -33,13 +36,13 @@ class InstitutionsController < CatalogController
33
36
  @institution_title = @document[blacklight_config.index.title_field.to_sym]
34
37
 
35
38
  # get the response for collection objects
36
- @collex_response, @collex_documents = search_results({:f => {'active_fedora_model_suffix_ssi' => 'Collection','institution_pid_ssi' => params[:id]},:rows => 100, :sort => 'title_info_primary_ssort asc'}, search_params_logic)
39
+ @collex_response, @collex_documents = search_results({:f => {'active_fedora_model_suffix_ssi' => 'Collection','institution_pid_ssi' => params[:id]},:rows => 100, :sort => 'title_info_primary_ssort asc'})
37
40
 
38
41
  # add params[:f] for proper facet links
39
42
  params[:f] = {blacklight_config.institution_field => [@institution_title]}
40
43
 
41
44
  # get the response for the facets representing items in collection
42
- (@response, @document_list) = search_results({:f => params[:f]}, search_params_logic)
45
+ (@response, @document_list) = search_results({:f => params[:f]})
43
46
 
44
47
  respond_to do |format|
45
48
  format.html
@@ -47,16 +50,14 @@ class InstitutionsController < CatalogController
47
50
 
48
51
  end
49
52
 
50
- # remove grid view from blacklight_config for index view
51
- def remove_unwanted_views
53
+ private
54
+
55
+ # remove grid view from blacklight_config, use correct SearchBuilder for index view
56
+ def institutions_index_config
57
+ blacklight_config.search_builder_class = CommonwealthInstitutionsSearchBuilder
52
58
  blacklight_config.view.delete(:gallery)
53
59
  blacklight_config.view.delete(:masonry)
54
60
  blacklight_config.view.delete(:slideshow)
55
61
  end
56
62
 
57
- before_filter :remove_unwanted_views, :only => [:index]
58
-
59
- # remove collection facet and collapse others
60
- before_filter :relation_base_blacklight_config, :only => [:show]
61
-
62
63
  end
@@ -9,7 +9,6 @@ class OcrSearchController < CatalogController
9
9
  copy_blacklight_config_from(CatalogController)
10
10
 
11
11
  before_filter :modify_config_for_ocr, :only => [:index]
12
- before_filter :modify_search_params_logic_for_ocr, :only => [:index]
13
12
 
14
13
  def index
15
14
  @doc_response, @document = fetch(params[:id])
@@ -22,7 +21,7 @@ class OcrSearchController < CatalogController
22
21
  # for some reason, have to set :fl here, or gets scrubbed out of ocr_search_params somehow
23
22
  blacklight_config.default_solr_params[:fl] =
24
23
  "id,#{blacklight_config.page_num_field},#{termfreq_query(params[:ocr_q])}"
25
- (@response, @document_list) = search_results(ocr_search_params, search_params_logic)
24
+ (@response, @document_list) = search_results(ocr_search_params)
26
25
  else
27
26
  (@response, @document_list) = {},[]
28
27
  end
@@ -39,6 +38,7 @@ class OcrSearchController < CatalogController
39
38
 
40
39
  # modify Solr query/response for OCR searches
41
40
  def modify_config_for_ocr
41
+ blacklight_config.search_builder_class = CommonwealthOcrSearchBuilder
42
42
  blacklight_config.sort_fields = {}
43
43
  blacklight_config.add_sort_field 'score desc, system_create_dtsi asc', label: 'relevance'
44
44
  blacklight_config.add_sort_field 'system_create_dtsi asc', label: 'page #'
@@ -49,12 +49,6 @@ class OcrSearchController < CatalogController
49
49
  blacklight_config.default_per_page = 5
50
50
  end
51
51
 
52
- # modify Solr search_params_logic for OCR searches
53
- def modify_search_params_logic_for_ocr
54
- self.search_params_logic -= [:exclude_unwanted_models, :institution_limit]
55
- self.search_params_logic += [:ocr_search_params] unless self.search_params_logic.include?(:ocr_search_params)
56
- end
57
-
58
52
  # create the Solr function query to return term frequency
59
53
  def termfreq_query(ocr_search_terms)
60
54
  search_terms = if ocr_search_terms =~ (/\A"[\s\S]*"\z/) # phrase search