blacklight 6.0.0.pre5 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +8 -8
  3. data/Gemfile +11 -2
  4. data/VERSION +1 -1
  5. data/app/assets/stylesheets/blacklight/_facets.scss +1 -10
  6. data/app/controllers/bookmarks_controller.rb +1 -0
  7. data/app/controllers/catalog_controller.rb +1 -0
  8. data/app/controllers/concerns/blacklight/base.rb +1 -0
  9. data/app/controllers/concerns/blacklight/bookmarks.rb +13 -1
  10. data/app/controllers/concerns/blacklight/catalog.rb +7 -1
  11. data/app/controllers/concerns/blacklight/controller.rb +7 -6
  12. data/app/controllers/concerns/blacklight/default_component_configuration.rb +1 -0
  13. data/app/controllers/concerns/blacklight/facet.rb +1 -0
  14. data/app/controllers/concerns/blacklight/request_builders.rb +1 -0
  15. data/app/controllers/concerns/blacklight/search_context.rb +8 -12
  16. data/app/controllers/concerns/blacklight/search_fields.rb +1 -0
  17. data/app/controllers/concerns/blacklight/search_helper.rb +2 -1
  18. data/app/controllers/concerns/blacklight/search_history.rb +32 -0
  19. data/app/controllers/concerns/blacklight/suggest.rb +1 -0
  20. data/app/controllers/concerns/blacklight/suggest_search.rb +1 -0
  21. data/app/controllers/concerns/blacklight/token_based_user.rb +1 -0
  22. data/app/controllers/saved_searches_controller.rb +20 -9
  23. data/app/controllers/search_history_controller.rb +2 -18
  24. data/app/controllers/suggest_controller.rb +1 -0
  25. data/app/helpers/blacklight/blacklight_helper_behavior.rb +1 -0
  26. data/app/helpers/blacklight/catalog_helper_behavior.rb +15 -1
  27. data/app/helpers/blacklight/component_helper_behavior.rb +1 -0
  28. data/app/helpers/blacklight/configuration_helper_behavior.rb +1 -0
  29. data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +1 -0
  30. data/app/helpers/blacklight/facets_helper_behavior.rb +1 -0
  31. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +1 -0
  32. data/app/helpers/blacklight/layout_helper_behavior.rb +1 -0
  33. data/app/helpers/blacklight/render_constraints_helper_behavior.rb +9 -6
  34. data/app/helpers/blacklight/render_partials_helper.rb +15 -4
  35. data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +1 -0
  36. data/app/helpers/blacklight/suggest_helper_behavior.rb +1 -0
  37. data/app/helpers/blacklight/url_helper_behavior.rb +6 -6
  38. data/app/helpers/blacklight_configuration_helper.rb +1 -0
  39. data/app/helpers/blacklight_helper.rb +1 -0
  40. data/app/helpers/blacklight_url_helper.rb +1 -0
  41. data/app/helpers/catalog_helper.rb +1 -0
  42. data/app/helpers/component_helper.rb +1 -0
  43. data/app/helpers/facets_helper.rb +1 -0
  44. data/app/helpers/hash_as_hidden_fields_helper.rb +1 -0
  45. data/app/helpers/layout_helper.rb +1 -0
  46. data/app/helpers/render_constraints_helper.rb +1 -0
  47. data/app/helpers/search_history_constraints_helper.rb +1 -0
  48. data/app/helpers/suggest_helper.rb +1 -0
  49. data/app/models/blacklight/facet_paginator.rb +6 -2
  50. data/app/models/blacklight/solr/facet_paginator.rb +1 -0
  51. data/app/models/bookmark.rb +1 -0
  52. data/app/models/concerns/blacklight/configurable.rb +1 -0
  53. data/app/models/concerns/blacklight/document.rb +1 -0
  54. data/app/models/concerns/blacklight/document/active_model_shim.rb +1 -0
  55. data/app/models/concerns/blacklight/document/cache_key.rb +1 -0
  56. data/app/models/concerns/blacklight/document/dublin_core.rb +1 -0
  57. data/app/models/concerns/blacklight/document/email.rb +1 -0
  58. data/app/models/concerns/blacklight/document/export.rb +1 -0
  59. data/app/models/concerns/blacklight/document/extensions.rb +1 -0
  60. data/app/models/concerns/blacklight/document/schema_org.rb +1 -0
  61. data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -0
  62. data/app/models/concerns/blacklight/document/sms.rb +1 -0
  63. data/app/models/concerns/blacklight/solr/document.rb +1 -0
  64. data/app/models/concerns/blacklight/solr/document/more_like_this.rb +1 -0
  65. data/app/models/concerns/blacklight/suggest/response.rb +1 -0
  66. data/app/models/concerns/blacklight/user.rb +1 -0
  67. data/app/models/record_mailer.rb +1 -0
  68. data/app/models/search.rb +4 -1
  69. data/app/models/solr_document.rb +1 -0
  70. data/app/presenters/blacklight/document_presenter.rb +17 -1
  71. data/app/presenters/blacklight/json_presenter.rb +1 -0
  72. data/app/views/bookmarks/_tools.html.erb +1 -1
  73. data/app/views/catalog/_facet_index_navigation.html.erb +2 -2
  74. data/app/views/catalog/_facet_pagination.html.erb +4 -4
  75. data/app/views/catalog/_search_results.html.erb +3 -5
  76. data/app/views/catalog/_view_type_group.html.erb +1 -1
  77. data/app/views/catalog/index.atom.builder +7 -7
  78. data/app/views/catalog/index.json.jbuilder +0 -1
  79. data/app/views/catalog/index.rss.builder +1 -4
  80. data/config/locales/blacklight.de.yml +0 -2
  81. data/config/locales/blacklight.es.yml +0 -2
  82. data/config/locales/blacklight.it.yml +0 -2
  83. data/config/locales/blacklight.pt-BR.yml +0 -6
  84. data/config/routes.rb +1 -0
  85. data/db/migrate/20140202020201_create_searches.rb +1 -0
  86. data/db/migrate/20140202020202_create_bookmarks.rb +1 -0
  87. data/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +1 -0
  88. data/lib/blacklight.rb +3 -1
  89. data/lib/blacklight/abstract_repository.rb +1 -0
  90. data/lib/blacklight/configuration.rb +1 -0
  91. data/lib/blacklight/configuration/context.rb +1 -0
  92. data/lib/blacklight/configuration/facet_field.rb +1 -0
  93. data/lib/blacklight/configuration/field.rb +1 -0
  94. data/lib/blacklight/configuration/fields.rb +1 -0
  95. data/lib/blacklight/configuration/search_field.rb +1 -0
  96. data/lib/blacklight/configuration/sort_field.rb +1 -0
  97. data/lib/blacklight/configuration/tool_config.rb +1 -0
  98. data/lib/blacklight/configuration/view_config.rb +1 -0
  99. data/lib/blacklight/engine.rb +1 -0
  100. data/lib/blacklight/exceptions.rb +1 -0
  101. data/lib/blacklight/parameters.rb +4 -4
  102. data/lib/blacklight/routes.rb +1 -0
  103. data/lib/blacklight/routes/exportable.rb +1 -0
  104. data/lib/blacklight/routes/searchable.rb +1 -0
  105. data/lib/blacklight/search_builder.rb +1 -0
  106. data/lib/blacklight/search_state.rb +22 -5
  107. data/lib/blacklight/solr.rb +1 -0
  108. data/lib/blacklight/solr/repository.rb +1 -0
  109. data/lib/blacklight/solr/request.rb +1 -0
  110. data/lib/blacklight/solr/response.rb +7 -1
  111. data/lib/blacklight/solr/response/facets.rb +1 -0
  112. data/lib/blacklight/solr/response/group.rb +1 -0
  113. data/lib/blacklight/solr/response/group_response.rb +1 -0
  114. data/lib/blacklight/solr/response/more_like_this.rb +1 -0
  115. data/lib/blacklight/solr/response/pagination_methods.rb +1 -0
  116. data/lib/blacklight/solr/response/response.rb +1 -0
  117. data/lib/blacklight/solr/response/spelling.rb +1 -0
  118. data/lib/blacklight/solr/search_builder_behavior.rb +19 -14
  119. data/lib/blacklight/utils.rb +1 -0
  120. data/lib/blacklight/version.rb +1 -0
  121. data/lib/generators/blacklight/assets_generator.rb +1 -0
  122. data/lib/generators/blacklight/controller_generator.rb +1 -0
  123. data/lib/generators/blacklight/document_generator.rb +1 -0
  124. data/lib/generators/blacklight/install_generator.rb +1 -0
  125. data/lib/generators/blacklight/models_generator.rb +1 -0
  126. data/lib/generators/blacklight/search_builder_generator.rb +1 -0
  127. data/lib/generators/blacklight/solr4_generator.rb +1 -0
  128. data/lib/generators/blacklight/solr5_generator.rb +2 -2
  129. data/lib/generators/blacklight/templates/alternate_controller.rb +1 -0
  130. data/lib/generators/blacklight/templates/catalog_controller.rb +1 -0
  131. data/lib/generators/blacklight/templates/search_builder.rb +1 -0
  132. data/lib/generators/blacklight/templates/solr_document.rb +1 -0
  133. data/lib/generators/blacklight/test_support_generator.rb +1 -0
  134. data/lib/generators/blacklight/user_generator.rb +10 -6
  135. data/lib/railties/blacklight.rake +3 -3
  136. data/spec/controllers/alternate_controller_spec.rb +1 -0
  137. data/spec/controllers/application_controller_spec.rb +1 -0
  138. data/spec/controllers/blacklight/base_spec.rb +5 -3
  139. data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +1 -0
  140. data/spec/controllers/blacklight/facet_spec.rb +1 -0
  141. data/spec/controllers/blacklight/search_fields_spec.rb +1 -0
  142. data/spec/controllers/blacklight/search_helper_spec.rb +1 -0
  143. data/spec/controllers/blacklight/suggest_search_spec.rb +1 -0
  144. data/spec/controllers/bookmarks_controller_spec.rb +1 -0
  145. data/spec/controllers/catalog_controller_spec.rb +17 -14
  146. data/spec/controllers/saved_searches_controller_spec.rb +1 -0
  147. data/spec/controllers/search_history_controller_spec.rb +1 -0
  148. data/spec/controllers/suggest_controller_spec.rb +1 -0
  149. data/spec/features/alternate_controller_spec.rb +1 -0
  150. data/spec/features/bookmarks_spec.rb +1 -0
  151. data/spec/features/did_you_mean_spec.rb +1 -0
  152. data/spec/features/facets_spec.rb +1 -0
  153. data/spec/features/record_view_spec.rb +1 -0
  154. data/spec/features/saved_searches_spec.rb +1 -0
  155. data/spec/features/search_context_spec.rb +1 -0
  156. data/spec/features/search_filters_spec.rb +2 -1
  157. data/spec/features/search_formats_spec.rb +1 -0
  158. data/spec/features/search_history_spec.rb +1 -0
  159. data/spec/features/search_pagination_spec.rb +1 -0
  160. data/spec/features/search_results_spec.rb +1 -0
  161. data/spec/features/search_sort_spec.rb +1 -0
  162. data/spec/features/search_spec.rb +1 -0
  163. data/spec/features/sitelinks_search_box.rb +1 -0
  164. data/spec/helpers/blacklight_helper_spec.rb +3 -2
  165. data/spec/helpers/catalog_helper_spec.rb +11 -16
  166. data/spec/helpers/configuration_helper_spec.rb +1 -0
  167. data/spec/helpers/deprecated_url_helper_behavior_spec.rb +18 -9
  168. data/spec/helpers/facets_helper_spec.rb +1 -0
  169. data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -0
  170. data/spec/helpers/layout_helper_spec.rb +1 -0
  171. data/spec/helpers/render_constraints_helper_spec.rb +18 -8
  172. data/spec/helpers/search_history_constraints_helper_spec.rb +1 -0
  173. data/spec/helpers/suggest_helper_spec.rb +1 -0
  174. data/spec/helpers/url_helper_spec.rb +72 -68
  175. data/spec/lib/blacklight/parameters_spec.rb +3 -2
  176. data/spec/lib/blacklight/search_state_spec.rb +44 -32
  177. data/spec/lib/blacklight/utils_spec.rb +1 -0
  178. data/spec/lib/blacklight_spec.rb +11 -3
  179. data/spec/lib/tasks/blacklight_task_spec.rb +1 -0
  180. data/spec/models/blacklight/configurable_spec.rb +1 -0
  181. data/spec/models/blacklight/configuration/context_spec.rb +1 -0
  182. data/spec/models/blacklight/configuration_spec.rb +1 -0
  183. data/spec/models/blacklight/document/active_model_shim_spec.rb +1 -0
  184. data/spec/models/blacklight/document/cache_key_spec.rb +1 -0
  185. data/spec/models/blacklight/document/dublin_core_spec.rb +1 -0
  186. data/spec/models/blacklight/document/email_spec.rb +1 -0
  187. data/spec/models/blacklight/document/sms_spec.rb +1 -0
  188. data/spec/models/blacklight/document_spec.rb +1 -0
  189. data/spec/models/blacklight/facet_paginator_spec.rb +21 -8
  190. data/spec/models/blacklight/search_builder_spec.rb +1 -0
  191. data/spec/models/blacklight/solr/document/more_like_this_spec.rb +1 -0
  192. data/spec/models/blacklight/solr/document_spec.rb +1 -0
  193. data/spec/models/blacklight/solr/facet_paginator_spec.rb +1 -0
  194. data/spec/models/blacklight/solr/repository_spec.rb +1 -0
  195. data/spec/models/blacklight/solr/request_spec.rb +1 -0
  196. data/spec/models/blacklight/solr/response/facets_spec.rb +1 -0
  197. data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -0
  198. data/spec/models/blacklight/solr/response/group_spec.rb +1 -0
  199. data/spec/models/blacklight/solr/response_spec.rb +1 -0
  200. data/spec/models/blacklight/solr/search_builder_spec.rb +21 -30
  201. data/spec/models/blacklight/suggest/response_spec.rb +1 -0
  202. data/spec/models/blacklight/user_spec.rb +1 -0
  203. data/spec/models/bookmark_spec.rb +4 -3
  204. data/spec/models/record_mailer_spec.rb +1 -0
  205. data/spec/models/search_spec.rb +22 -38
  206. data/spec/models/solr_document_spec.rb +1 -0
  207. data/spec/presenters/document_presenter_spec.rb +7 -3
  208. data/spec/routing/catalog_routing_spec.rb +1 -0
  209. data/spec/spec_helper.rb +1 -0
  210. data/spec/support/controller_level_helpers.rb +2 -1
  211. data/spec/support/features.rb +1 -0
  212. data/spec/support/features/session_helpers.rb +1 -0
  213. data/spec/test_app_templates/Gemfile.extra +14 -0
  214. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
  215. data/spec/views/_user_util_links.html.erb_spec.rb +1 -0
  216. data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -0
  217. data/spec/views/catalog/_constraints_element.html.erb_spec.rb +1 -0
  218. data/spec/views/catalog/_document.html.erb_spec.rb +1 -0
  219. data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -0
  220. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +4 -1
  221. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +1 -0
  222. data/spec/views/catalog/_facets.html.erb_spec.rb +1 -0
  223. data/spec/views/catalog/_index_default.erb_spec.rb +1 -0
  224. data/spec/views/catalog/_index_header_default.html.erb_spec.rb +1 -0
  225. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +1 -0
  226. data/spec/views/catalog/_search_header.erb_spec.rb +1 -0
  227. data/spec/views/catalog/_show_default.erb_spec.rb +1 -0
  228. data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -0
  229. data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -0
  230. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -0
  231. data/spec/views/catalog/_thumbnail_default.erb_spec.rb +1 -0
  232. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +1 -0
  233. data/spec/views/catalog/facet.html.erb_spec.rb +1 -0
  234. data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -0
  235. data/spec/views/catalog/index.atom.builder_spec.rb +19 -27
  236. data/spec/views/catalog/index.html.erb_spec.rb +1 -0
  237. data/spec/views/catalog/index.json.jbuilder_spec.rb +1 -0
  238. data/spec/views/catalog/opensearch.xml.builder_spec.rb +1 -0
  239. data/spec/views/catalog/show.html.erb_spec.rb +1 -0
  240. data/template.demo.rb +1 -0
  241. metadata +7 -5
  242. data/app/views/catalog/show.refworks.erb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7626335c66be4201927a8a1afbe8df051da1b4b0
4
- data.tar.gz: 5bd3bfaac1b8b69940573d3172c7e0e8a97522af
3
+ metadata.gz: 2802ea5dc5949b20ebc3b5c5e2366d61946d7715
4
+ data.tar.gz: adadf86841b374b3715c107107837311a321ba2a
5
5
  SHA512:
6
- metadata.gz: 814188a4b39df6c79dc2c993e0bc1ab879028b071b4341efcd4ebdb30594d1c3a8efb64b317d2f8e808d9dbc7ad029f5d313aff387711f2c21d6e8d7ac9107b0
7
- data.tar.gz: 11a6ea22038b58e3240397a7e36dfe16c8c28730e18cbcedbe6fca188887fcce3ad8ff511757b5fe0d7c013420a458a424de3cb0c10fc4d01415c6c703248b3a
6
+ metadata.gz: f4751dfa6d0dca7e851681d115cd16c0f843e2336b077dd83b0a7c96396776f2558396ac98e7df3f27abc5ec6afb742af25b5136624b0fe32d5c81c7351929e2
7
+ data.tar.gz: 7a88648e6077a5da60640e8b819daad72784ecb893cea39698ec80e7195cf247b26b573f721cdc838c857eef60d265c74bdd36fe655dc856a8d0bd25470dd09c
data/.travis.yml CHANGED
@@ -8,25 +8,25 @@ notifications:
8
8
  email: false
9
9
 
10
10
  rvm:
11
- - 2.2.3
11
+ - 2.3.0
12
12
 
13
13
  matrix:
14
14
  include:
15
- - rvm: 2.2.2
16
- env: "RAILS_VERSION=4.1.13"
17
15
  - rvm: 2.1.6
18
- env: "RAILS_VERSION=4.2.4"
19
- - rvm: jruby-9.0.1.0
20
- env: "RAILS_VERSION=4.2.4 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
16
+ env: "RAILS_VERSION=4.2.5"
17
+ - rvm: 2.2.4
18
+ env: "RAILS_VERSION=4.2.5"
19
+ - rvm: jruby-9.0.4.0
20
+ env: "RAILS_VERSION=4.2.5 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
21
21
  allow_failures:
22
- - rvm: jruby-9.0.1.0
22
+ - rvm: jruby-9.0.4.0
23
23
  fast_finish: true
24
24
 
25
25
  before_install:
26
26
  - gem install bundler
27
27
 
28
28
  env:
29
- - "RAILS_VERSION=4.2.4"
29
+ - "RAILS_VERSION=4.2.5"
30
30
 
31
31
  notifications:
32
32
  irc: "irc.freenode.org#blacklight"
data/Gemfile CHANGED
@@ -25,11 +25,20 @@ if File.exist?(file)
25
25
  else
26
26
  Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
27
27
 
28
- gem 'rails', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
28
+ if ENV['RAILS_VERSION']
29
+ if ENV['RAILS_VERSION'] == 'edge'
30
+ gem 'rails', github: 'rails/rails'
31
+ ENV['ENGINE_CART_RAILS_OPTIONS']= "--edge --skip-turbolinks"
32
+ else
33
+ gem 'rails', ENV['RAILS_VERSION']
34
+ end
35
+ end
29
36
 
30
- if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4.2/
37
+ if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] =~ /^4\.2/
31
38
  gem 'responders', "~> 2.0"
32
39
  gem 'sass-rails', ">= 5.0"
40
+ elsif ENV['RAILS_VERSION'] =~ /^5\.0/ || ENV['RAILS_VERSION'] == 'edge'
41
+ # nop
33
42
  else
34
43
  gem 'bootstrap-sass', '< 3.3.5' # 3.3.5 requires sass 3.3, incompatible with sass-rails 4.x
35
44
  gem 'sass-rails', "< 5.0"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.0.0.pre5
1
+ 6.0.0
@@ -68,17 +68,8 @@
68
68
  }
69
69
 
70
70
  @mixin hyphens-auto {
71
- // breaks long words apart so they don't cause the containing div to
72
- // be too big, also fix hypenation
73
- -ms-word-break: keep-all;
74
- word-break: keep-all;
75
-
76
- // Non standard for webkit
77
- word-break: break-word;
78
-
71
+ overflow-wrap: break-word;
79
72
  -webkit-hyphens: auto;
80
- -moz-hyphens: auto;
81
- -ms-hyphens: auto;
82
73
  -o-hyphens: auto;
83
74
  hyphens: auto;
84
75
  }
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class BookmarksController < CatalogController
2
3
 
3
4
  include Blacklight::Bookmarks
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class CatalogController < ApplicationController
2
3
 
3
4
  include Blacklight::Catalog
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight::Base
2
3
  extend ActiveSupport::Concern
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # note that while this is mostly restful routing, the #update and #destroy actions
2
3
  # take the Solr document ID as the :id, NOT the id of the actual Bookmark action.
3
4
  module Blacklight::Bookmarks
@@ -90,7 +91,12 @@ module Blacklight::Bookmarks
90
91
  flash[:error] = I18n.t('blacklight.bookmarks.add.failure', :count => @bookmarks.length)
91
92
  end
92
93
 
93
- redirect_to :back
94
+ if respond_to? :redirect_back
95
+ redirect_back fallback_location: bookmarks_path
96
+ else
97
+ # Deprecated in Rails 5.0
98
+ redirect_to :back
99
+ end
94
100
  end
95
101
  end
96
102
 
@@ -102,14 +108,20 @@ module Blacklight::Bookmarks
102
108
  if bookmark && bookmark.delete && bookmark.destroyed?
103
109
  if request.xhr?
104
110
  render(json: { bookmarks: { count: current_or_guest_user.bookmarks.count }})
111
+ elsif respond_to? :redirect_back
112
+ redirect_back fallback_location: bookmarks_path, notice: I18n.t('blacklight.bookmarks.remove.success')
105
113
  else
114
+ # Deprecated in Rails 5.0
106
115
  redirect_to :back, notice: I18n.t('blacklight.bookmarks.remove.success')
107
116
  end
108
117
  else
109
118
  if request.xhr?
110
119
  # ajaxy request needs no redirect and should not have flash set
111
120
  render(:text => "", :status => "500")
121
+ elsif respond_to? :redirect_back
122
+ redirect_back fallback_location: bookmarks_path, flash: { error: I18n.t('blacklight.bookmarks.remove.failure') }
112
123
  else
124
+ # Deprecated in Rails 5.0
113
125
  redirect_to :back, flash: { error: I18n.t('blacklight.bookmarks.remove.failure') }
114
126
  end
115
127
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight::Catalog
2
3
  extend ActiveSupport::Concern
3
4
 
@@ -147,6 +148,8 @@ module Blacklight::Catalog
147
148
  instance_exec &config
148
149
  when Symbol, String
149
150
  send config
151
+ else
152
+ render({})
150
153
  end
151
154
  end
152
155
  end
@@ -189,7 +192,10 @@ module Blacklight::Catalog
189
192
  # By default, any search action from a Blacklight::Catalog controller
190
193
  # should use the current controller when constructing the route.
191
194
  def search_action_url options = {}
192
- url_for(options.merge(:action => 'index'))
195
+ raise "Options was not a hash (#{options.class}" unless options.is_a? Hash
196
+ # We don't want to permit here because one of the options could be :only_path, which is an option, but not a parameter
197
+ # options.permit!
198
+ url_for(options.merge(action: 'index'))
193
199
  end
194
200
 
195
201
  # Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  # Filters added to this controller apply to all controllers in the hosting application
2
3
  # as this module is mixed-in to the application controller in the hosting app on installation.
3
- module Blacklight::Controller
4
+ module Blacklight::Controller
4
5
 
5
6
  extend ActiveSupport::Concern
6
-
7
+
7
8
  included do
8
9
  include Blacklight::SearchFields
9
10
  helper Blacklight::SearchFields
@@ -11,9 +12,9 @@ module Blacklight::Controller
11
12
  include ActiveSupport::Callbacks
12
13
 
13
14
  # now in application.rb file under config.filter_parameters
14
- # filter_parameter_logging :password, :password_confirmation
15
+ # filter_parameter_logging :password, :password_confirmation
15
16
  helper_method :current_user_session, :current_user, :current_or_guest_user
16
- after_filter :discard_flash_if_xhr
17
+ after_action :discard_flash_if_xhr
17
18
 
18
19
  # handle basic authorization exception with #access_denied
19
20
  rescue_from Blacklight::Exceptions::AccessDenied, :with => :access_denied
@@ -76,7 +77,6 @@ module Blacklight::Controller
76
77
  end
77
78
 
78
79
  def search_action_path *args
79
-
80
80
  if args.first.is_a? Hash
81
81
  args.first[:only_path] = true
82
82
  end
@@ -85,7 +85,8 @@ module Blacklight::Controller
85
85
  end
86
86
 
87
87
  def search_facet_url options = {}
88
- url_for params.merge(action: "facet").merge(options).except(:page)
88
+ opts = search_state.to_h.merge(action: "facet").merge(options).except(:page)
89
+ url_for opts
89
90
  end
90
91
 
91
92
  # Returns a list of Searches from the ids in the user's history.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight
2
3
  module DefaultComponentConfiguration
3
4
  extend ActiveSupport::Concern
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight
2
3
  # These are methods that are used at both the view helper and controller layers
3
4
  # They are only dependent on `blacklight_config` and `@response`
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight
2
3
  module RequestBuilders
3
4
  extend ActiveSupport::Concern
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight::SearchContext
2
3
  extend ActiveSupport::Concern
3
4
 
@@ -14,24 +15,24 @@ module Blacklight::SearchContext
14
15
  before_action :current_search_session, opts
15
16
  end
16
17
  end
17
-
18
+
18
19
  protected
19
20
 
20
21
  # sets up the session[:search] hash if it doesn't already exist
21
22
  def search_session
22
23
  session[:search] ||= {}
23
24
  end
24
-
25
- # The current search session
25
+
26
+ # The current search session
26
27
  def current_search_session
27
28
 
28
29
  @current_search_session ||= if start_new_search_session?
29
- find_or_initialize_search_session_from_params params
30
+ find_or_initialize_search_session_from_params search_state.to_h
30
31
  elsif params[:search_context].present?
31
32
  find_or_initialize_search_session_from_params JSON.load(params[:search_context])
32
33
  elsif params[:search_id].present?
33
34
  begin
34
- # TODO : check the search id signature.
35
+ # TODO: check the search id signature.
35
36
  searches_from_history.find(params[:search_id])
36
37
  rescue ActiveRecord::RecordNotFound
37
38
  nil
@@ -63,10 +64,8 @@ module Blacklight::SearchContext
63
64
 
64
65
  saved_search = searches_from_history.find { |x| x.query_params == params_copy }
65
66
 
66
- saved_search ||= begin
67
- s = Search.create(:query_params => params_copy)
67
+ saved_search ||= Search.create(query_params: params_copy).tap do |s|
68
68
  add_to_search_history(s)
69
- s
70
69
  end
71
70
  end
72
71
 
@@ -77,13 +76,11 @@ module Blacklight::SearchContext
77
76
  session[:history].unshift(search.id)
78
77
 
79
78
  if session[:history].length > blacklight_config.search_history_window
80
-
81
79
  session[:history] = session[:history].slice(0, blacklight_config.search_history_window )
82
-
83
80
  end
84
81
  end
85
82
 
86
- # A list of query parameters that should not be persisted for a search
83
+ # A list of query parameters that should not be persisted for a search
87
84
  def blacklisted_search_session_params
88
85
  [:commit, :counter, :total, :search_id, :page, :per_page]
89
86
  end
@@ -103,5 +100,4 @@ module Blacklight::SearchContext
103
100
  rescue Blacklight::Exceptions::InvalidRequest => e
104
101
  logger.warn "Unable to setup next and previous documents: #{e}"
105
102
  end
106
-
107
103
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  ##
2
3
  # Module to deal with accessing (and setting some defaults) in an array of
3
4
  # hashes that describe Blacklight search fields. Requires the base class this
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # SearchHelper is a controller layer mixin. It is in the controller scope: request params, session etc.
2
3
  #
3
4
  # NOTE: Be careful when creating variables here as they may be overriding something that already exists.
@@ -76,7 +77,7 @@ module Blacklight::SearchHelper
76
77
  # @return [Blacklight::Solr::Response, Blacklight::SolrDocument] the solr response object and the first document
77
78
  def fetch(id=nil, extra_controller_params={})
78
79
  if id.is_a? Array
79
- fetch_many(id, params, extra_controller_params)
80
+ fetch_many(id, search_state.to_h, extra_controller_params)
80
81
  else
81
82
  fetch_one(id, extra_controller_params)
82
83
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ module Blacklight
3
+ module SearchHistory
4
+ extend ActiveSupport::Concern
5
+ include Blacklight::Configurable
6
+
7
+ included do
8
+ copy_blacklight_config_from(CatalogController)
9
+ end
10
+
11
+ def index
12
+ @searches = searches_from_history
13
+ end
14
+
15
+ # TODO: we may want to remove unsaved (those without user_id) items from
16
+ # the database when removed from history
17
+ def clear
18
+ if session[:history].clear
19
+ flash[:notice] = I18n.t('blacklight.search_history.clear.success')
20
+ else
21
+ flash[:error] = I18n.t('blacklight.search_history.clear.failure')
22
+ end
23
+
24
+ if respond_to? :redirect_back
25
+ redirect_back fallback_location: blacklight.search_history_path
26
+ else
27
+ # Deprecated in Rails 5.0
28
+ redirect_to :back
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight
2
3
  module Suggest
3
4
  extend ActiveSupport::Concern
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight
2
3
  class SuggestSearch
3
4
  attr_reader :request_params, :repository
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Blacklight::TokenBasedUser
2
3
  extend ActiveSupport::Concern
3
4
 
@@ -1,22 +1,28 @@
1
+ # frozen_string_literal: true
1
2
  class SavedSearchesController < ApplicationController
2
3
  include Blacklight::Configurable
3
4
 
4
5
  copy_blacklight_config_from(CatalogController)
5
6
  before_action :require_user_authentication_provider
6
7
  before_action :verify_user
7
-
8
+
8
9
  def index
9
10
  @searches = current_user.searches
10
11
  end
11
-
12
- def save
12
+
13
+ def save
13
14
  current_user.searches << searches_from_history.find(params[:id])
14
15
  if current_user.save
15
16
  flash[:notice] = I18n.t('blacklight.saved_searches.add.success')
16
17
  else
17
18
  flash[:error] = I18n.t('blacklight.saved_searches.add.failure')
18
19
  end
19
- redirect_to :back
20
+ if respond_to? :redirect_back
21
+ redirect_back fallback_location: blacklight.saved_searches_path
22
+ else
23
+ # Deprecated in Rails 5.0
24
+ redirect_to :back
25
+ end
20
26
  end
21
27
 
22
28
  # Only dereferences the user rather than removing the item in case it
@@ -30,22 +36,27 @@ class SavedSearchesController < ApplicationController
30
36
  else
31
37
  flash[:error] = I18n.t('blacklight.saved_searches.remove.failure')
32
38
  end
33
- redirect_to :back
39
+ if respond_to? :redirect_back
40
+ redirect_back fallback_location: blacklight.saved_searches_path
41
+ else
42
+ # Deprecated in Rails 5.0
43
+ redirect_to :back
44
+ end
34
45
  end
35
-
46
+
36
47
  # Only dereferences the user rather than removing the items in case they
37
48
  # are in the session[:history]
38
- def clear
49
+ def clear
39
50
  if current_user.searches.update_all("user_id = NULL")
40
51
  flash[:notice] = I18n.t('blacklight.saved_searches.clear.success')
41
52
  else
42
- flash[:error] = I18n.t('blacklight.saved_searches.clear.failure')
53
+ flash[:error] = I18n.t('blacklight.saved_searches.clear.failure')
43
54
  end
44
55
  redirect_to blacklight.saved_searches_url
45
56
  end
46
57
 
47
-
48
58
  protected
59
+
49
60
  def verify_user
50
61
  flash[:notice] = I18n.t('blacklight.saved_searches.need_login') and raise Blacklight::Exceptions::AccessDenied unless current_user
51
62
  end