blacklight 5.9.4 → 5.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +11 -10
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +14 -14
- data/app/helpers/blacklight/configuration_helper_behavior.rb +16 -10
- data/app/helpers/blacklight/facets_helper_behavior.rb +15 -14
- data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
- data/app/models/bookmark.rb +1 -4
- data/app/models/search.rb +3 -6
- data/app/views/catalog/_facet_layout.html.erb +2 -2
- data/app/views/catalog/_facet_limit.html.erb +5 -3
- data/app/views/catalog/_facet_pivot.html.erb +4 -4
- data/app/views/catalog/_home_text.html.erb +8 -48
- data/app/views/catalog/_index_default.html.erb +3 -3
- data/app/views/catalog/_show_default.html.erb +3 -3
- data/app/views/catalog/_sms_form.html.erb +1 -1
- data/app/views/catalog/facet.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/config/jetty.yml +0 -3
- data/config/locales/blacklight.de.yml +2 -0
- data/config/locales/blacklight.en.yml +2 -0
- data/config/locales/blacklight.es.yml +2 -0
- data/config/locales/blacklight.fr.yml +2 -0
- data/config/locales/blacklight.pt-BR.yml +2 -0
- data/lib/blacklight.rb +70 -26
- data/lib/blacklight/abstract_repository.rb +29 -0
- data/lib/blacklight/base.rb +7 -7
- data/lib/blacklight/bookmarks.rb +5 -5
- data/lib/blacklight/catalog.rb +34 -19
- data/lib/blacklight/catalog/search_context.rb +1 -1
- data/lib/blacklight/configuration.rb +112 -46
- data/lib/blacklight/configuration/facet_field.rb +9 -7
- data/lib/blacklight/configuration/field.rb +27 -0
- data/lib/blacklight/configuration/fields.rb +25 -20
- data/lib/blacklight/configuration/search_field.rb +6 -8
- data/lib/blacklight/configuration/solr_field.rb +3 -18
- data/lib/blacklight/configuration/sort_field.rb +6 -7
- data/lib/blacklight/document.rb +156 -0
- data/lib/blacklight/document/dublin_core.rb +41 -0
- data/lib/blacklight/document/email.rb +16 -0
- data/lib/blacklight/document/export.rb +107 -0
- data/lib/blacklight/document/extensions.rb +56 -0
- data/lib/blacklight/document/schema_org.rb +7 -0
- data/lib/blacklight/document/semantic_fields.rb +51 -0
- data/lib/blacklight/document/sms.rb +14 -0
- data/lib/blacklight/document_presenter.rb +3 -3
- data/lib/blacklight/exceptions.rb +9 -2
- data/lib/blacklight/facet.rb +21 -16
- data/lib/blacklight/request_builders.rb +60 -284
- data/lib/blacklight/routes.rb +1 -1
- data/lib/blacklight/search_builder.rb +130 -0
- data/lib/blacklight/search_helper.rb +316 -0
- data/lib/blacklight/solr.rb +1 -0
- data/lib/blacklight/solr/document.rb +4 -187
- data/lib/blacklight/solr/document/dublin_core.rb +3 -37
- data/lib/blacklight/solr/document/email.rb +4 -13
- data/lib/blacklight/solr/document/export.rb +3 -103
- data/lib/blacklight/solr/document/extensions.rb +4 -52
- data/lib/blacklight/solr/document/more_like_this.rb +1 -1
- data/lib/blacklight/solr/document/schema_org.rb +4 -4
- data/lib/blacklight/solr/document/sms.rb +4 -11
- data/lib/blacklight/solr/facet_paginator.rb +2 -2
- data/lib/blacklight/solr/search_builder.rb +264 -0
- data/lib/blacklight/solr_helper.rb +6 -261
- data/lib/blacklight/solr_repository.rb +30 -24
- data/lib/blacklight/solr_response.rb +3 -3
- data/lib/blacklight/user.rb +1 -2
- data/lib/blacklight/utils.rb +0 -23
- data/lib/generators/blacklight/controller_generator.rb +38 -0
- data/lib/generators/blacklight/document_generator.rb +20 -0
- data/lib/generators/blacklight/install_generator.rb +38 -39
- data/lib/generators/blacklight/models_generator.rb +2 -62
- data/lib/generators/blacklight/templates/catalog_controller.rb +3 -4
- data/lib/generators/blacklight/templates/config/{solr.yml → blacklight.yml} +3 -0
- data/lib/generators/blacklight/templates/config/jetty.yml +0 -3
- data/lib/generators/blacklight/templates/solr_document.rb +6 -6
- data/lib/generators/blacklight/test_support_generator.rb +1 -6
- data/lib/generators/blacklight/user_generator.rb +59 -0
- data/lib/railties/blacklight.rake +16 -7
- data/spec/controllers/catalog_controller_spec.rb +9 -15
- data/spec/features/facets_spec.rb +8 -0
- data/spec/helpers/configuration_helper_spec.rb +6 -13
- data/spec/helpers/facets_helper_spec.rb +3 -2
- data/spec/lib/blacklight/configuration_spec.rb +11 -38
- data/spec/lib/blacklight/{solr/document → document}/dublin_core_spec.rb +4 -4
- data/spec/lib/blacklight/{solr/document → document}/email_spec.rb +2 -2
- data/spec/lib/blacklight/{solr/document → document}/sms_spec.rb +2 -2
- data/spec/lib/blacklight/search_builder_spec.rb +145 -0
- data/spec/lib/blacklight/search_helper_spec.rb +775 -0
- data/spec/lib/blacklight/solr/document/more_like_this_spec.rb +1 -1
- data/spec/lib/blacklight/solr/search_builder_spec.rb +561 -0
- data/spec/lib/blacklight/solr_helper_spec.rb +5 -1291
- data/spec/lib/blacklight/solr_repository_spec.rb +13 -13
- data/spec/models/record_mailer_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +2 -2
- data/spec/views/catalog/index.atom.builder_spec.rb +1 -1
- data/tasks/blacklight.rake +1 -1
- data/template.demo.rb +1 -1
- metadata +33 -45
- data/doc/Adding-new-document-actions.md +0 -94
- data/doc/Atom-Responses.md +0 -90
- data/doc/Blacklight-Add-ons.md +0 -23
- data/doc/Blacklight-configuration.md +0 -411
- data/doc/Blacklight-on-Heroku.md +0 -100
- data/doc/Blacklight-out-of-the-box.md +0 -47
- data/doc/Bookmarks.md +0 -1
- data/doc/Code4Lib-2014.md +0 -94
- data/doc/Configuration---Facet-Fields.md +0 -130
- data/doc/Configuration---Results-View.md +0 -224
- data/doc/Configuration---Solr-fields.md +0 -106
- data/doc/Configuring-and-Customizing-Blacklight.md +0 -257
- data/doc/Configuring-rails-routes.md +0 -13
- data/doc/Contributing-to-Blacklight.md +0 -43
- data/doc/Examples.md +0 -120
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
- data/doc/Home.md +0 -100
- data/doc/How-to-release-a-version.md +0 -45
- data/doc/Indexing-your-data-into-solr.md +0 -36
- data/doc/Internationalization.md +0 -32
- data/doc/JSON-API.md +0 -83
- data/doc/Pagination.md +0 -52
- data/doc/Providing-your-own-view-templates.md +0 -69
- data/doc/Quickstart.md +0 -153
- data/doc/README_SOLR.md +0 -245
- data/doc/Saved-Searches.md +0 -5
- data/doc/Solr-Configuration.md +0 -154
- data/doc/Sunspot-for-indexing.md +0 -46
- data/doc/Support.md +0 -33
- data/doc/Theming.md +0 -62
- data/doc/Understanding-Rails-and-Blacklight.md +0 -75
- data/doc/User-Authentication.md +0 -60
- data/doc/_Sidebar.md +0 -9
- data/doc/testing.md +0 -58
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9591ba5deb7fc58aa9ec580987953fa4b4128ee
|
4
|
+
data.tar.gz: 10a20662083c88de9da4e5f8fb3a515f91293235
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71cf3a717e8ac74e50db3851409f9f1229b1758f9da2c14b73509fe1fd3d7201ab5a39a7d2040a3b5e413df267c0fe5e0936a3642629e38d54e5873e861f92d5
|
7
|
+
data.tar.gz: b99e720d7d5a1975d7ab819a4e4c2af533891c372f2df3e6d63113a541f796b8091604340dcfa287fef6116954688b9c2ba87ca9b11860f08c12723b83a4c91a
|
data/Gemfile
CHANGED
@@ -9,7 +9,7 @@ gem 'simplecov', '~> 0.7.1', require: false
|
|
9
9
|
gem 'coveralls', require: false
|
10
10
|
|
11
11
|
group :test do
|
12
|
-
gem "blacklight-marc", "5.
|
12
|
+
gem "blacklight-marc", "~> 5.0", github: "projectblacklight/blacklight_marc"
|
13
13
|
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
14
14
|
end
|
15
15
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.10.0
|
@@ -46,20 +46,21 @@
|
|
46
46
|
@extend .text-success;
|
47
47
|
}
|
48
48
|
|
49
|
-
|
50
|
-
@extend .text-muted;
|
51
|
-
text-indent: $padding-base-horizontal;
|
49
|
+
}
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
51
|
+
.remove {
|
52
|
+
@extend .text-muted;
|
53
|
+
text-indent: $padding-base-horizontal;
|
57
54
|
|
58
|
-
|
59
|
-
|
60
|
-
|
55
|
+
.glyphicon {
|
56
|
+
top: 0.1em;
|
57
|
+
vertical-align: text-top;
|
58
|
+
}
|
61
59
|
|
60
|
+
&:hover {
|
61
|
+
color: $brand-danger;
|
62
62
|
}
|
63
|
+
|
63
64
|
}
|
64
65
|
|
65
66
|
@mixin hyphens-auto {
|
@@ -97,27 +97,27 @@ module Blacklight::BlacklightHelperBehavior
|
|
97
97
|
# Determine whether to render a given field in the index view.
|
98
98
|
#
|
99
99
|
# @param [SolrDocument] document
|
100
|
-
# @param [Blacklight::Solr::Configuration::
|
100
|
+
# @param [Blacklight::Solr::Configuration::Field] field_config
|
101
101
|
# @return [Boolean]
|
102
|
-
def should_render_index_field? document,
|
103
|
-
should_render_field?(
|
102
|
+
def should_render_index_field? document, field_config
|
103
|
+
should_render_field?(field_config, document) && document_has_value?(document, field_config)
|
104
104
|
end
|
105
105
|
|
106
106
|
##
|
107
107
|
# Determine whether to render a given field in the show view
|
108
108
|
#
|
109
109
|
# @param [SolrDocument] document
|
110
|
-
# @param [Blacklight::Solr::Configuration::
|
110
|
+
# @param [Blacklight::Solr::Configuration::Field] field_config
|
111
111
|
# @return [Boolean]
|
112
|
-
def should_render_show_field? document,
|
113
|
-
should_render_field?(
|
112
|
+
def should_render_show_field? document, field_config
|
113
|
+
should_render_field?(field_config, document) && document_has_value?(document, field_config)
|
114
114
|
end
|
115
115
|
|
116
116
|
##
|
117
117
|
# Check if a document has (or, might have, in the case of accessor methods) a value for
|
118
118
|
# the given solr field
|
119
119
|
# @param [SolrDocument] document
|
120
|
-
# @param [Blacklight::Solr::Configuration::
|
120
|
+
# @param [Blacklight::Solr::Configuration::Field] field_config
|
121
121
|
# @return [Boolean]
|
122
122
|
def document_has_value? document, field_config
|
123
123
|
document.has?(field_config.field) ||
|
@@ -272,7 +272,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
272
272
|
# @options options [Symbol] :tag
|
273
273
|
def render_document_heading(*args)
|
274
274
|
options = args.extract_options!
|
275
|
-
if args.first.is_a? blacklight_config.
|
275
|
+
if args.first.is_a? blacklight_config.document_model
|
276
276
|
document = args.shift
|
277
277
|
tag = options[:tag]
|
278
278
|
else
|
@@ -298,7 +298,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
298
298
|
# simplified by pushing some of this logic into the "model"
|
299
299
|
# @param [SolrDocument] document
|
300
300
|
# @param [String] field name
|
301
|
-
# @param [Blacklight::Solr::Configuration::
|
301
|
+
# @param [Blacklight::Solr::Configuration::Field] solr field configuration
|
302
302
|
# @param [Hash] options additional options to pass to the rendering helpers
|
303
303
|
def get_field_values document, field, field_config, options = {}
|
304
304
|
presenter(document).get_field_values field, field_config, options
|
@@ -309,10 +309,9 @@ module Blacklight::BlacklightHelperBehavior
|
|
309
309
|
#
|
310
310
|
# @deprecated Use DocumentPresenter instead
|
311
311
|
# @param [String] value or list of values to display
|
312
|
-
# @param [Blacklight::Solr::Configuration::
|
312
|
+
# @param [Blacklight::Solr::Configuration::Field] solr field configuration
|
313
313
|
# @return [String]
|
314
314
|
def render_field_value value=nil, field_config=nil
|
315
|
-
Deprecation.warn self, "render_field_value is deprecated. Use DocumentPresenter.render_field_value instead"
|
316
315
|
safe_values = Array(value).collect { |x| x.respond_to?(:force_encoding) ? x.force_encoding("UTF-8") : x }
|
317
316
|
|
318
317
|
if field_config and field_config.itemprop
|
@@ -321,15 +320,16 @@ module Blacklight::BlacklightHelperBehavior
|
|
321
320
|
|
322
321
|
safe_join(safe_values, (field_config.separator if field_config) || field_value_separator)
|
323
322
|
end
|
323
|
+
deprecation_deprecate render_field_value: "use DocumentPresenter.render_field_value instead"
|
324
324
|
|
325
325
|
##
|
326
326
|
# Default separator to use in #render_field_value
|
327
327
|
#
|
328
328
|
# @return [String]
|
329
329
|
def field_value_separator
|
330
|
-
Deprecation.warn self, "field_value_separator is deprecated. Use DocumentPresenter.field_value_separator instead"
|
331
330
|
', '
|
332
331
|
end
|
332
|
+
deprecation_deprecate field_value_separator: "use DocumentPresenter.field_value_separator instead"
|
333
333
|
|
334
334
|
##
|
335
335
|
# Get the current "view type" (and ensure it is a valid type)
|
@@ -356,13 +356,13 @@ module Blacklight::BlacklightHelperBehavior
|
|
356
356
|
# @option opts [String] :label Render the given string
|
357
357
|
# @param [Symbol, Proc, String] field Render the given field or evaluate the proc or render the given string
|
358
358
|
def render_document_index_label doc, field, opts = {}
|
359
|
-
Deprecation.warn self, "render_document_index_label is deprecated"
|
360
359
|
if field.kind_of? Hash
|
361
360
|
Deprecation.warn self, "Calling render_document_index_label with a hash is deprecated"
|
362
361
|
field = field[:label]
|
363
362
|
end
|
364
363
|
presenter(doc).render_document_index_label field, opts
|
365
364
|
end
|
365
|
+
deprecation_deprecate render_document_index_label: "use presenter(doc).render_document_index_label instead"
|
366
366
|
|
367
367
|
##
|
368
368
|
# Render a partial of an arbitrary format inside a
|
@@ -409,7 +409,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
409
409
|
##
|
410
410
|
# Override this method if you want to use a different presenter class
|
411
411
|
def presenter_class
|
412
|
-
blacklight_config.document_presenter_class
|
412
|
+
blacklight_config.document_presenter_class
|
413
413
|
end
|
414
414
|
|
415
415
|
##
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Blacklight::ConfigurationHelperBehavior
|
2
|
+
extend Deprecation
|
3
|
+
self.deprecation_horizon = 'blacklight 6.0'
|
2
4
|
|
3
5
|
##
|
4
6
|
# Index fields to display for a type of document
|
5
7
|
#
|
6
8
|
# @param [SolrDocument] document
|
7
|
-
# @return [Array<Blacklight::Solr::Configuration::
|
9
|
+
# @return [Array<Blacklight::Solr::Configuration::Field>]
|
8
10
|
def index_fields document=nil
|
9
11
|
blacklight_config.index_fields
|
10
12
|
end
|
@@ -60,7 +62,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
60
62
|
def index_field_label document, field
|
61
63
|
field_config = index_fields(document)[field]
|
62
64
|
|
63
|
-
|
65
|
+
field_label(
|
64
66
|
:"blacklight.search.fields.index.#{field}",
|
65
67
|
:"blacklight.search.fields.#{field}",
|
66
68
|
(field_config.label if field_config),
|
@@ -73,7 +75,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
73
75
|
def document_show_field_label document, field
|
74
76
|
field_config = document_show_fields(document)[field]
|
75
77
|
|
76
|
-
|
78
|
+
field_label(
|
77
79
|
:"blacklight.search.fields.show.#{field}",
|
78
80
|
:"blacklight.search.fields.#{field}",
|
79
81
|
(field_config.label if field_config),
|
@@ -85,11 +87,13 @@ module Blacklight::ConfigurationHelperBehavior
|
|
85
87
|
# Look up the label for the facet field
|
86
88
|
def facet_field_label field
|
87
89
|
field_config = blacklight_config.facet_fields[field]
|
88
|
-
defaults = [:"blacklight.search.fields.facet.#{field}", :"blacklight.search.fields.#{field}"]
|
89
|
-
defaults << field_config.label if field_config
|
90
|
-
defaults << field.to_s.humanize
|
91
90
|
|
92
|
-
|
91
|
+
field_label(
|
92
|
+
:"blacklight.search.fields.facet.#{field}",
|
93
|
+
:"blacklight.search.fields.#{field}",
|
94
|
+
(field_config.label if field_config),
|
95
|
+
field.to_s.humanize
|
96
|
+
)
|
93
97
|
end
|
94
98
|
|
95
99
|
##
|
@@ -104,11 +108,13 @@ module Blacklight::ConfigurationHelperBehavior
|
|
104
108
|
# before falling back to the label
|
105
109
|
# @param [Symbol] any number of additional keys
|
106
110
|
# @param [Symbol] ...
|
107
|
-
def
|
108
|
-
first, *rest = i18n_keys
|
111
|
+
def field_label *i18n_keys
|
112
|
+
first, *rest = i18n_keys
|
109
113
|
|
110
114
|
t(first, default: rest)
|
111
115
|
end
|
116
|
+
alias_method :solr_field_label, :field_label
|
117
|
+
deprecation_deprecate solr_field_label: :field_label
|
112
118
|
|
113
119
|
def document_index_views
|
114
120
|
blacklight_config.view.select do |k, config|
|
@@ -169,7 +175,7 @@ module Blacklight::ConfigurationHelperBehavior
|
|
169
175
|
##
|
170
176
|
# Determine whether to render a field by evaluating :if and :unless conditions
|
171
177
|
#
|
172
|
-
# @param [Blacklight::Solr::Configuration::
|
178
|
+
# @param [Blacklight::Solr::Configuration::Field] field_config
|
173
179
|
# @return [Boolean]
|
174
180
|
def should_render_field? field_config, *args
|
175
181
|
evaluate_if_unless_configuration field_config, *args
|
@@ -43,7 +43,8 @@ module Blacklight::FacetsHelperBehavior
|
|
43
43
|
options[:partial] ||= facet_partial_name(display_facet)
|
44
44
|
options[:layout] ||= "facet_layout" unless options.has_key?(:layout)
|
45
45
|
options[:locals] ||= {}
|
46
|
-
options[:locals][:
|
46
|
+
options[:locals][:field_name] ||= display_facet.name
|
47
|
+
options[:locals][:solr_field] ||= display_facet.name # deprecated
|
47
48
|
options[:locals][:facet_field] ||= facet_configuration_for_field(display_facet.name)
|
48
49
|
options[:locals][:display_facet] ||= display_facet
|
49
50
|
|
@@ -54,20 +55,20 @@ module Blacklight::FacetsHelperBehavior
|
|
54
55
|
# Renders the list of values
|
55
56
|
# removes any elements where render_facet_item returns a nil value. This enables an application
|
56
57
|
# to filter undesireable facet items so they don't appear in the UI
|
57
|
-
def render_facet_limit_list(paginator,
|
58
|
+
def render_facet_limit_list(paginator, facet_field, wrapping_element=:li)
|
58
59
|
safe_join(paginator.items.
|
59
|
-
map { |item| render_facet_item(
|
60
|
+
map { |item| render_facet_item(facet_field, item) }.compact.
|
60
61
|
map { |item| content_tag(wrapping_element,item)}
|
61
62
|
)
|
62
63
|
end
|
63
64
|
|
64
65
|
##
|
65
66
|
# Renders a single facet item
|
66
|
-
def render_facet_item(
|
67
|
-
if facet_in_params?(
|
68
|
-
render_selected_facet_value(
|
67
|
+
def render_facet_item(facet_field, item)
|
68
|
+
if facet_in_params?(facet_field, item.value )
|
69
|
+
render_selected_facet_value(facet_field, item)
|
69
70
|
else
|
70
|
-
render_facet_value(
|
71
|
+
render_facet_value(facet_field, item)
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
@@ -121,21 +122,21 @@ module Blacklight::FacetsHelperBehavior
|
|
121
122
|
# @param [Hash] options
|
122
123
|
# @option options [Boolean] :suppress_link display the facet, but don't link to it
|
123
124
|
# @return [String]
|
124
|
-
def render_facet_value(
|
125
|
-
path = search_action_path(add_facet_params_and_redirect(
|
125
|
+
def render_facet_value(facet_field, item, options ={})
|
126
|
+
path = search_action_path(add_facet_params_and_redirect(facet_field, item))
|
126
127
|
content_tag(:span, :class => "facet-label") do
|
127
|
-
link_to_unless(options[:suppress_link], facet_display_value(
|
128
|
+
link_to_unless(options[:suppress_link], facet_display_value(facet_field, item), path, :class=>"facet_select")
|
128
129
|
end + render_facet_count(item.hits)
|
129
130
|
end
|
130
131
|
|
131
132
|
##
|
132
133
|
# Standard display of a SELECTED facet value (e.g. without a link and with a remove button)
|
133
134
|
# @params (see #render_facet_value)
|
134
|
-
def render_selected_facet_value(
|
135
|
+
def render_selected_facet_value(facet_field, item)
|
135
136
|
content_tag(:span, :class => "facet-label") do
|
136
|
-
content_tag(:span, facet_display_value(
|
137
|
+
content_tag(:span, facet_display_value(facet_field, item), :class => "selected") +
|
137
138
|
# remove link
|
138
|
-
link_to(content_tag(:span, '', :class => "glyphicon glyphicon-remove") + content_tag(:span, '[remove]', :class => 'sr-only'), search_action_path(remove_facet_params(
|
139
|
+
link_to(content_tag(:span, '', :class => "glyphicon glyphicon-remove") + content_tag(:span, '[remove]', :class => 'sr-only'), search_action_path(remove_facet_params(facet_field, item, params)), :class=>"remove")
|
139
140
|
end + render_facet_count(item.hits, :classes => ["selected"])
|
140
141
|
end
|
141
142
|
|
@@ -208,7 +209,7 @@ module Blacklight::FacetsHelperBehavior
|
|
208
209
|
end
|
209
210
|
|
210
211
|
def facet_field_id facet_field
|
211
|
-
"facet-#{facet_field.
|
212
|
+
"facet-#{facet_field.key.parameterize}"
|
212
213
|
end
|
213
214
|
|
214
215
|
private
|
@@ -68,7 +68,7 @@ module Blacklight::UrlHelperBehavior
|
|
68
68
|
def search_session_params counter
|
69
69
|
{ :'data-counter' => counter, :'data-search_id' => current_search_session.try(:id) }
|
70
70
|
end
|
71
|
-
deprecation_deprecate :
|
71
|
+
deprecation_deprecate search_session_params: :session_tracking_params
|
72
72
|
|
73
73
|
##
|
74
74
|
# Attributes for a link that gives a URL we can use to track clicks for the current search session
|
data/app/models/bookmark.rb
CHANGED
@@ -5,10 +5,7 @@ class Bookmark < ActiveRecord::Base
|
|
5
5
|
belongs_to :document, polymorphic: true
|
6
6
|
|
7
7
|
validates_presence_of :user_id, :scope=>:document_id
|
8
|
-
|
9
|
-
if Blacklight::Utils.needs_attr_accessible?
|
10
|
-
attr_accessible :id, :document_id, :document_type, :title
|
11
|
-
end
|
8
|
+
attr_accessible :id, :document_id, :document_type, :title if Rails::VERSION::MAJOR < 4
|
12
9
|
|
13
10
|
def document
|
14
11
|
document_type.new document_type.unique_key => document_id
|
data/app/models/search.rb
CHANGED
@@ -5,13 +5,10 @@ class Search < ActiveRecord::Base
|
|
5
5
|
|
6
6
|
serialize :query_params
|
7
7
|
|
8
|
-
if
|
8
|
+
if Rails::VERSION::MAJOR < 4
|
9
9
|
attr_accessible :query_params
|
10
|
-
|
11
|
-
|
12
|
-
unless respond_to?(:none)
|
13
|
-
# polyfill
|
14
|
-
scope :none, where(id: nil).where("id IS NOT ?", nil)
|
10
|
+
|
11
|
+
scope :none, where(:id => nil).where("id IS NOT ?", nil)
|
15
12
|
end
|
16
13
|
|
17
14
|
# A Search instance is considered a saved search if it has a user_id.
|
@@ -1,7 +1,7 @@
|
|
1
|
-
<div class="panel panel-default facet_limit blacklight-<%= facet_field.
|
1
|
+
<div class="panel panel-default facet_limit blacklight-<%= facet_field.key.parameterize %> <%= 'facet_limit-active' if facet_field_in_params?(facet_field.key) %>">
|
2
2
|
<div class="<%= "collapsed" if should_collapse_facet?(facet_field) %> collapse-toggle panel-heading" data-toggle="collapse" data-target="#<%= facet_field_id(facet_field) %>">
|
3
3
|
<h5 class="panel-title">
|
4
|
-
<%= link_to facet_field_label(facet_field.
|
4
|
+
<%= link_to facet_field_label(facet_field.key), "#", :"data-no-turbolink" => true %>
|
5
5
|
</h5>
|
6
6
|
</div>
|
7
7
|
<div id="<%= facet_field_id(facet_field) %>" class="panel-collapse facet-content <%= should_collapse_facet?(facet_field) ? 'collapse' : 'in' %>">
|
@@ -1,9 +1,11 @@
|
|
1
1
|
<ul class="facet-values list-unstyled">
|
2
2
|
<% paginator = facet_paginator(facet_field, display_facet) %>
|
3
|
-
<%= render_facet_limit_list paginator,
|
3
|
+
<%= render_facet_limit_list paginator, field_name %>
|
4
4
|
|
5
5
|
<% unless paginator.last_page? || params[:action] == "facet" %>
|
6
|
-
<li class="more_facets_link"
|
7
|
-
|
6
|
+
<li class="more_facets_link">
|
7
|
+
<%= link_to t("more_#{field_name}_html", scope: 'blacklight.search.facets', default: :more_html, field_name: facet_field.label),
|
8
|
+
search_facet_url(id: field_name), class: "more_facets_link" %>
|
9
|
+
</li>
|
8
10
|
<% end %>
|
9
11
|
</ul>
|
@@ -2,15 +2,15 @@
|
|
2
2
|
<% display_facet.items.each do |item| -%>
|
3
3
|
<li>
|
4
4
|
<span class="facet-values">
|
5
|
-
<% if facet_in_params?(
|
6
|
-
<%= render_selected_facet_value(
|
5
|
+
<% if facet_in_params?(field_name, item) %>
|
6
|
+
<%= render_selected_facet_value(field_name, item) %>
|
7
7
|
<% else %>
|
8
|
-
<%= render_facet_value(
|
8
|
+
<%= render_facet_value(field_name, item) %>
|
9
9
|
<% end -%>
|
10
10
|
</span>
|
11
11
|
|
12
12
|
<% unless item.items.blank? %>
|
13
|
-
<%= render :
|
13
|
+
<%= render partial: 'facet_pivot', locals: { display_facet: item, field_name: field_name, solr_field: field_name } %>
|
14
14
|
<% end %>
|
15
15
|
</li>
|
16
16
|
<% end %>
|
@@ -1,49 +1,9 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<h4><%= t('blacklight.welcome') %></h4>
|
2
|
+
<p> </p>
|
3
|
+
<p>To modify this text to your specifications, copy this file located in the blacklight plugin directory:<br/>
|
4
|
+
<%= Blacklight.root %>/app/views/catalog/_home_text.html.erb</p>
|
5
|
+
<p>to your top level rails app:<br/>
|
6
|
+
<%= Rails.root %>/app/views/catalog/_home_text.html.erb</p>
|
7
|
+
<p>Note that you will need to create the 'catalog' directory under views.</p>
|
8
|
+
<% #Creates a bit space in the page -%>
|
9
9
|
|
10
|
-
|
11
|
-
</div>
|
12
|
-
|
13
|
-
<div id="getting-started">
|
14
|
-
<h2>Here’s how to get started:</h2>
|
15
|
-
|
16
|
-
<ol>
|
17
|
-
<li>To modify this text, you need to <a href="http://guides.rubyonrails.org/engines.html#improving-engine-functionality">override the Blacklight-provided view</a>.
|
18
|
-
You can copy this file, located in the blacklight gem: <br />
|
19
|
-
<%= Blacklight.root %>/app/views/catalog/_home_text.html.erb <br />
|
20
|
-
to your own application: <br />
|
21
|
-
<%= Rails.root %>/app/views/catalog/_home_text.html.erb
|
22
|
-
</li>
|
23
|
-
<li><a href="https://github.com/projectblacklight/blacklight/wiki/Indexing-your-data-into-solr">Index your own data</a> into Solr</li>
|
24
|
-
<li><a href="https://github.com/projectblacklight/blacklight/wiki#blacklight-configuration">Configure Blacklight</a> to match your data and user-experience needs</li>
|
25
|
-
<li><a href="https://github.com/projectblacklight/blacklight/wiki#support">Get in touch</a> with your comments, questions, and ideas</li>
|
26
|
-
</ol>
|
27
|
-
</div>
|
28
|
-
|
29
|
-
<%# This is the same panel shown in the Rails welcome template %>
|
30
|
-
<div id="about">
|
31
|
-
<h3><a href="/rails/info/properties">About your application’s environment</a></h3>
|
32
|
-
<div id="about-content" class="well" style="display: none"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<script>
|
36
|
-
$(function() {
|
37
|
-
$('#about a').on('click', function(e) {
|
38
|
-
e.preventDefault();
|
39
|
-
|
40
|
-
if ($('#about-content').html() == "") {
|
41
|
-
$('#about-content').load($(this).attr("href"), function() {
|
42
|
-
$('#about-content').show();
|
43
|
-
});
|
44
|
-
} else {
|
45
|
-
$('#about-content').toggle();
|
46
|
-
}
|
47
|
-
});
|
48
|
-
});
|
49
|
-
</script>
|