blacklight-spotlight 0.28.1 → 0.28.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e57863575f59657b4c10cac8c1d0541df9d4f595
|
|
4
|
+
data.tar.gz: ff5822ee18aa552633c2bd7c996fab0fba2e0693
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22cfb2f247035b11964b73429b82bd41210a21b737b6fe07311c357a30766b8a7de9d9c4d8cdce0fb86db9de3559691788b65fcc38ea7db392b3bad6be1d9bd6
|
|
7
|
+
data.tar.gz: 37b65199e3a1f61ef96f2f6fb6f08a74d1d6dbdf110e79fca2bcaf845ab3661eb646d5dd040d347764d10a15ab063af66af4f3b44c1b7b9c20b01a53932f6fbf
|
|
@@ -5,26 +5,39 @@ module Spotlight
|
|
|
5
5
|
class BrowseController < Spotlight::ApplicationController
|
|
6
6
|
load_and_authorize_resource :exhibit, class: 'Spotlight::Exhibit'
|
|
7
7
|
include Spotlight::Base
|
|
8
|
+
include Blacklight::Facet
|
|
8
9
|
|
|
9
10
|
load_and_authorize_resource :search, except: :index, through: :exhibit, parent: false
|
|
10
11
|
before_action :attach_breadcrumbs
|
|
12
|
+
before_action :attach_search_breadcrumb, only: :show
|
|
11
13
|
record_search_parameters only: :show
|
|
12
14
|
|
|
13
15
|
helper_method :should_render_spotlight_search_bar?
|
|
14
16
|
|
|
17
|
+
before_action :swap_actions_configuration, only: :show
|
|
18
|
+
|
|
15
19
|
def index
|
|
16
20
|
@searches = @exhibit.searches.published
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
def show
|
|
20
|
-
|
|
24
|
+
@response, @document_list = search_results(search_query)
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
respond_to do |format|
|
|
27
|
+
format.html
|
|
28
|
+
format.json do
|
|
29
|
+
@presenter = Blacklight::JsonPresenter.new(@response, @document_list, facets_from_request, blacklight_config)
|
|
30
|
+
render template: 'catalog/index'
|
|
31
|
+
end
|
|
32
|
+
end
|
|
24
33
|
end
|
|
25
34
|
|
|
26
35
|
protected
|
|
27
36
|
|
|
37
|
+
def swap_actions_configuration
|
|
38
|
+
blacklight_config.index.document_actions = blacklight_config.browse.document_actions
|
|
39
|
+
end
|
|
40
|
+
|
|
28
41
|
def search_query
|
|
29
42
|
@search.merge_params_for_search(params, blacklight_config)
|
|
30
43
|
end
|
|
@@ -46,6 +59,10 @@ module Spotlight
|
|
|
46
59
|
add_breadcrumb(@exhibit.main_navigations.browse.label_or_default, exhibit_browse_index_path(@exhibit))
|
|
47
60
|
end
|
|
48
61
|
|
|
62
|
+
def attach_search_breadcrumb
|
|
63
|
+
add_breadcrumb @search.title, exhibit_browse_path(@exhibit, @search)
|
|
64
|
+
end
|
|
65
|
+
|
|
49
66
|
def _prefixes
|
|
50
67
|
@_prefixes ||= super + ['catalog']
|
|
51
68
|
end
|
|
@@ -6,7 +6,13 @@ module Spotlight
|
|
|
6
6
|
# Override the default #sir_trevor_markdown so we can use
|
|
7
7
|
# a more complete markdown rendered
|
|
8
8
|
def sir_trevor_markdown(text)
|
|
9
|
-
|
|
9
|
+
clean_text = if text
|
|
10
|
+
text.gsub('<br>', "\n").gsub('<p>', '').gsub('</p>', "\n\n")
|
|
11
|
+
else
|
|
12
|
+
''
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
GitHub::Markup.render('.md', clean_text).html_safe
|
|
10
16
|
end
|
|
11
17
|
|
|
12
18
|
def available_index_fields
|
data/lib/spotlight/version.rb
CHANGED
|
@@ -36,7 +36,7 @@ describe Spotlight::BrowseController, type: :controller do
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
describe 'GET show' do
|
|
39
|
-
let(:mock_response) { double }
|
|
39
|
+
let(:mock_response) { double aggregations: {} }
|
|
40
40
|
let(:document_list) { double }
|
|
41
41
|
before do
|
|
42
42
|
allow(controller).to receive_messages(search_results: [mock_response, document_list])
|
|
@@ -68,6 +68,12 @@ describe Spotlight::BrowseController, type: :controller do
|
|
|
68
68
|
get :show, params: { id: search, exhibit_id: exhibit }
|
|
69
69
|
expect(controller.blacklight_config.index.document_actions).to match_array [:a, :b, :c]
|
|
70
70
|
end
|
|
71
|
+
|
|
72
|
+
it 'has a json response' do
|
|
73
|
+
get :show, params: { id: search, exhibit_id: exhibit, format: :json }
|
|
74
|
+
expect(assigns[:presenter]).to be_a Blacklight::JsonPresenter
|
|
75
|
+
expect(response).to render_template 'catalog/index'
|
|
76
|
+
end
|
|
71
77
|
end
|
|
72
78
|
end
|
|
73
79
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blacklight-spotlight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.28.
|
|
4
|
+
version: 0.28.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Beer
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2016-08-
|
|
14
|
+
date: 2016-08-22 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rails
|