blacklight 6.5.0 → 6.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +114 -213
- data/{.solr_wrapper → .solr_wrapper.yml} +0 -0
- data/.yardopts +3 -1
- data/Gemfile +0 -3
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/Vagrantfile +0 -2
- data/app/controllers/bookmarks_controller.rb +0 -2
- data/app/controllers/catalog_controller.rb +0 -2
- data/app/controllers/concerns/blacklight/base.rb +0 -1
- data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
- data/app/controllers/concerns/blacklight/catalog.rb +7 -11
- data/app/controllers/concerns/blacklight/controller.rb +11 -7
- data/app/controllers/concerns/blacklight/default_component_configuration.rb +24 -37
- data/app/controllers/concerns/blacklight/facet.rb +2 -11
- data/app/controllers/concerns/blacklight/request_builders.rb +1 -3
- data/app/controllers/concerns/blacklight/search_context.rb +0 -1
- data/app/controllers/concerns/blacklight/search_fields.rb +2 -2
- data/app/controllers/concerns/blacklight/search_helper.rb +14 -24
- data/app/controllers/concerns/blacklight/token_based_user.rb +0 -2
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +27 -28
- data/app/helpers/blacklight/catalog_helper_behavior.rb +15 -15
- data/app/helpers/blacklight/component_helper_behavior.rb +2 -5
- data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -3
- data/app/helpers/blacklight/deprecated_url_helper_behavior.rb +1 -3
- data/app/helpers/blacklight/facets_helper_behavior.rb +21 -25
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +1 -2
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +8 -9
- data/app/helpers/blacklight/render_partials_helper.rb +14 -13
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +1 -4
- data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
- data/app/models/blacklight/facet_paginator.rb +2 -2
- data/app/models/concerns/blacklight/document.rb +1 -6
- data/app/models/concerns/blacklight/document/active_model_shim.rb +0 -1
- data/app/models/concerns/blacklight/document/cache_key.rb +3 -3
- data/app/models/concerns/blacklight/document/dublin_core.rb +0 -1
- data/app/models/concerns/blacklight/document/email.rb +0 -2
- data/app/models/concerns/blacklight/document/export.rb +1 -2
- data/app/models/concerns/blacklight/document/schema_org.rb +0 -2
- data/app/models/concerns/blacklight/document/sms.rb +0 -2
- data/app/models/concerns/blacklight/solr/document.rb +0 -1
- data/app/models/record_mailer.rb +0 -1
- data/app/models/solr_document.rb +0 -2
- data/app/presenters/blacklight/document_presenter.rb +14 -11
- data/app/presenters/blacklight/index_presenter.rb +5 -5
- data/app/presenters/blacklight/json_presenter.rb +0 -1
- data/app/presenters/blacklight/rendering/abstract_step.rb +0 -1
- data/app/presenters/blacklight/rendering/helper_method.rb +5 -5
- data/app/presenters/blacklight/rendering/link_to_facet.rb +1 -1
- data/app/presenters/blacklight/show_presenter.rb +4 -5
- data/app/services/blacklight/field_retriever.rb +8 -9
- data/app/views/catalog/_facet_limit.html.erb +1 -1
- data/blacklight.gemspec +4 -0
- data/lib/blacklight.rb +2 -2
- data/lib/blacklight/abstract_repository.rb +4 -3
- data/lib/blacklight/configuration.rb +57 -92
- data/lib/blacklight/configuration/context.rb +3 -3
- data/lib/blacklight/configuration/fields.rb +24 -7
- data/lib/blacklight/exceptions.rb +0 -2
- data/lib/blacklight/parameters.rb +1 -1
- data/lib/blacklight/search_builder.rb +92 -96
- data/lib/blacklight/search_state.rb +2 -1
- data/lib/blacklight/solr/repository.rb +3 -4
- data/lib/blacklight/solr/request.rb +0 -2
- data/lib/blacklight/solr/response/facets.rb +23 -28
- data/lib/blacklight/solr/response/group.rb +0 -1
- data/lib/blacklight/solr/response/group_response.rb +1 -5
- data/lib/blacklight/solr/response/pagination_methods.rb +0 -1
- data/lib/blacklight/solr/response/response.rb +1 -1
- data/lib/blacklight/solr/response/spelling.rb +0 -4
- data/lib/blacklight/solr/search_builder_behavior.rb +29 -41
- data/lib/blacklight/utils.rb +10 -7
- data/lib/generators/blacklight/assets_generator.rb +0 -1
- data/lib/generators/blacklight/document_generator.rb +0 -1
- data/lib/generators/blacklight/install_generator.rb +2 -6
- data/lib/generators/blacklight/models_generator.rb +0 -3
- data/lib/generators/blacklight/search_builder_generator.rb +0 -1
- data/lib/generators/blacklight/solr4_generator.rb +0 -2
- data/lib/generators/blacklight/solr5_generator.rb +15 -1
- data/lib/generators/blacklight/test_support_generator.rb +0 -1
- data/lib/railties/blacklight.rake +3 -3
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +1 -4
- data/spec/controllers/blacklight/search_helper_spec.rb +5 -7
- data/spec/controllers/blacklight/suggest_search_spec.rb +2 -2
- data/spec/controllers/bookmarks_controller_spec.rb +2 -2
- data/spec/controllers/catalog_controller_spec.rb +6 -6
- data/spec/features/search_context_spec.rb +4 -5
- data/spec/features/search_formats_spec.rb +0 -6
- data/spec/helpers/blacklight_helper_spec.rb +7 -7
- data/spec/helpers/catalog_helper_spec.rb +10 -10
- data/spec/helpers/configuration_helper_spec.rb +3 -3
- data/spec/helpers/facets_helper_spec.rb +1 -2
- data/spec/helpers/render_constraints_helper_spec.rb +8 -0
- data/spec/integration/generators/blacklight/solr5_generator_spec.rb +60 -0
- data/spec/models/blacklight/document_spec.rb +1 -1
- data/spec/models/blacklight/search_builder_spec.rb +5 -4
- data/spec/models/blacklight/solr/search_builder_spec.rb +12 -18
- data/spec/presenters/pipeline_spec.rb +1 -1
- data/spec/spec_helper.rb +43 -0
- data/spec/views/catalog/_index_header_default.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +2 -2
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +1 -1
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +3 -3
- data/spec/views/catalog/index.html.erb_spec.rb +1 -1
- data/spec/views/catalog/index.json.jbuilder_spec.rb +2 -2
- data/tasks/blacklight.rake +3 -0
- metadata +61 -3
@@ -10,12 +10,11 @@
|
|
10
10
|
# This is used to serialize a complete current query from current params
|
11
11
|
# to form fields used for sort and change per-page
|
12
12
|
module Blacklight::HashAsHiddenFieldsHelperBehavior
|
13
|
-
|
14
13
|
##
|
15
14
|
# Writes out zero or more <input type="hidden"> elements, completely
|
16
15
|
# representing a hash passed in using Rails-style request parameters
|
17
16
|
# for hashes nested with arrays and other hashes.
|
18
|
-
# @param [Hash]
|
17
|
+
# @param [Hash] hash
|
19
18
|
# @return [String]
|
20
19
|
def render_hash_as_hidden_fields(hash)
|
21
20
|
|
@@ -6,11 +6,10 @@
|
|
6
6
|
# Includes methods for rendering contraints graphically on the
|
7
7
|
# search results page (render_constraints(_*))
|
8
8
|
module Blacklight::RenderConstraintsHelperBehavior
|
9
|
-
|
10
9
|
##
|
11
10
|
# Check if the query has any constraints defined (a query, facet, etc)
|
12
11
|
#
|
13
|
-
# @param [Hash] query parameters
|
12
|
+
# @param [Hash] localized_params query parameters
|
14
13
|
# @return [Boolean]
|
15
14
|
def query_has_constraints?(localized_params = params)
|
16
15
|
!(localized_params[:q].blank? and localized_params[:f].blank?)
|
@@ -20,7 +19,7 @@ module Blacklight::RenderConstraintsHelperBehavior
|
|
20
19
|
# Render the actual constraints, not including header or footer
|
21
20
|
# info.
|
22
21
|
#
|
23
|
-
# @param [Hash] query parameters
|
22
|
+
# @param [Hash] localized_params query parameters
|
24
23
|
# @return [String]
|
25
24
|
def render_constraints(localized_params = params)
|
26
25
|
render_constraints_query(localized_params) + render_constraints_filters(localized_params)
|
@@ -29,7 +28,7 @@ module Blacklight::RenderConstraintsHelperBehavior
|
|
29
28
|
##
|
30
29
|
# Render the query constraints
|
31
30
|
#
|
32
|
-
# @param [ActionController::Parameters] query parameters
|
31
|
+
# @param [ActionController::Parameters] localized_params query parameters
|
33
32
|
# @return [String]
|
34
33
|
def render_constraints_query(localized_params = params)
|
35
34
|
# So simple don't need a view template, we can just do it here.
|
@@ -84,12 +83,12 @@ module Blacklight::RenderConstraintsHelperBehavior
|
|
84
83
|
def render_filter_element(facet, values, path)
|
85
84
|
facet_config = facet_configuration_for_field(facet)
|
86
85
|
|
87
|
-
safe_join(values.map do |val|
|
86
|
+
safe_join(Array(values).map do |val|
|
88
87
|
next if val.blank? # skip empty string
|
89
|
-
render_constraint_element(
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
render_constraint_element(facet_field_label(facet_config.key),
|
89
|
+
facet_display_value(facet, val),
|
90
|
+
remove: search_action_path(path.remove_facet_params(facet, val)),
|
91
|
+
classes: ["filter", "filter-" + facet.parameterize])
|
93
92
|
end, "\n")
|
94
93
|
end
|
95
94
|
|
@@ -3,7 +3,7 @@ module Blacklight::RenderPartialsHelper
|
|
3
3
|
##
|
4
4
|
# Render the document index view
|
5
5
|
#
|
6
|
-
# @param [Array<SolrDocument>] list of documents to render
|
6
|
+
# @param [Array<SolrDocument>] documents list of documents to render
|
7
7
|
# @param [Hash] locals to pass to the render call
|
8
8
|
# @return [String]
|
9
9
|
def render_document_index documents = nil, locals = {}
|
@@ -19,9 +19,11 @@ module Blacklight::RenderPartialsHelper
|
|
19
19
|
|
20
20
|
##
|
21
21
|
# Return the list of partials for a given solr document
|
22
|
-
# @param [SolrDocument]
|
23
|
-
# @
|
24
|
-
|
22
|
+
# @param [SolrDocument] doc solr document to render partials for
|
23
|
+
# @param [Array<String>] partials list of partials to render
|
24
|
+
# @param [Hash] locals local variables to pass to the render call
|
25
|
+
# @return [String]
|
26
|
+
def render_document_partials(doc, partials = [], locals = {})
|
25
27
|
safe_join(partials.map do |action_name|
|
26
28
|
render_document_partial(doc, action_name, locals)
|
27
29
|
end, "\n")
|
@@ -37,8 +39,8 @@ module Blacklight::RenderPartialsHelper
|
|
37
39
|
# @see #document_partial_path_templates
|
38
40
|
#
|
39
41
|
# @param [SolrDocument] doc
|
40
|
-
# @param [String] base name for the partial
|
41
|
-
# @param [Hash]
|
42
|
+
# @param [String] base_name base name for the partial
|
43
|
+
# @param [Hash] locals local variables to pass through to the partials
|
42
44
|
def render_document_partial(doc, base_name, locals = {})
|
43
45
|
format = document_partial_name(doc, base_name)
|
44
46
|
|
@@ -63,7 +65,7 @@ module Blacklight::RenderPartialsHelper
|
|
63
65
|
# @see #document_index_path_templates
|
64
66
|
#
|
65
67
|
# @param [String] view type
|
66
|
-
# @param [Array<SolrDocument>] list of documents to render
|
68
|
+
# @param [Array<SolrDocument>] documents list of documents to render
|
67
69
|
# @param [Hash] locals to pass to the render call
|
68
70
|
# @return [String]
|
69
71
|
def render_document_index_with_view view, documents, locals = {}
|
@@ -94,8 +96,8 @@ module Blacklight::RenderPartialsHelper
|
|
94
96
|
]
|
95
97
|
end
|
96
98
|
|
97
|
-
|
98
99
|
protected
|
100
|
+
|
99
101
|
##
|
100
102
|
# Return a partial name for rendering a document
|
101
103
|
# this method can be overridden in order to transform the value
|
@@ -126,8 +128,8 @@ module Blacklight::RenderPartialsHelper
|
|
126
128
|
##
|
127
129
|
# Return a normalized partial name for rendering a single document
|
128
130
|
#
|
129
|
-
# @param [SolrDocument]
|
130
|
-
# @param [Symbol] base name for the partial
|
131
|
+
# @param [SolrDocument] document
|
132
|
+
# @param [Symbol] base_name base name for the partial
|
131
133
|
# @return [String]
|
132
134
|
def document_partial_name(document, base_name = nil)
|
133
135
|
view_config = blacklight_config.view_config(:show)
|
@@ -190,9 +192,8 @@ module Blacklight::RenderPartialsHelper
|
|
190
192
|
end
|
191
193
|
|
192
194
|
##
|
193
|
-
# @param
|
194
|
-
# @
|
195
|
-
# @block the block to evaluate if the cache misses
|
195
|
+
# @param key fetches or writes data to a cache, using the given key.
|
196
|
+
# @yield the block to evaluate (and cache) if there is a cache miss
|
196
197
|
def cached_view key
|
197
198
|
@view_cache ||= {}
|
198
199
|
if @view_cache.key?(key)
|
@@ -6,7 +6,6 @@
|
|
6
6
|
# Includes methods for rendering more textually on Search History page
|
7
7
|
# (render_search_to_s(_*))
|
8
8
|
module Blacklight::SearchHistoryConstraintsHelperBehavior
|
9
|
-
|
10
9
|
# Simpler textual version of constraints, used on Search History page.
|
11
10
|
# Theoretically can may be DRY'd up with results page render_constraints,
|
12
11
|
# maybe even using the very same HTML with different CSS?
|
@@ -35,8 +34,7 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
35
34
|
render_search_to_s_element(facet_field_label(facet_field),
|
36
35
|
safe_join(value_list.collect do |value|
|
37
36
|
render_filter_value(value, facet_field)
|
38
|
-
end, content_tag(:span, " #{t('blacklight.and')} ", :class =>'filterSeparator'))
|
39
|
-
)
|
37
|
+
end, content_tag(:span, " #{t('blacklight.and')} ", :class =>'filterSeparator')))
|
40
38
|
end, " \n ")
|
41
39
|
end
|
42
40
|
|
@@ -61,5 +59,4 @@ module Blacklight::SearchHistoryConstraintsHelperBehavior
|
|
61
59
|
display_value = facet_display_value(key, value) if key
|
62
60
|
content_tag(:span, h(display_value), :class => 'filterValue')
|
63
61
|
end
|
64
|
-
|
65
62
|
end
|
@@ -147,7 +147,7 @@ module Blacklight::UrlHelperBehavior
|
|
147
147
|
|
148
148
|
# Get url parameters to a search within a grouped result set
|
149
149
|
#
|
150
|
-
# @param [Blacklight::Solr::Response::Group]
|
150
|
+
# @param [Blacklight::Solr::Response::Group] group
|
151
151
|
# @return [Hash]
|
152
152
|
def add_group_facet_params_and_redirect group
|
153
153
|
search_state.add_facet_params_and_redirect(group.field, group.key)
|
@@ -23,7 +23,7 @@ module Blacklight
|
|
23
23
|
# all_facet_values is a list of facet value objects returned by solr,
|
24
24
|
# asking solr for n+1 facet values.
|
25
25
|
# options:
|
26
|
-
# :limit => number to display per page, or (default)
|
26
|
+
# :limit => number to display per page, or (default) ?. Nil means
|
27
27
|
# display all with no previous or next.
|
28
28
|
# :offset => current item offset, default 0
|
29
29
|
# :sort => 'count' or 'index', solr tokens for facet value sorting, default 'count'.
|
@@ -52,7 +52,7 @@ module Blacklight
|
|
52
52
|
|
53
53
|
def current_page
|
54
54
|
# A nil limit is unlimited, thus only one page.
|
55
|
-
if limit.nil? || limit
|
55
|
+
if limit.nil? || limit.zero? #check for divide by zero
|
56
56
|
1
|
57
57
|
else
|
58
58
|
@offset / limit + 1
|
@@ -88,9 +88,7 @@ module Blacklight::Document
|
|
88
88
|
end
|
89
89
|
alias has_field? has?
|
90
90
|
|
91
|
-
|
92
|
-
_source.key? k
|
93
|
-
end
|
91
|
+
delegate :key?, to: :_source
|
94
92
|
alias has_key? key?
|
95
93
|
|
96
94
|
def fetch key, *default
|
@@ -129,12 +127,10 @@ module Blacklight::Document
|
|
129
127
|
# Certain class-level methods needed for the document-specific
|
130
128
|
# extendability architecture
|
131
129
|
module ClassMethods
|
132
|
-
|
133
130
|
attr_writer :unique_key
|
134
131
|
def unique_key
|
135
132
|
@unique_key ||= 'id'
|
136
133
|
end
|
137
|
-
|
138
134
|
end
|
139
135
|
|
140
136
|
private
|
@@ -142,5 +138,4 @@ module Blacklight::Document
|
|
142
138
|
def _source_responds_to? *args
|
143
139
|
_source && self != _source && _source.respond_to?(*args)
|
144
140
|
end
|
145
|
-
|
146
141
|
end
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# types in search results like gallery and list)
|
8
8
|
module Blacklight::Document::CacheKey
|
9
9
|
def cache_key
|
10
|
-
|
11
|
-
when new_record?
|
10
|
+
if new_record?
|
12
11
|
"#{self.class.model_name.cache_key}/new"
|
13
|
-
|
12
|
+
elsif self.key? cache_version_key
|
13
|
+
cache_version_value = self[cache_version_key]
|
14
14
|
"#{self.class.model_name.cache_key}/#{id}-#{Array(cache_version_value).join}"
|
15
15
|
else
|
16
16
|
"#{self.class.model_name.cache_key}/#{id}"
|
@@ -3,7 +3,6 @@ require 'builder'
|
|
3
3
|
|
4
4
|
# This module provide Dublin Core export based on the document's semantic values
|
5
5
|
module Blacklight::Document::DublinCore
|
6
|
-
|
7
6
|
def self.extended(document)
|
8
7
|
# Register our exportable formats
|
9
8
|
Blacklight::Document::DublinCore.register_export_formats( document )
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This module provides the body of an email export based on the document's semantic values
|
3
3
|
module Blacklight::Document::Email
|
4
|
-
|
5
4
|
# Return a text string that will be the body of the email
|
6
5
|
def to_email_text
|
7
6
|
semantics = self.to_semantic_values
|
@@ -12,5 +11,4 @@ module Blacklight::Document::Email
|
|
12
11
|
body << I18n.t('blacklight.email.text.language', value: semantics[:language].join(" ")) unless semantics[:language].blank?
|
13
12
|
return body.join("\n") unless body.empty?
|
14
13
|
end
|
15
|
-
|
16
14
|
end
|
@@ -39,7 +39,6 @@
|
|
39
39
|
# end
|
40
40
|
#
|
41
41
|
module Blacklight::Document::Export
|
42
|
-
|
43
42
|
##
|
44
43
|
# Register exportable formats supported by the individual document.
|
45
44
|
# Usually called by an extension in it's self.extended method, to
|
@@ -66,7 +65,7 @@ module Blacklight::Document::Export
|
|
66
65
|
Mime::Type.register_alias(content_type, short_name)
|
67
66
|
end
|
68
67
|
|
69
|
-
export_formats[short_name] =
|
68
|
+
export_formats[short_name] = { content_type: content_type }
|
70
69
|
end
|
71
70
|
|
72
71
|
# Collects formats that this doc can export as.
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# This module provides the body of an email export based on the document's semantic values
|
3
3
|
module Blacklight::Document::Sms
|
4
|
-
|
5
4
|
# Return a text string that will be the body of the email
|
6
5
|
def to_sms_text
|
7
6
|
semantics = self.to_semantic_values
|
@@ -10,5 +9,4 @@ module Blacklight::Document::Sms
|
|
10
9
|
body << I18n.t('blacklight.sms.text.author', value: semantics[:author].first) unless semantics[:author].blank?
|
11
10
|
return body.join unless body.empty?
|
12
11
|
end
|
13
|
-
|
14
12
|
end
|
data/app/models/record_mailer.rb
CHANGED
data/app/models/solr_document.rb
CHANGED
@@ -18,7 +18,6 @@ module Blacklight
|
|
18
18
|
# Get the value of the document's "title" field, or a placeholder
|
19
19
|
# value (if empty)
|
20
20
|
#
|
21
|
-
# @param [SolrDocument] document
|
22
21
|
# @return [String]
|
23
22
|
# @deprecated use ShowPresenter#heading instead
|
24
23
|
def document_heading
|
@@ -30,7 +29,7 @@ module Blacklight
|
|
30
29
|
# Create <link rel="alternate"> links from a documents dynamically
|
31
30
|
# provided export formats. Returns empty string if no links available.
|
32
31
|
#
|
33
|
-
# @
|
32
|
+
# @param [Hash] options
|
34
33
|
# @option options [Boolean] :unique ensures only one link is output for every
|
35
34
|
# content type, e.g. as required by atom
|
36
35
|
# @option options [Array<String>] :exclude array of format shortnames to not include in the output
|
@@ -55,8 +54,9 @@ module Blacklight
|
|
55
54
|
##
|
56
55
|
# Render the document index heading
|
57
56
|
#
|
58
|
-
# @
|
59
|
-
#
|
57
|
+
# @overload render_document_index_label(field, opts)
|
58
|
+
# @param [Symbol, Proc, String] field Render the given field or evaluate the proc or render the given string
|
59
|
+
# @param [Hash] opts
|
60
60
|
# @deprecated use IndexPresenter#label instead
|
61
61
|
def render_document_index_label(*args)
|
62
62
|
index_presenter.label(*args)
|
@@ -68,9 +68,10 @@ module Blacklight
|
|
68
68
|
#
|
69
69
|
# Allow an extention point where information in the document
|
70
70
|
# may drive the value of the field
|
71
|
-
# @
|
72
|
-
#
|
73
|
-
#
|
71
|
+
# @overload render_index_field_value(field, opts)
|
72
|
+
# @param [String] field
|
73
|
+
# @param [Hash] opts
|
74
|
+
# @option opts [String] :value
|
74
75
|
# @deprecated use IndexPresenter#field_value instead
|
75
76
|
def render_index_field_value *args
|
76
77
|
index_presenter.field_value(*args)
|
@@ -82,9 +83,11 @@ module Blacklight
|
|
82
83
|
#
|
83
84
|
# Allow an extention point where information in the document
|
84
85
|
# may drive the value of the field
|
86
|
+
#
|
87
|
+
# @overload render_index_field_value(field, options)
|
85
88
|
# @param [String] field
|
86
89
|
# @param [Hash] options
|
87
|
-
# @options
|
90
|
+
# @option options [String] :value
|
88
91
|
# @deprecated use ShowPresenter#field_value
|
89
92
|
def render_document_show_field_value *args
|
90
93
|
show_presenter.field_value(*args)
|
@@ -100,8 +103,8 @@ module Blacklight
|
|
100
103
|
# Rendering:
|
101
104
|
# - helper_method
|
102
105
|
# - link_to_search
|
103
|
-
# @param [String]
|
104
|
-
# @param [Blacklight::Configuration::Field] solr field configuration
|
106
|
+
# @param [String] _field name
|
107
|
+
# @param [Blacklight::Configuration::Field] field_config solr field configuration
|
105
108
|
# @param [Hash] options additional options to pass to the rendering helpers
|
106
109
|
# @deprecated
|
107
110
|
def get_field_values _field, field_config, options = {}
|
@@ -118,7 +121,7 @@ module Blacklight
|
|
118
121
|
# Rendering:
|
119
122
|
# - helper_method
|
120
123
|
# - link_to_search
|
121
|
-
# @param [Blacklight::Configuration::Field] solr field configuration
|
124
|
+
# @param [Blacklight::Configuration::Field] field_config solr field configuration
|
122
125
|
# @param [Hash] options additional options to pass to the rendering helpers
|
123
126
|
def field_values(field_config, options={})
|
124
127
|
FieldPresenter.new(@controller, @document, field_config, options).render
|
@@ -7,7 +7,7 @@ module Blacklight
|
|
7
7
|
attr_reader :document, :configuration, :view_context
|
8
8
|
|
9
9
|
# @param [SolrDocument] document
|
10
|
-
# @param [ActionView::Base]
|
10
|
+
# @param [ActionView::Base] view_context scope for linking and generating urls
|
11
11
|
# @param [Blacklight::Configuration] configuration
|
12
12
|
def initialize(document, view_context, configuration = view_context.blacklight_config)
|
13
13
|
@document = document
|
@@ -18,7 +18,7 @@ module Blacklight
|
|
18
18
|
##
|
19
19
|
# Render the document index heading
|
20
20
|
#
|
21
|
-
# @param [Symbol, Proc, String]
|
21
|
+
# @param [Symbol, Proc, String] field_or_string_or_proc Render the given field or evaluate the proc or render the given string
|
22
22
|
# @param [Hash] opts
|
23
23
|
# TODO: the default field should be `document_show_link_field(doc)'
|
24
24
|
def label(field_or_string_or_proc, opts = {})
|
@@ -49,8 +49,8 @@ module Blacklight
|
|
49
49
|
# Allow an extention point where information in the document
|
50
50
|
# may drive the value of the field
|
51
51
|
# @param [String] field
|
52
|
-
# @param [Hash]
|
53
|
-
# @options
|
52
|
+
# @param [Hash] options
|
53
|
+
# @option options [String] :value
|
54
54
|
def field_value field, options = {}
|
55
55
|
field_config = field_config(field)
|
56
56
|
field_values(field_config, options)
|
@@ -91,7 +91,7 @@ module Blacklight
|
|
91
91
|
# Rendering:
|
92
92
|
# - helper_method
|
93
93
|
# - link_to_search
|
94
|
-
# @param [Blacklight::Configuration::Field] solr field configuration
|
94
|
+
# @param [Blacklight::Configuration::Field] field_config solr field configuration
|
95
95
|
# @param [Hash] options additional options to pass to the rendering helpers
|
96
96
|
def field_values(field_config, options={})
|
97
97
|
FieldPresenter.new(view_context, document, field_config, options).render
|