blacklight 6.0.0 → 6.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/controllers/concerns/blacklight/saved_searches.rb +68 -0
- data/app/controllers/saved_searches_controller.rb +1 -60
- data/app/views/catalog/_facets.html.erb +7 -7
- data/lib/generators/blacklight/install_generator.rb +2 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec40efd384aeece9251a5a0c48ade57523ea6ce5
|
4
|
+
data.tar.gz: a44796b19ca9c6194f9443049e763faaf20c6620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 886748c96a35a2946a512c12394c280b96a98f49e245f297c32edd743714d2e9ae8584a7337e1dc4c2d1236d2050c69b8526bcaf040432b8fac863dd003d8146
|
7
|
+
data.tar.gz: a6f1abdc691dacd50af6b2387ee588a4c39ad357c3034a2c92ec0ad9dd12c7954a10a31036c6fe4d717ea9724339fef72167084d0627406b5e79b9ec62289455
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.0.
|
1
|
+
6.0.1
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Blacklight
|
3
|
+
module SavedSearches
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
include Blacklight::Configurable
|
6
|
+
|
7
|
+
included do
|
8
|
+
copy_blacklight_config_from(CatalogController)
|
9
|
+
before_action :require_user_authentication_provider
|
10
|
+
before_action :verify_user
|
11
|
+
end
|
12
|
+
|
13
|
+
def index
|
14
|
+
@searches = current_user.searches
|
15
|
+
end
|
16
|
+
|
17
|
+
def save
|
18
|
+
current_user.searches << searches_from_history.find(params[:id])
|
19
|
+
if current_user.save
|
20
|
+
flash[:notice] = I18n.t('blacklight.saved_searches.add.success')
|
21
|
+
else
|
22
|
+
flash[:error] = I18n.t('blacklight.saved_searches.add.failure')
|
23
|
+
end
|
24
|
+
if respond_to? :redirect_back
|
25
|
+
redirect_back fallback_location: blacklight.saved_searches_path
|
26
|
+
else
|
27
|
+
# Deprecated in Rails 5.0
|
28
|
+
redirect_to :back
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Only dereferences the user rather than removing the item in case it
|
33
|
+
# is in the session[:history]
|
34
|
+
def forget
|
35
|
+
if search = current_user.searches.find(params[:id])
|
36
|
+
search.user_id = nil
|
37
|
+
search.save
|
38
|
+
|
39
|
+
flash[:notice] =I18n.t('blacklight.saved_searches.remove.success')
|
40
|
+
else
|
41
|
+
flash[:error] = I18n.t('blacklight.saved_searches.remove.failure')
|
42
|
+
end
|
43
|
+
if respond_to? :redirect_back
|
44
|
+
redirect_back fallback_location: blacklight.saved_searches_path
|
45
|
+
else
|
46
|
+
# Deprecated in Rails 5.0
|
47
|
+
redirect_to :back
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Only dereferences the user rather than removing the items in case they
|
52
|
+
# are in the session[:history]
|
53
|
+
def clear
|
54
|
+
if current_user.searches.update_all("user_id = NULL")
|
55
|
+
flash[:notice] = I18n.t('blacklight.saved_searches.clear.success')
|
56
|
+
else
|
57
|
+
flash[:error] = I18n.t('blacklight.saved_searches.clear.failure')
|
58
|
+
end
|
59
|
+
redirect_to blacklight.saved_searches_url
|
60
|
+
end
|
61
|
+
|
62
|
+
protected
|
63
|
+
|
64
|
+
def verify_user
|
65
|
+
flash[:notice] = I18n.t('blacklight.saved_searches.need_login') and raise Blacklight::Exceptions::AccessDenied unless current_user
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -1,63 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
class SavedSearchesController < ApplicationController
|
3
|
-
include Blacklight::
|
4
|
-
|
5
|
-
copy_blacklight_config_from(CatalogController)
|
6
|
-
before_action :require_user_authentication_provider
|
7
|
-
before_action :verify_user
|
8
|
-
|
9
|
-
def index
|
10
|
-
@searches = current_user.searches
|
11
|
-
end
|
12
|
-
|
13
|
-
def save
|
14
|
-
current_user.searches << searches_from_history.find(params[:id])
|
15
|
-
if current_user.save
|
16
|
-
flash[:notice] = I18n.t('blacklight.saved_searches.add.success')
|
17
|
-
else
|
18
|
-
flash[:error] = I18n.t('blacklight.saved_searches.add.failure')
|
19
|
-
end
|
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
|
26
|
-
end
|
27
|
-
|
28
|
-
# Only dereferences the user rather than removing the item in case it
|
29
|
-
# is in the session[:history]
|
30
|
-
def forget
|
31
|
-
if search = current_user.searches.find(params[:id])
|
32
|
-
search.user_id = nil
|
33
|
-
search.save
|
34
|
-
|
35
|
-
flash[:notice] =I18n.t('blacklight.saved_searches.remove.success')
|
36
|
-
else
|
37
|
-
flash[:error] = I18n.t('blacklight.saved_searches.remove.failure')
|
38
|
-
end
|
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
|
45
|
-
end
|
46
|
-
|
47
|
-
# Only dereferences the user rather than removing the items in case they
|
48
|
-
# are in the session[:history]
|
49
|
-
def clear
|
50
|
-
if current_user.searches.update_all("user_id = NULL")
|
51
|
-
flash[:notice] = I18n.t('blacklight.saved_searches.clear.success')
|
52
|
-
else
|
53
|
-
flash[:error] = I18n.t('blacklight.saved_searches.clear.failure')
|
54
|
-
end
|
55
|
-
redirect_to blacklight.saved_searches_url
|
56
|
-
end
|
57
|
-
|
58
|
-
protected
|
59
|
-
|
60
|
-
def verify_user
|
61
|
-
flash[:notice] = I18n.t('blacklight.saved_searches.need_login') and raise Blacklight::Exceptions::AccessDenied unless current_user
|
62
|
-
end
|
3
|
+
include Blacklight::SavedSearches
|
63
4
|
end
|
@@ -10,13 +10,13 @@
|
|
10
10
|
<span class="icon-bar"></span>
|
11
11
|
</button>
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<h2 class='facets-heading'>
|
14
|
+
<%= t('blacklight.search.facets.title') %>
|
15
|
+
</h2>
|
16
|
+
</div>
|
17
17
|
|
18
18
|
<div id="facet-panel-collapse" class="collapse panel-group">
|
19
|
-
|
19
|
+
<%= render_facet_partials %>
|
20
|
+
</div>
|
20
21
|
</div>
|
21
|
-
|
22
|
-
<% end %>
|
22
|
+
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date: 2016-01-
|
20
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -310,6 +310,7 @@ files:
|
|
310
310
|
- app/controllers/concerns/blacklight/default_component_configuration.rb
|
311
311
|
- app/controllers/concerns/blacklight/facet.rb
|
312
312
|
- app/controllers/concerns/blacklight/request_builders.rb
|
313
|
+
- app/controllers/concerns/blacklight/saved_searches.rb
|
313
314
|
- app/controllers/concerns/blacklight/search_context.rb
|
314
315
|
- app/controllers/concerns/blacklight/search_fields.rb
|
315
316
|
- app/controllers/concerns/blacklight/search_helper.rb
|