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.
- checksums.yaml +4 -4
- data/.travis.yml +8 -8
- data/Gemfile +11 -2
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +1 -10
- data/app/controllers/bookmarks_controller.rb +1 -0
- data/app/controllers/catalog_controller.rb +1 -0
- data/app/controllers/concerns/blacklight/base.rb +1 -0
- data/app/controllers/concerns/blacklight/bookmarks.rb +13 -1
- data/app/controllers/concerns/blacklight/catalog.rb +7 -1
- data/app/controllers/concerns/blacklight/controller.rb +7 -6
- data/app/controllers/concerns/blacklight/default_component_configuration.rb +1 -0
- data/app/controllers/concerns/blacklight/facet.rb +1 -0
- data/app/controllers/concerns/blacklight/request_builders.rb +1 -0
- data/app/controllers/concerns/blacklight/search_context.rb +8 -12
- data/app/controllers/concerns/blacklight/search_fields.rb +1 -0
- data/app/controllers/concerns/blacklight/search_helper.rb +2 -1
- data/app/controllers/concerns/blacklight/search_history.rb +32 -0
- data/app/controllers/concerns/blacklight/suggest.rb +1 -0
- data/app/controllers/concerns/blacklight/suggest_search.rb +1 -0
- data/app/controllers/concerns/blacklight/token_based_user.rb +1 -0
- data/app/controllers/saved_searches_controller.rb +20 -9
- data/app/controllers/search_history_controller.rb +2 -18
- data/app/controllers/suggest_controller.rb +1 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/catalog_helper_behavior.rb +15 -1
- data/app/helpers/blacklight/component_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/configuration_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/facets_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/layout_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +9 -6
- data/app/helpers/blacklight/render_partials_helper.rb +15 -4
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/suggest_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/url_helper_behavior.rb +6 -6
- data/app/helpers/blacklight_configuration_helper.rb +1 -0
- data/app/helpers/blacklight_helper.rb +1 -0
- data/app/helpers/blacklight_url_helper.rb +1 -0
- data/app/helpers/catalog_helper.rb +1 -0
- data/app/helpers/component_helper.rb +1 -0
- data/app/helpers/facets_helper.rb +1 -0
- data/app/helpers/hash_as_hidden_fields_helper.rb +1 -0
- data/app/helpers/layout_helper.rb +1 -0
- data/app/helpers/render_constraints_helper.rb +1 -0
- data/app/helpers/search_history_constraints_helper.rb +1 -0
- data/app/helpers/suggest_helper.rb +1 -0
- data/app/models/blacklight/facet_paginator.rb +6 -2
- data/app/models/blacklight/solr/facet_paginator.rb +1 -0
- data/app/models/bookmark.rb +1 -0
- data/app/models/concerns/blacklight/configurable.rb +1 -0
- data/app/models/concerns/blacklight/document.rb +1 -0
- data/app/models/concerns/blacklight/document/active_model_shim.rb +1 -0
- data/app/models/concerns/blacklight/document/cache_key.rb +1 -0
- data/app/models/concerns/blacklight/document/dublin_core.rb +1 -0
- data/app/models/concerns/blacklight/document/email.rb +1 -0
- data/app/models/concerns/blacklight/document/export.rb +1 -0
- data/app/models/concerns/blacklight/document/extensions.rb +1 -0
- data/app/models/concerns/blacklight/document/schema_org.rb +1 -0
- data/app/models/concerns/blacklight/document/semantic_fields.rb +1 -0
- data/app/models/concerns/blacklight/document/sms.rb +1 -0
- data/app/models/concerns/blacklight/solr/document.rb +1 -0
- data/app/models/concerns/blacklight/solr/document/more_like_this.rb +1 -0
- data/app/models/concerns/blacklight/suggest/response.rb +1 -0
- data/app/models/concerns/blacklight/user.rb +1 -0
- data/app/models/record_mailer.rb +1 -0
- data/app/models/search.rb +4 -1
- data/app/models/solr_document.rb +1 -0
- data/app/presenters/blacklight/document_presenter.rb +17 -1
- data/app/presenters/blacklight/json_presenter.rb +1 -0
- data/app/views/bookmarks/_tools.html.erb +1 -1
- data/app/views/catalog/_facet_index_navigation.html.erb +2 -2
- data/app/views/catalog/_facet_pagination.html.erb +4 -4
- data/app/views/catalog/_search_results.html.erb +3 -5
- data/app/views/catalog/_view_type_group.html.erb +1 -1
- data/app/views/catalog/index.atom.builder +7 -7
- data/app/views/catalog/index.json.jbuilder +0 -1
- data/app/views/catalog/index.rss.builder +1 -4
- data/config/locales/blacklight.de.yml +0 -2
- data/config/locales/blacklight.es.yml +0 -2
- data/config/locales/blacklight.it.yml +0 -2
- data/config/locales/blacklight.pt-BR.yml +0 -6
- data/config/routes.rb +1 -0
- data/db/migrate/20140202020201_create_searches.rb +1 -0
- data/db/migrate/20140202020202_create_bookmarks.rb +1 -0
- data/db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb +1 -0
- data/lib/blacklight.rb +3 -1
- data/lib/blacklight/abstract_repository.rb +1 -0
- data/lib/blacklight/configuration.rb +1 -0
- data/lib/blacklight/configuration/context.rb +1 -0
- data/lib/blacklight/configuration/facet_field.rb +1 -0
- data/lib/blacklight/configuration/field.rb +1 -0
- data/lib/blacklight/configuration/fields.rb +1 -0
- data/lib/blacklight/configuration/search_field.rb +1 -0
- data/lib/blacklight/configuration/sort_field.rb +1 -0
- data/lib/blacklight/configuration/tool_config.rb +1 -0
- data/lib/blacklight/configuration/view_config.rb +1 -0
- data/lib/blacklight/engine.rb +1 -0
- data/lib/blacklight/exceptions.rb +1 -0
- data/lib/blacklight/parameters.rb +4 -4
- data/lib/blacklight/routes.rb +1 -0
- data/lib/blacklight/routes/exportable.rb +1 -0
- data/lib/blacklight/routes/searchable.rb +1 -0
- data/lib/blacklight/search_builder.rb +1 -0
- data/lib/blacklight/search_state.rb +22 -5
- data/lib/blacklight/solr.rb +1 -0
- data/lib/blacklight/solr/repository.rb +1 -0
- data/lib/blacklight/solr/request.rb +1 -0
- data/lib/blacklight/solr/response.rb +7 -1
- data/lib/blacklight/solr/response/facets.rb +1 -0
- data/lib/blacklight/solr/response/group.rb +1 -0
- data/lib/blacklight/solr/response/group_response.rb +1 -0
- data/lib/blacklight/solr/response/more_like_this.rb +1 -0
- data/lib/blacklight/solr/response/pagination_methods.rb +1 -0
- data/lib/blacklight/solr/response/response.rb +1 -0
- data/lib/blacklight/solr/response/spelling.rb +1 -0
- data/lib/blacklight/solr/search_builder_behavior.rb +19 -14
- data/lib/blacklight/utils.rb +1 -0
- data/lib/blacklight/version.rb +1 -0
- data/lib/generators/blacklight/assets_generator.rb +1 -0
- data/lib/generators/blacklight/controller_generator.rb +1 -0
- data/lib/generators/blacklight/document_generator.rb +1 -0
- data/lib/generators/blacklight/install_generator.rb +1 -0
- data/lib/generators/blacklight/models_generator.rb +1 -0
- data/lib/generators/blacklight/search_builder_generator.rb +1 -0
- data/lib/generators/blacklight/solr4_generator.rb +1 -0
- data/lib/generators/blacklight/solr5_generator.rb +2 -2
- data/lib/generators/blacklight/templates/alternate_controller.rb +1 -0
- data/lib/generators/blacklight/templates/catalog_controller.rb +1 -0
- data/lib/generators/blacklight/templates/search_builder.rb +1 -0
- data/lib/generators/blacklight/templates/solr_document.rb +1 -0
- data/lib/generators/blacklight/test_support_generator.rb +1 -0
- data/lib/generators/blacklight/user_generator.rb +10 -6
- data/lib/railties/blacklight.rake +3 -3
- data/spec/controllers/alternate_controller_spec.rb +1 -0
- data/spec/controllers/application_controller_spec.rb +1 -0
- data/spec/controllers/blacklight/base_spec.rb +5 -3
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +1 -0
- data/spec/controllers/blacklight/facet_spec.rb +1 -0
- data/spec/controllers/blacklight/search_fields_spec.rb +1 -0
- data/spec/controllers/blacklight/search_helper_spec.rb +1 -0
- data/spec/controllers/blacklight/suggest_search_spec.rb +1 -0
- data/spec/controllers/bookmarks_controller_spec.rb +1 -0
- data/spec/controllers/catalog_controller_spec.rb +17 -14
- data/spec/controllers/saved_searches_controller_spec.rb +1 -0
- data/spec/controllers/search_history_controller_spec.rb +1 -0
- data/spec/controllers/suggest_controller_spec.rb +1 -0
- data/spec/features/alternate_controller_spec.rb +1 -0
- data/spec/features/bookmarks_spec.rb +1 -0
- data/spec/features/did_you_mean_spec.rb +1 -0
- data/spec/features/facets_spec.rb +1 -0
- data/spec/features/record_view_spec.rb +1 -0
- data/spec/features/saved_searches_spec.rb +1 -0
- data/spec/features/search_context_spec.rb +1 -0
- data/spec/features/search_filters_spec.rb +2 -1
- data/spec/features/search_formats_spec.rb +1 -0
- data/spec/features/search_history_spec.rb +1 -0
- data/spec/features/search_pagination_spec.rb +1 -0
- data/spec/features/search_results_spec.rb +1 -0
- data/spec/features/search_sort_spec.rb +1 -0
- data/spec/features/search_spec.rb +1 -0
- data/spec/features/sitelinks_search_box.rb +1 -0
- data/spec/helpers/blacklight_helper_spec.rb +3 -2
- data/spec/helpers/catalog_helper_spec.rb +11 -16
- data/spec/helpers/configuration_helper_spec.rb +1 -0
- data/spec/helpers/deprecated_url_helper_behavior_spec.rb +18 -9
- data/spec/helpers/facets_helper_spec.rb +1 -0
- data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -0
- data/spec/helpers/layout_helper_spec.rb +1 -0
- data/spec/helpers/render_constraints_helper_spec.rb +18 -8
- data/spec/helpers/search_history_constraints_helper_spec.rb +1 -0
- data/spec/helpers/suggest_helper_spec.rb +1 -0
- data/spec/helpers/url_helper_spec.rb +72 -68
- data/spec/lib/blacklight/parameters_spec.rb +3 -2
- data/spec/lib/blacklight/search_state_spec.rb +44 -32
- data/spec/lib/blacklight/utils_spec.rb +1 -0
- data/spec/lib/blacklight_spec.rb +11 -3
- data/spec/lib/tasks/blacklight_task_spec.rb +1 -0
- data/spec/models/blacklight/configurable_spec.rb +1 -0
- data/spec/models/blacklight/configuration/context_spec.rb +1 -0
- data/spec/models/blacklight/configuration_spec.rb +1 -0
- data/spec/models/blacklight/document/active_model_shim_spec.rb +1 -0
- data/spec/models/blacklight/document/cache_key_spec.rb +1 -0
- data/spec/models/blacklight/document/dublin_core_spec.rb +1 -0
- data/spec/models/blacklight/document/email_spec.rb +1 -0
- data/spec/models/blacklight/document/sms_spec.rb +1 -0
- data/spec/models/blacklight/document_spec.rb +1 -0
- data/spec/models/blacklight/facet_paginator_spec.rb +21 -8
- data/spec/models/blacklight/search_builder_spec.rb +1 -0
- data/spec/models/blacklight/solr/document/more_like_this_spec.rb +1 -0
- data/spec/models/blacklight/solr/document_spec.rb +1 -0
- data/spec/models/blacklight/solr/facet_paginator_spec.rb +1 -0
- data/spec/models/blacklight/solr/repository_spec.rb +1 -0
- data/spec/models/blacklight/solr/request_spec.rb +1 -0
- data/spec/models/blacklight/solr/response/facets_spec.rb +1 -0
- data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -0
- data/spec/models/blacklight/solr/response/group_spec.rb +1 -0
- data/spec/models/blacklight/solr/response_spec.rb +1 -0
- data/spec/models/blacklight/solr/search_builder_spec.rb +21 -30
- data/spec/models/blacklight/suggest/response_spec.rb +1 -0
- data/spec/models/blacklight/user_spec.rb +1 -0
- data/spec/models/bookmark_spec.rb +4 -3
- data/spec/models/record_mailer_spec.rb +1 -0
- data/spec/models/search_spec.rb +22 -38
- data/spec/models/solr_document_spec.rb +1 -0
- data/spec/presenters/document_presenter_spec.rb +7 -3
- data/spec/routing/catalog_routing_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/controller_level_helpers.rb +2 -1
- data/spec/support/features.rb +1 -0
- data/spec/support/features/session_helpers.rb +1 -0
- data/spec/test_app_templates/Gemfile.extra +14 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
- data/spec/views/_user_util_links.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_document.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +4 -1
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_facets.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_index_default.erb_spec.rb +1 -0
- data/spec/views/catalog/_index_header_default.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_search_header.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_default.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +1 -0
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +1 -0
- data/spec/views/catalog/facet.html.erb_spec.rb +1 -0
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -0
- data/spec/views/catalog/index.atom.builder_spec.rb +19 -27
- data/spec/views/catalog/index.html.erb_spec.rb +1 -0
- data/spec/views/catalog/index.json.jbuilder_spec.rb +1 -0
- data/spec/views/catalog/opensearch.xml.builder_spec.rb +1 -0
- data/spec/views/catalog/show.html.erb_spec.rb +1 -0
- data/template.demo.rb +1 -0
- metadata +7 -5
- data/app/views/catalog/show.refworks.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2802ea5dc5949b20ebc3b5c5e2366d61946d7715
|
4
|
+
data.tar.gz: adadf86841b374b3715c107107837311a321ba2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
19
|
-
- rvm:
|
20
|
-
env: "RAILS_VERSION=4.2.
|
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.
|
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.
|
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
|
-
|
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
|
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
|
1
|
+
6.0.0
|
@@ -68,17 +68,8 @@
|
|
68
68
|
}
|
69
69
|
|
70
70
|
@mixin hyphens-auto {
|
71
|
-
|
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
|
# 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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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::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
|
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
|
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 ||=
|
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
|
# 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,
|
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,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
|
-
|
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
|
-
|
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
|