blacklight 7.30.0 → 7.32.0
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 +4 -4
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_header.scss +4 -7
- data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +2 -0
- data/app/components/blacklight/constraint_component.html.erb +1 -1
- data/app/components/blacklight/document/action_component.html.erb +1 -1
- data/app/components/blacklight/icons/icon_component.rb +14 -2
- data/app/components/blacklight/search_bar_component.html.erb +6 -7
- data/app/components/blacklight/search_bar_component.rb +6 -1
- data/app/components/blacklight/search_button_component.rb +17 -0
- data/app/helpers/blacklight/component_helper_behavior.rb +10 -12
- data/app/helpers/blacklight/icon_helper_behavior.rb +5 -3
- data/app/models/concerns/blacklight/document.rb +7 -0
- data/app/models/search_builder.rb +5 -0
- data/app/presenters/blacklight/clause_presenter.rb +4 -0
- data/app/presenters/blacklight/document_presenter.rb +5 -0
- data/app/presenters/blacklight/facet_item_presenter.rb +8 -0
- data/app/views/catalog/_search_results.html.erb +1 -2
- data/app/views/catalog/_search_results_header.html.erb +1 -0
- data/blacklight.gemspec +1 -1
- data/lib/blacklight/component.rb +20 -0
- data/lib/blacklight.rb +6 -6
- data/lib/generators/blacklight/assets_generator.rb +9 -3
- data/lib/generators/blacklight/templates/catalog_controller.rb +2 -0
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +1 -1
- data/lib/generators/blacklight/templates/solr_document.rb +2 -0
- data/package.json +0 -1
- data/spec/components/blacklight/search_bar_component_spec.rb +82 -0
- data/spec/helpers/blacklight/icon_helper_behavior_spec.rb +8 -3
- data/spec/helpers/catalog_helper_spec.rb +1 -1
- data/spec/models/blacklight/suggest_search_spec.rb +1 -1
- data/spec/models/solr_document_spec.rb +11 -0
- data/spec/presenters/blacklight/document_presenter_spec.rb +6 -0
- data/spec/presenters/blacklight/facet_item_presenter_spec.rb +7 -0
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17b8b14189b4ced9faa60d183fa887eb6962dba4d55f3718fee11ff4bed59388
|
4
|
+
data.tar.gz: dd1f5ea853080c0732313b3ab64de8d310634786cfbcfe5ddde6691bc2137820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d481b3b290ca1030fcc593fad5ef8fdbe3e5a42091c4138af3efaaa58b45322f32d8e4956e6d92d01d305e762d4e2a3886f9caa193ba4197920d18d989184308
|
7
|
+
data.tar.gz: f6010fc1c00b31fddce8d2e73794655dbe3c1c690e65bedace78c693a4c36a884f5ac0589681717e3852bf9e1ff41109a7d5de2c2d4957e835c59afd53cfcfcb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.32.0
|
@@ -12,19 +12,16 @@
|
|
12
12
|
.navbar-logo { /* The main logo image for the Blacklight instance */
|
13
13
|
@if $logo-image {
|
14
14
|
background: transparent $logo-image no-repeat top left;
|
15
|
+
background-size: $logo-width $logo-height;
|
15
16
|
}
|
16
|
-
|
17
17
|
display: inline-block;
|
18
|
-
|
19
|
-
|
20
|
-
margin-right:20px;
|
18
|
+
height: $logo-height;
|
19
|
+
margin-right: 20px;
|
21
20
|
margin-top: -0.4rem;
|
22
21
|
overflow: hidden;
|
23
|
-
padding-left: 0;
|
24
|
-
padding-right: 0;
|
25
22
|
text-indent: 100%;
|
26
23
|
white-space: nowrap;
|
27
|
-
width:
|
24
|
+
width: $logo-width;
|
28
25
|
}
|
29
26
|
|
30
27
|
.navbar-search {
|
@@ -1,6 +1,8 @@
|
|
1
1
|
/* Warning! If you want to change these, just copy them into your own theme css. But you want to remove the !default, which only will set them if not already set. */
|
2
2
|
|
3
3
|
$logo-image: image_url('blacklight/logo.png') !default;
|
4
|
+
$logo-width: 150px !default;
|
5
|
+
$logo-height: 50px !default;
|
4
6
|
|
5
7
|
/* label (field names) */
|
6
8
|
$field_name_color: $text-muted !default;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= render(@layout.new(
|
2
2
|
classes: (Array(@classes) + ["filter-#{@facet_item_presenter.key.parameterize}"]).join(' '),
|
3
3
|
label: @facet_item_presenter.field_label,
|
4
|
-
value: @facet_item_presenter.
|
4
|
+
value: @facet_item_presenter.constraint_label,
|
5
5
|
remove_path: @facet_item_presenter.remove_href)) %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
url,
|
4
4
|
id: @id,
|
5
5
|
class: @link_classes,
|
6
|
-
data: {}.merge(({ blacklight_modal: "trigger" } if @action.modal != false) || {}) %>
|
6
|
+
data: {}.merge(({ blacklight_modal: "trigger", turbo: false } if @action.modal != false) || {}) %>
|
7
7
|
<% else %>
|
8
8
|
<%= helpers.render(partial: @action.partial || @action.name.to_s, locals: { document: @document, document_action_config: @action }.merge(@options)) %>
|
9
9
|
<% end %>
|
@@ -6,15 +6,27 @@ module Blacklight
|
|
6
6
|
# You can override the default svg by setting:
|
7
7
|
# Blacklight::Icons::ListComponent.svg = '<svg>your SVG here</svg>'
|
8
8
|
class IconComponent < ::ViewComponent::Base
|
9
|
-
|
9
|
+
# rubocop:disable Metrics/ParameterLists
|
10
|
+
def initialize(svg: nil, tag: :span, name: nil, label: nil, aria_hidden: nil, classes: nil, **options)
|
10
11
|
self.svg = svg if svg
|
12
|
+
@classes = Array(classes) + ['blacklight-icons', "blacklight-icons-#{name}"]
|
13
|
+
@name = name
|
14
|
+
@tag = tag
|
15
|
+
@options = options.merge(aria: options.fetch(:aria, {}).reverse_merge(label: label, hidden: aria_hidden))
|
11
16
|
end
|
17
|
+
# rubocop:enable Metrics/ParameterLists
|
12
18
|
|
13
19
|
def call
|
14
|
-
svg&.html_safe # rubocop:disable Rails/OutputSafety
|
20
|
+
tag.public_send(@tag, svg&.html_safe, # rubocop:disable Rails/OutputSafety
|
21
|
+
class: @classes,
|
22
|
+
**@options)
|
15
23
|
end
|
16
24
|
|
17
25
|
class_attribute :svg
|
26
|
+
|
27
|
+
def name
|
28
|
+
@name ||= self.class.name.demodulize.underscore.sub('_component', '')
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
20
32
|
end
|
@@ -1,8 +1,11 @@
|
|
1
|
-
<%= form_tag @url, method: @method, class: @classes.join(' '), role: 'search',
|
1
|
+
<%= form_tag @url, method: @method, class: @classes.join(' '), role: 'search', aria: { label: scoped_t('submit') }, **@form_options do %>
|
2
2
|
<%= render_hash_as_hidden_fields(@params) %>
|
3
3
|
<% if search_fields.length > 1 %>
|
4
4
|
<label for="search_field" class="sr-only visually-hidden"><%= scoped_t('search_field.label') %></label>
|
5
5
|
<% end %>
|
6
|
+
<% before_input_groups.each do |input_group| %>
|
7
|
+
<%= input_group %>
|
8
|
+
<% end %>
|
6
9
|
<div class="input-group">
|
7
10
|
<%= prepend %>
|
8
11
|
|
@@ -17,15 +20,11 @@
|
|
17
20
|
<% end %>
|
18
21
|
|
19
22
|
<label for="<%= @prefix %><%= @query_param %>" class="sr-only visually-hidden"><%= scoped_t('search.label') %></label>
|
20
|
-
<%= text_field_tag @query_param, @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", id: "#{@prefix}q", autocomplete: autocomplete_path.present? ? "off" : "", autofocus: @autofocus, data: { autocomplete_enabled: autocomplete_path.present?, autocomplete_path: autocomplete_path } %>
|
23
|
+
<%= text_field_tag @query_param, @q, placeholder: scoped_t('search.placeholder'), class: "search-q q form-control rounded-#{search_fields.length > 1 ? '0' : 'left'}", id: "#{@prefix}q", autocomplete: autocomplete_path.present? ? "off" : "", autofocus: @autofocus, aria: { label: scoped_t('search.label') }, data: { autocomplete_enabled: autocomplete_path.present?, autocomplete_path: autocomplete_path } %>
|
21
24
|
|
22
25
|
<span class="input-group-append">
|
23
26
|
<%= append %>
|
24
|
-
|
25
|
-
<button type="submit" class="btn btn-primary search-btn" id="<%= @prefix %>search">
|
26
|
-
<span class="submit-search-text"><%= scoped_t('submit') %></span>
|
27
|
-
<%= blacklight_icon :search, aria_hidden: true %>
|
28
|
-
</button>
|
27
|
+
<%= search_button || render(Blacklight::SearchButtonComponent.new(id: "#{@prefix}search", text: scoped_t('submit'))) %>
|
29
28
|
</span>
|
30
29
|
</div>
|
31
30
|
<% end %>
|
@@ -6,6 +6,8 @@ module Blacklight
|
|
6
6
|
|
7
7
|
renders_one :append
|
8
8
|
renders_one :prepend
|
9
|
+
renders_one :search_button
|
10
|
+
renders_many :before_input_groups
|
9
11
|
|
10
12
|
# rubocop:disable Metrics/ParameterLists
|
11
13
|
def initialize(
|
@@ -14,7 +16,8 @@ module Blacklight
|
|
14
16
|
classes: ['search-query-form'], prefix: nil,
|
15
17
|
method: 'GET', q: nil, query_param: :q,
|
16
18
|
search_field: nil, search_fields: nil, autocomplete_path: nil,
|
17
|
-
autofocus: nil, i18n: { scope: 'blacklight.search.form' }
|
19
|
+
autofocus: nil, i18n: { scope: 'blacklight.search.form' },
|
20
|
+
form_options: {}
|
18
21
|
)
|
19
22
|
@url = url
|
20
23
|
@advanced_search_url = advanced_search_url
|
@@ -29,6 +32,8 @@ module Blacklight
|
|
29
32
|
@autofocus = autofocus
|
30
33
|
@search_fields = search_fields
|
31
34
|
@i18n = i18n
|
35
|
+
@form_options = form_options
|
36
|
+
|
32
37
|
return if presenter.nil?
|
33
38
|
|
34
39
|
Deprecation.warn(self, 'SearchBarComponent no longer uses a SearchBarPresenter, the presenter: param will be removed in 8.0. ' \
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Blacklight
|
4
|
+
class SearchButtonComponent < ::ViewComponent::Base
|
5
|
+
def initialize(text:, id:)
|
6
|
+
@text = text
|
7
|
+
@id = id
|
8
|
+
end
|
9
|
+
|
10
|
+
def call
|
11
|
+
tag.button(class: 'btn btn-primary search-btn', type: 'submit', id: @id) do
|
12
|
+
tag.span(@text, class: "submit-search-text") +
|
13
|
+
blacklight_icon(:search, aria_hidden: true)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -38,28 +38,26 @@ module Blacklight
|
|
38
38
|
# (normally renders next to title in the list view)
|
39
39
|
#
|
40
40
|
# @param [SolrDocument] document
|
41
|
-
# @param [
|
42
|
-
# @
|
41
|
+
# @param [String] wrapping_class ("index-document-functions")
|
42
|
+
# @param [Class] component (Blacklight::Document::ActionsComponent)
|
43
43
|
# @return [String]
|
44
|
-
def render_index_doc_actions(document,
|
45
|
-
actions = filter_partials(blacklight_config.view_config(document_index_view_type).document_actions, { document: document }
|
46
|
-
wrapping_class = options.delete(:wrapping_class) || "index-document-functions"
|
44
|
+
def render_index_doc_actions(document, wrapping_class: "index-document-functions", component: Blacklight::Document::ActionsComponent)
|
45
|
+
actions = filter_partials(blacklight_config.view_config(document_index_view_type).document_actions, { document: document }).map { |_k, v| v }
|
47
46
|
|
48
|
-
render(
|
47
|
+
render(component.new(document: document, actions: actions, classes: wrapping_class))
|
49
48
|
end
|
50
49
|
|
51
50
|
##
|
52
51
|
# Render "collection actions" area for search results view
|
53
52
|
# (normally renders next to pagination at the top of the result set)
|
54
53
|
#
|
55
|
-
# @param [
|
56
|
-
# @
|
54
|
+
# @param [String] wrapping_class ("search-widgets")
|
55
|
+
# @param [Class] component (Blacklight::Document::ActionsComponent)
|
57
56
|
# @return [String]
|
58
|
-
def render_results_collection_tools(
|
59
|
-
actions = filter_partials(blacklight_config.view_config(document_index_view_type).collection_actions,
|
60
|
-
wrapping_class = options.delete(:wrapping_class) || "search-widgets"
|
57
|
+
def render_results_collection_tools(wrapping_class: "search-widgets", component: Blacklight::Document::ActionsComponent)
|
58
|
+
actions = filter_partials(blacklight_config.view_config(document_index_view_type).collection_actions, {}).map { |_k, v| v }
|
61
59
|
|
62
|
-
render(
|
60
|
+
render(component.new(actions: actions, classes: wrapping_class))
|
63
61
|
end
|
64
62
|
|
65
63
|
##
|
@@ -9,9 +9,11 @@ module Blacklight::IconHelperBehavior
|
|
9
9
|
# the svg everytime.
|
10
10
|
# @param [String, Symbol] icon_name
|
11
11
|
# @return [String]
|
12
|
-
def blacklight_icon(icon_name,
|
13
|
-
|
14
|
-
|
12
|
+
def blacklight_icon(icon_name, **kwargs)
|
13
|
+
render "Blacklight::Icons::#{icon_name.to_s.camelize}Component".constantize.new(**kwargs)
|
14
|
+
rescue NameError
|
15
|
+
Rails.cache.fetch([:blacklight_icons, icon_name, kwargs]) do
|
16
|
+
icon = Blacklight::Icon.new(icon_name, **kwargs)
|
15
17
|
tag.span(icon.svg.html_safe, **icon.options)
|
16
18
|
end
|
17
19
|
end
|
@@ -26,6 +26,8 @@ module Blacklight::Document
|
|
26
26
|
extend ActiveModel::Naming
|
27
27
|
include Blacklight::Document::Extensions
|
28
28
|
include GlobalID::Identification
|
29
|
+
|
30
|
+
class_attribute :inspector_fields, default: [:_source]
|
29
31
|
end
|
30
32
|
|
31
33
|
attr_reader :response, :_source
|
@@ -82,6 +84,11 @@ module Blacklight::Document
|
|
82
84
|
Array(self[key]).first
|
83
85
|
end
|
84
86
|
|
87
|
+
def inspect
|
88
|
+
fields = inspector_fields.map { |field| "#{field}: #{public_send(field)}" }.join(", ")
|
89
|
+
"#<#{self.class.name}:#{object_id} #{fields}>"
|
90
|
+
end
|
91
|
+
|
85
92
|
def to_partial_path
|
86
93
|
'catalog/document'
|
87
94
|
end
|
@@ -66,6 +66,14 @@ module Blacklight
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
# Get the displayable version of the facet's value for use
|
70
|
+
# in e.g. the constraints widget
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
def constraint_label
|
74
|
+
label
|
75
|
+
end
|
76
|
+
|
69
77
|
def value
|
70
78
|
if facet_item.respond_to? :value
|
71
79
|
facet_item.value
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1 class="sr-only visually-hidden top-content-title"><%= t('blacklight.search.header') %></h1>
|
data/blacklight.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_dependency "deprecation"
|
33
33
|
s.add_dependency "i18n", '>= 1.7.0' # added named parameters
|
34
34
|
s.add_dependency "ostruct", '>= 0.3.2'
|
35
|
-
s.add_dependency "view_component", '~> 2.
|
35
|
+
s.add_dependency "view_component", '~> 2.66'
|
36
36
|
s.add_dependency 'hashdiff'
|
37
37
|
|
38
38
|
s.add_development_dependency "rsolr", ">= 1.0.6", "< 3" # Library for interacting with rSolr.
|
data/lib/blacklight/component.rb
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
module Blacklight
|
4
4
|
class Component < ViewComponent::Base
|
5
5
|
class << self
|
6
|
+
# Workaround for https://github.com/ViewComponent/view_component/issues/1565
|
7
|
+
def config
|
8
|
+
@config ||= ViewComponent::Config.defaults.merge(ViewComponent::Base.config)
|
9
|
+
end
|
10
|
+
|
6
11
|
# rubocop:disable Naming/MemoizedInstanceVariableName
|
7
12
|
def compiler
|
8
13
|
@__vc_compiler ||= EngineCompiler.new(self)
|
@@ -12,6 +17,21 @@ module Blacklight
|
|
12
17
|
alias sidecar_files _sidecar_files unless ViewComponent::Base.respond_to? :sidecar_files
|
13
18
|
end
|
14
19
|
|
20
|
+
EXCLUDE_VARIABLES = [
|
21
|
+
:@lookup_context, :@view_renderer, :@view_flow, :@view_context,
|
22
|
+
:@tag_builder, :@current_template,
|
23
|
+
:@__vc_set_slots, :@__vc_original_view_context,
|
24
|
+
:@__vc_variant, :@__vc_content_evaluated,
|
25
|
+
:@__vc_render_in_block, :@__vc_content, :@__vc_helpers
|
26
|
+
].freeze
|
27
|
+
|
28
|
+
def inspect
|
29
|
+
# Exclude variables added by render_in
|
30
|
+
render_variables = instance_variables - EXCLUDE_VARIABLES
|
31
|
+
fields = render_variables.map { |ivar| "#{ivar}:#{instance_variable_get(ivar).inspect}" }.join(', ')
|
32
|
+
"#<#{self.class.name}:#{object_id} #{fields}>"
|
33
|
+
end
|
34
|
+
|
15
35
|
class EngineCompiler < ::ViewComponent::Compiler
|
16
36
|
# ViewComponent::Compiler locates and caches templates from sidecar files to the component source file.
|
17
37
|
# While this is sensible in a Rails application, it prevents component templates defined in an Engine
|
data/lib/blacklight.rb
CHANGED
@@ -60,11 +60,7 @@ module Blacklight
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def self.connection_config
|
63
|
-
Blacklight::RuntimeRegistry.connection_config ||=
|
64
|
-
raise "The #{::Rails.env} environment settings were not found in the blacklight.yml config" unless blacklight_yml[::Rails.env]
|
65
|
-
|
66
|
-
blacklight_yml[::Rails.env].symbolize_keys
|
67
|
-
end
|
63
|
+
Blacklight::RuntimeRegistry.connection_config ||= blacklight_yml[::Rails.env]&.symbolize_keys if blacklight_yml?
|
68
64
|
end
|
69
65
|
|
70
66
|
def self.connection_config=(value)
|
@@ -86,7 +82,7 @@ module Blacklight
|
|
86
82
|
require 'yaml'
|
87
83
|
|
88
84
|
return @blacklight_yml if @blacklight_yml
|
89
|
-
unless
|
85
|
+
unless blacklight_yml?
|
90
86
|
raise "You are missing a configuration file: #{blacklight_config_file}. Have you run \"rails generate blacklight:install\"?"
|
91
87
|
end
|
92
88
|
|
@@ -113,6 +109,10 @@ module Blacklight
|
|
113
109
|
@blacklight_yml
|
114
110
|
end
|
115
111
|
|
112
|
+
def self.blacklight_yml?
|
113
|
+
File.exist?(blacklight_config_file)
|
114
|
+
end
|
115
|
+
|
116
116
|
def self.logger
|
117
117
|
@logger ||= begin
|
118
118
|
::Rails.logger if defined? Rails && Rails.respond_to?(:logger)
|
@@ -15,8 +15,6 @@ module Blacklight
|
|
15
15
|
return unless Rails.version > '7'
|
16
16
|
|
17
17
|
gem "sassc-rails", "~> 2.1"
|
18
|
-
|
19
|
-
remove_file 'app/javascript/application.js'
|
20
18
|
end
|
21
19
|
|
22
20
|
# Add sprockets javascript if needed
|
@@ -37,7 +35,7 @@ module Blacklight
|
|
37
35
|
# Remove the empty generated app/assets/images directory. Without doing this,
|
38
36
|
# the default Sprockets 4 manifest will raise an exception.
|
39
37
|
def appease_sprockets4
|
40
|
-
return if !defined?(Sprockets::VERSION) || Sprockets::VERSION < '4'
|
38
|
+
return if !defined?(Sprockets::VERSION) || Sprockets::VERSION < '4' || using_importmap?
|
41
39
|
|
42
40
|
append_to_file 'app/assets/config/manifest.js', "\n//= link application.js"
|
43
41
|
empty_directory 'app/assets/images'
|
@@ -74,6 +72,14 @@ module Blacklight
|
|
74
72
|
|
75
73
|
private
|
76
74
|
|
75
|
+
def root
|
76
|
+
@root ||= Pathname(destination_root)
|
77
|
+
end
|
78
|
+
|
79
|
+
def using_importmap?
|
80
|
+
@using_importmap ||= root.join('config/importmap.rb').exist?
|
81
|
+
end
|
82
|
+
|
77
83
|
def turbolinks?
|
78
84
|
@turbolinks ||= application_js.include?('turbolinks')
|
79
85
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
</updateHandler>
|
18
18
|
|
19
19
|
<!-- solr lib dirs -->
|
20
|
-
<lib dir="${solr.install.dir:../../../..}/
|
20
|
+
<lib dir="${solr.install.dir:../../../..}/modules/analysis-extras/lib" />
|
21
21
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
|
22
22
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
|
23
23
|
|
data/package.json
CHANGED
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe Blacklight::SearchBarComponent, type: :component do
|
6
|
+
let(:instance) { described_class.new(url: search_action_url, params: params_for_search) }
|
7
|
+
|
8
|
+
let(:search_action_url) { '/catalog' }
|
9
|
+
let(:params_for_search) { { q: 'testParamValue' } }
|
10
|
+
let(:blacklight_config) do
|
11
|
+
Blacklight::Configuration.new.configure do |config|
|
12
|
+
config.view = { list: nil, abc: nil }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
before do
|
17
|
+
allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'with the default button' do
|
21
|
+
subject(:render) { render_inline(instance) }
|
22
|
+
|
23
|
+
it 'renders the search field and a button' do
|
24
|
+
expect(render.css("input[aria-label='#{I18n.t('blacklight.search.form.search.label')}']")).to be_present
|
25
|
+
expect(render.css("button#search")).to be_present
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'when a button is passed in' do
|
30
|
+
subject(:render) do
|
31
|
+
render_inline(instance) do |c|
|
32
|
+
c.search_button do
|
33
|
+
controller.view_context.tag.button "hello", id: 'custom_search'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'renders the search field and a button' do
|
39
|
+
expect(render.css("input[aria-label='#{I18n.t('blacklight.search.form.search.label')}']")).to be_present
|
40
|
+
expect(render.css("button#search")).not_to be_present
|
41
|
+
expect(render.css("button#custom_search")).to be_present
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with prepend' do
|
46
|
+
subject(:render) do
|
47
|
+
render_inline(instance) do |c|
|
48
|
+
c.with_prepend { 'stuff before' }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'renders the prepended value' do
|
53
|
+
expect(render.to_html).to include 'stuff before'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'with append' do
|
58
|
+
subject(:render) do
|
59
|
+
render_inline(instance) do |c|
|
60
|
+
c.with_append { 'stuff after' }
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'renders the appended value' do
|
65
|
+
expect(render.to_html).to include 'stuff after'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context 'with extra inputs' do
|
70
|
+
subject(:render) do
|
71
|
+
render_inline(instance) do |c|
|
72
|
+
c.with_before_input_group { controller.view_context.tag.input name: 'foo' }
|
73
|
+
c.with_before_input_group { controller.view_context.tag.input name: 'bar' }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'renders the extra inputs' do
|
78
|
+
expect(render.css("input[name='foo']")).to be_present
|
79
|
+
expect(render.css("input[name='bar']")).to be_present
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -2,9 +2,14 @@
|
|
2
2
|
|
3
3
|
RSpec.describe Blacklight::IconHelperBehavior do
|
4
4
|
describe '#blacklight_icon' do
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
subject(:icon) { helper.blacklight_icon(:search, classes: 'custom-class') }
|
6
|
+
|
7
|
+
it 'returns the svg' do
|
8
|
+
expect(icon).to have_css '.blacklight-icons svg'
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'adds classes to the wrappering element' do
|
12
|
+
expect(icon).to have_css '.custom-class svg'
|
8
13
|
end
|
9
14
|
end
|
10
15
|
end
|
@@ -243,7 +243,7 @@ RSpec.describe CatalogHelper do
|
|
243
243
|
end
|
244
244
|
|
245
245
|
it "calls thumbnail presenter with provided values" do
|
246
|
-
expect(thumbnail_presenter).to receive(:thumbnail_tag).with({}, suppress_link: true)
|
246
|
+
expect(thumbnail_presenter).to receive(:thumbnail_tag).with({}, { suppress_link: true })
|
247
247
|
helper.render_thumbnail_tag document, {}, suppress_link: true
|
248
248
|
end
|
249
249
|
end
|
@@ -8,7 +8,7 @@ RSpec.describe Blacklight::SuggestSearch, api: true do
|
|
8
8
|
|
9
9
|
describe '#suggestions' do
|
10
10
|
it 'delegates to the repository' do
|
11
|
-
expect(repository).to receive(:suggestions).with(q: 'test').and_return(response)
|
11
|
+
expect(repository).to receive(:suggestions).with({ q: 'test' }).and_return(response)
|
12
12
|
expect(suggest_search.suggestions).to eq response
|
13
13
|
end
|
14
14
|
end
|
@@ -29,6 +29,17 @@ RSpec.describe SolrDocument, api: true do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
describe '.inspect' do
|
33
|
+
subject(:inspect) { document.inspect }
|
34
|
+
|
35
|
+
let(:document) do
|
36
|
+
described_class.new(id: '123',
|
37
|
+
title_tesim: ['Good Omens'])
|
38
|
+
end
|
39
|
+
|
40
|
+
it { is_expected.to end_with "_source: {\"id\"=>\"123\", \"title_tesim\"=>[\"Good Omens\"]}>" }
|
41
|
+
end
|
42
|
+
|
32
43
|
describe '.attribute' do
|
33
44
|
subject(:title) { document.title }
|
34
45
|
|
@@ -60,4 +60,10 @@ RSpec.describe Blacklight::DocumentPresenter do
|
|
60
60
|
expect(presenter.thumbnail).to be_a_kind_of custom_presenter_class
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
describe '#inspect' do
|
65
|
+
subject(:inspect) { presenter.inspect }
|
66
|
+
|
67
|
+
it { is_expected.to start_with '#<Blacklight::DocumentPresenter:' }
|
68
|
+
end
|
63
69
|
end
|
@@ -55,6 +55,13 @@ RSpec.describe Blacklight::FacetItemPresenter, type: :presenter do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
describe '#constraint_label' do
|
59
|
+
it 'provides the label for the constraint' do
|
60
|
+
allow(facet_config).to receive_messages(query: nil, date: nil, helper_method: nil, url_method: nil)
|
61
|
+
expect(presenter.constraint_label).to eq presenter.label
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
58
65
|
describe '#href' do
|
59
66
|
before do
|
60
67
|
allow(search_state).to receive(:has_facet?).and_return(false)
|
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: 7.
|
4
|
+
version: 7.32.0
|
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: 2022-
|
20
|
+
date: 2022-11-16 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -129,14 +129,14 @@ dependencies:
|
|
129
129
|
requirements:
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: '2.
|
132
|
+
version: '2.66'
|
133
133
|
type: :runtime
|
134
134
|
prerelease: false
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - "~>"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: '2.
|
139
|
+
version: '2.66'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
141
|
name: hashdiff
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
@@ -489,6 +489,7 @@ files:
|
|
489
489
|
- app/components/blacklight/response/view_type_component.rb
|
490
490
|
- app/components/blacklight/search_bar_component.html.erb
|
491
491
|
- app/components/blacklight/search_bar_component.rb
|
492
|
+
- app/components/blacklight/search_button_component.rb
|
492
493
|
- app/components/blacklight/search_context_component.html.erb
|
493
494
|
- app/components/blacklight/search_context_component.rb
|
494
495
|
- app/components/blacklight/search_history_constraint_layout_component.rb
|
@@ -555,6 +556,7 @@ files:
|
|
555
556
|
- app/models/concerns/blacklight/user.rb
|
556
557
|
- app/models/record_mailer.rb
|
557
558
|
- app/models/search.rb
|
559
|
+
- app/models/search_builder.rb
|
558
560
|
- app/models/solr_document.rb
|
559
561
|
- app/presenters/blacklight/clause_presenter.rb
|
560
562
|
- app/presenters/blacklight/document_presenter.rb
|
@@ -620,6 +622,7 @@ files:
|
|
620
622
|
- app/views/catalog/_search_form.html.erb
|
621
623
|
- app/views/catalog/_search_header.html.erb
|
622
624
|
- app/views/catalog/_search_results.html.erb
|
625
|
+
- app/views/catalog/_search_results_header.html.erb
|
623
626
|
- app/views/catalog/_search_sidebar.html.erb
|
624
627
|
- app/views/catalog/_show.html.erb
|
625
628
|
- app/views/catalog/_show_header.html.erb
|
@@ -790,6 +793,7 @@ files:
|
|
790
793
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
791
794
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
792
795
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
796
|
+
- spec/components/blacklight/search_bar_component_spec.rb
|
793
797
|
- spec/components/blacklight/start_over_button_component_spec.rb
|
794
798
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
795
799
|
- spec/controllers/alternate_controller_spec.rb
|
@@ -950,7 +954,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
950
954
|
- !ruby/object:Gem::Version
|
951
955
|
version: '0'
|
952
956
|
requirements: []
|
953
|
-
rubygems_version: 3.
|
957
|
+
rubygems_version: 3.3.7
|
954
958
|
signing_key:
|
955
959
|
specification_version: 4
|
956
960
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
@@ -971,6 +975,7 @@ test_files:
|
|
971
975
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
972
976
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
973
977
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
978
|
+
- spec/components/blacklight/search_bar_component_spec.rb
|
974
979
|
- spec/components/blacklight/start_over_button_component_spec.rb
|
975
980
|
- spec/components/blacklight/system/flash_message_component_spec.rb
|
976
981
|
- spec/controllers/alternate_controller_spec.rb
|