blacklight 7.0.0.rc1 → 7.0.0.rc2
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 +5 -5
- data/.rubocop.yml +30 -18
- data/.rubocop_todo.yml +308 -67
- data/.solr_wrapper.yml +8 -1
- data/.travis.yml +15 -13
- data/Gemfile +2 -0
- data/README.md +2 -2
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/Vagrantfile +2 -0
- data/app/assets/javascripts/blacklight/blacklight.js +17 -17
- data/app/assets/stylesheets/blacklight/_blacklight_base.scss +17 -16
- data/app/assets/stylesheets/blacklight/_facets.scss +2 -13
- data/app/assets/stylesheets/blacklight/_icons.scss +8 -2
- data/app/assets/stylesheets/blacklight/_search_form.scss +7 -0
- data/app/assets/stylesheets/blacklight/blacklight.scss +1 -1
- data/app/builders/blacklight/action_builder.rb +1 -0
- data/app/controllers/concerns/blacklight/bookmarks.rb +19 -13
- data/app/controllers/concerns/blacklight/catalog.rb +19 -7
- data/app/controllers/concerns/blacklight/controller.rb +12 -18
- data/app/controllers/concerns/blacklight/facet.rb +3 -0
- data/app/controllers/concerns/blacklight/search_context.rb +7 -3
- data/app/controllers/concerns/blacklight/search_history.rb +1 -6
- data/app/controllers/concerns/blacklight/token_based_user.rb +3 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +5 -1
- data/app/helpers/blacklight/configuration_helper_behavior.rb +5 -3
- data/app/helpers/blacklight/facets_helper_behavior.rb +15 -12
- data/app/helpers/blacklight/icon_helper_behavior.rb +2 -0
- data/app/helpers/blacklight/render_constraints_helper_behavior.rb +2 -0
- data/app/helpers/blacklight/render_partials_helper_behavior.rb +2 -2
- data/app/helpers/blacklight/search_history_constraints_helper_behavior.rb +1 -0
- data/app/helpers/blacklight/url_helper_behavior.rb +29 -14
- data/app/javascript/blacklight/checkbox_submit.js +9 -8
- data/app/javascript/blacklight/core.js +8 -6
- data/app/javascript/blacklight/modal.js +1 -3
- data/app/javascript/blacklight/search_context.js +0 -1
- data/app/models/blacklight/icon.rb +3 -0
- data/app/models/blacklight/suggest_search.rb +3 -14
- data/app/models/bookmark.rb +1 -1
- data/app/models/concerns/blacklight/document.rb +3 -1
- data/app/models/concerns/blacklight/solr/document.rb +1 -0
- data/app/models/concerns/blacklight/suggest/response.rb +5 -3
- data/app/models/concerns/blacklight/user.rb +1 -0
- data/app/models/search.rb +1 -0
- data/app/presenters/blacklight/document_presenter.rb +38 -0
- data/app/presenters/blacklight/field_presenter.rb +2 -0
- data/app/presenters/blacklight/index_presenter.rb +13 -5
- data/app/presenters/blacklight/json_presenter.rb +5 -12
- data/app/presenters/blacklight/link_alternate_presenter.rb +2 -0
- data/app/presenters/blacklight/rendering/abstract_step.rb +2 -0
- data/app/presenters/blacklight/rendering/helper_method.rb +2 -0
- data/app/presenters/blacklight/rendering/join.rb +2 -0
- data/app/presenters/blacklight/rendering/link_to_facet.rb +4 -0
- data/app/presenters/blacklight/rendering/microdata.rb +3 -0
- data/app/presenters/blacklight/rendering/pipeline.rb +2 -0
- data/app/presenters/blacklight/rendering/terminator.rb +2 -0
- data/app/presenters/blacklight/search_bar_presenter.rb +2 -0
- data/app/presenters/blacklight/show_presenter.rb +8 -5
- data/app/presenters/blacklight/thumbnail_presenter.rb +2 -0
- data/app/services/blacklight/document_factory.rb +2 -0
- data/app/services/blacklight/field_retriever.rb +2 -0
- data/app/services/blacklight/search_service.rb +7 -9
- data/app/values/blacklight/types.rb +3 -0
- data/app/views/bookmarks/index.html.erb +12 -13
- data/app/views/catalog/_citation.html.erb +4 -4
- data/app/views/catalog/_constraints.html.erb +2 -0
- data/app/views/catalog/_did_you_mean.html.erb +1 -1
- data/app/views/catalog/_document.atom.builder +17 -16
- data/app/views/catalog/_document.rss.builder +2 -0
- data/app/views/catalog/_facet_index_navigation.html.erb +5 -4
- data/app/views/catalog/_facet_layout.html.erb +3 -5
- data/app/views/catalog/_facets.html.erb +5 -4
- data/app/views/catalog/_field.json.jbuilder +10 -0
- data/app/views/catalog/_group.html.erb +1 -1
- data/app/views/catalog/_home_text.html.erb +5 -5
- data/app/views/catalog/_index.html.erb +5 -7
- data/app/views/catalog/_index_header.html.erb +1 -1
- data/app/views/catalog/_per_page_widget.html.erb +1 -1
- data/app/views/catalog/_results_pagination.html.erb +2 -2
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/app/views/catalog/_search_results.html.erb +2 -2
- data/app/views/catalog/_show.html.erb +3 -5
- data/app/views/catalog/_show_more_like_this.html.erb +1 -1
- data/app/views/catalog/_show_sidebar.html.erb +1 -1
- data/app/views/catalog/_show_tools.html.erb +1 -1
- data/app/views/catalog/_sort_widget.html.erb +1 -1
- data/app/views/catalog/_zero_results.html.erb +1 -1
- data/app/views/catalog/citation.js.erb +1 -1
- data/app/views/catalog/facet.html.erb +5 -4
- data/app/views/catalog/facet.json.jbuilder +2 -0
- data/app/views/catalog/index.atom.builder +4 -2
- data/app/views/catalog/index.json.jbuilder +29 -10
- data/app/views/catalog/index.rss.builder +2 -0
- data/app/views/catalog/opensearch.xml.builder +3 -1
- data/app/views/catalog/show.json.jbuilder +21 -0
- data/app/views/kaminari/blacklight/_first_page.html.erb +1 -1
- data/app/views/kaminari/blacklight/_last_page.html.erb +1 -1
- data/app/views/kaminari/blacklight/_next_page.html.erb +3 -3
- data/app/views/kaminari/blacklight/_page.html.erb +4 -2
- data/app/views/kaminari/blacklight/_prev_page.html.erb +2 -2
- data/app/views/layouts/blacklight.html.erb +4 -4
- data/app/views/layouts/blacklight/base.html.erb +1 -9
- data/app/views/search_history/index.html.erb +3 -3
- data/app/views/shared/_header_navbar.html.erb +1 -1
- data/app/views/shared/_modal.html.erb +2 -2
- data/blacklight.gemspec +7 -6
- data/config/i18n-tasks.yml +17 -0
- data/config/locales/blacklight.de.yml +72 -57
- data/config/locales/blacklight.en.yml +11 -1
- data/config/locales/blacklight.es.yml +15 -1
- data/config/locales/blacklight.fr.yml +17 -8
- data/config/locales/blacklight.hu.yml +3 -1
- data/config/locales/blacklight.it.yml +16 -1
- data/config/locales/blacklight.nl.yml +3 -1
- data/config/locales/blacklight.pt-BR.yml +19 -2
- data/config/locales/blacklight.sq.yml +3 -1
- data/config/locales/blacklight.zh.yml +3 -1
- data/config/routes.rb +0 -1
- data/lib/blacklight.rb +3 -0
- data/lib/blacklight/abstract_repository.rb +12 -0
- data/lib/blacklight/configuration.rb +21 -3
- data/lib/blacklight/configuration/context.rb +11 -0
- data/lib/blacklight/configuration/fields.rb +31 -26
- data/lib/blacklight/configuration/null_field.rb +2 -0
- data/lib/blacklight/engine.rb +4 -1
- data/lib/blacklight/routes/exportable.rb +1 -3
- data/lib/blacklight/routes/searchable.rb +2 -3
- data/lib/blacklight/runtime_registry.rb +2 -0
- data/lib/blacklight/search_builder.rb +2 -0
- data/lib/blacklight/search_state.rb +2 -0
- data/lib/blacklight/solr/repository.rb +34 -0
- data/lib/blacklight/solr/response/spelling.rb +1 -0
- data/lib/generators/blacklight/assets_generator.rb +10 -9
- data/lib/generators/blacklight/controller_generator.rb +1 -1
- data/lib/generators/blacklight/install_generator.rb +7 -14
- data/lib/generators/blacklight/solr_generator.rb +8 -0
- data/lib/generators/blacklight/templates/alternate_controller.rb +4 -4
- data/lib/generators/blacklight/templates/catalog_controller.rb +7 -1
- data/lib/generators/blacklight/templates/solr/conf/schema.xml +20 -22
- data/lib/generators/blacklight/user_generator.rb +2 -0
- data/lib/railties/blacklight.rake +9 -13
- data/package-lock.json +544 -406
- data/package.json +3 -2
- data/spec/controllers/alternate_controller_spec.rb +4 -3
- data/spec/controllers/application_controller_spec.rb +0 -4
- data/spec/controllers/blacklight/base_spec.rb +5 -2
- data/spec/controllers/blacklight/catalog/component_configuration_spec.rb +4 -4
- data/spec/controllers/blacklight/facet_spec.rb +0 -1
- data/spec/controllers/blacklight/search_fields_spec.rb +25 -22
- data/spec/controllers/bookmarks_controller_spec.rb +45 -10
- data/spec/controllers/catalog_controller_spec.rb +206 -138
- data/spec/controllers/search_history_controller_spec.rb +4 -4
- data/spec/features/alternate_controller_spec.rb +3 -3
- data/spec/features/autocomplete_spec.rb +2 -0
- data/spec/features/did_you_mean_spec.rb +4 -3
- data/spec/features/facets_spec.rb +7 -7
- data/spec/features/record_view_spec.rb +11 -12
- data/spec/features/search_context_spec.rb +4 -5
- data/spec/features/search_crawler_spec.rb +3 -5
- data/spec/features/search_filters_spec.rb +44 -44
- data/spec/features/search_history_spec.rb +5 -3
- data/spec/features/search_pagination_spec.rb +3 -1
- data/spec/features/search_results_spec.rb +11 -8
- data/spec/features/search_spec.rb +3 -3
- data/spec/features/sitelinks_search_box.rb +4 -4
- data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +30 -30
- data/spec/helpers/blacklight/facets_helper_behavior_spec.rb +65 -59
- data/spec/helpers/blacklight/hash_as_hidden_fields_behavior_spec.rb +1 -1
- data/spec/helpers/blacklight/icon_helper_behavior_spec.rb +2 -0
- data/spec/helpers/blacklight/render_constraints_helper_behavior_spec.rb +8 -3
- data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +16 -4
- data/spec/helpers/blacklight/search_history_constraints_helper_behavior_spec.rb +21 -22
- data/spec/helpers/blacklight/suggest_helper_behavior_spec.rb +6 -1
- data/spec/helpers/blacklight/url_helper_behavior_spec.rb +49 -43
- data/spec/helpers/blacklight_helper_spec.rb +28 -12
- data/spec/helpers/catalog_helper_spec.rb +50 -47
- data/spec/i18n_spec.rb +18 -0
- data/spec/integration/generators/blacklight/solr_generator_spec.rb +18 -10
- data/spec/lib/blacklight/configuration/facet_field_spec.rb +2 -0
- data/spec/lib/blacklight/configuration/field_spec.rb +3 -0
- data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +15 -20
- data/spec/lib/blacklight/parameters_spec.rb +3 -1
- data/spec/lib/blacklight/search_state_spec.rb +51 -34
- data/spec/lib/blacklight_spec.rb +13 -14
- data/spec/lib/tasks/blacklight_task_spec.rb +3 -5
- data/spec/models/blacklight/configurable_spec.rb +11 -13
- data/spec/models/blacklight/configuration/context_spec.rb +9 -10
- data/spec/models/blacklight/configuration_spec.rb +103 -91
- data/spec/models/blacklight/document/active_model_shim_spec.rb +5 -6
- data/spec/models/blacklight/document/cache_key_spec.rb +9 -2
- data/spec/models/blacklight/document/dublin_core_spec.rb +16 -19
- data/spec/models/blacklight/document/email_spec.rb +9 -9
- data/spec/models/blacklight/document/sms_spec.rb +9 -9
- data/spec/models/blacklight/document_spec.rb +9 -8
- data/spec/models/blacklight/facet_paginator_spec.rb +40 -30
- data/spec/models/blacklight/icon_spec.rb +12 -2
- data/spec/models/blacklight/search_builder_spec.rb +12 -3
- data/spec/models/blacklight/solr/document_spec.rb +216 -219
- data/spec/models/blacklight/solr/facet_paginator_spec.rb +6 -4
- data/spec/models/blacklight/solr/repository_spec.rb +37 -34
- data/spec/models/blacklight/solr/request_spec.rb +17 -18
- data/spec/models/blacklight/solr/response/facets_spec.rb +58 -58
- data/spec/models/blacklight/solr/response/group_response_spec.rb +16 -22
- data/spec/models/blacklight/solr/response/group_spec.rb +18 -25
- data/spec/models/blacklight/solr/response_spec.rb +48 -50
- data/spec/models/blacklight/solr/search_builder_spec.rb +120 -121
- data/spec/models/blacklight/suggest/response_spec.rb +6 -4
- data/spec/models/blacklight/suggest_search_spec.rb +9 -16
- data/spec/models/blacklight/user_spec.rb +9 -11
- data/spec/models/bookmark_spec.rb +6 -5
- data/spec/models/record_mailer_spec.rb +22 -20
- data/spec/models/search_spec.rb +18 -17
- data/spec/models/solr_document_spec.rb +6 -2
- data/spec/presenters/blacklight/document_presenter_spec.rb +86 -0
- data/spec/presenters/blacklight/index_presenter_spec.rb +186 -0
- data/spec/presenters/blacklight/json_presenter_spec.rb +59 -0
- data/spec/presenters/blacklight/link_alternate_presenter_spec.rb +3 -0
- data/spec/presenters/blacklight/search_bar_presenter_spec.rb +7 -0
- data/spec/presenters/{show_presenter_spec.rb → blacklight/show_presenter_spec.rb} +138 -91
- data/spec/presenters/pipeline_spec.rb +15 -8
- data/spec/presenters/thumbnail_presenter_spec.rb +5 -2
- data/spec/routing/catalog_routing_spec.rb +12 -14
- data/spec/services/blacklight/search_service_spec.rb +112 -70
- data/spec/spec_helper.rb +6 -2
- data/spec/support/features.rb +1 -1
- data/spec/support/features/session_helpers.rb +4 -4
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -13
- data/spec/views/catalog/_constraints.html.erb_spec.rb +2 -3
- data/spec/views/catalog/_constraints_element.html.erb_spec.rb +9 -5
- data/spec/views/catalog/_document.html.erb_spec.rb +4 -4
- data/spec/views/catalog/_document_list.html.erb_spec.rb +1 -0
- data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +4 -4
- data/spec/views/catalog/_facet_layout.html.erb_spec.rb +3 -3
- data/spec/views/catalog/_facets.html.erb_spec.rb +8 -10
- data/spec/views/catalog/_index.html.erb_spec.rb +13 -14
- data/spec/views/catalog/_index_header.html.erb_spec.rb +5 -8
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +3 -3
- data/spec/views/catalog/_show.html.erb_spec.rb +12 -13
- data/spec/views/catalog/_show_sidebar.erb_spec.rb +4 -7
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +2 -2
- data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +0 -1
- data/spec/views/catalog/_sort_widget.html.erb_spec.rb +3 -1
- data/spec/views/catalog/_thumbnail.html.erb_spec.rb +6 -8
- data/spec/views/catalog/_view_type_group.html.erb_spec.rb +7 -9
- data/spec/views/catalog/email_success.html.erb_spec.rb +0 -1
- data/spec/views/catalog/facet.html.erb_spec.rb +3 -2
- data/spec/views/catalog/facet.json.jbuilder_spec.rb +3 -2
- data/spec/views/catalog/index.atom.builder_spec.rb +9 -4
- data/spec/views/catalog/index.html.erb_spec.rb +2 -1
- data/spec/views/catalog/index.json.jbuilder_spec.rb +84 -36
- data/spec/views/catalog/show.html.erb_spec.rb +6 -6
- data/spec/views/catalog/show.json.jbuilder_spec.rb +40 -0
- data/spec/views/catalog/sms_success.html.erb_spec.rb +0 -1
- data/spec/views/shared/_user_util_links.html.erb_spec.rb +1 -4
- data/tasks/blacklight.rake +6 -4
- data/template.demo.rb +2 -0
- metadata +50 -24
- data/app/javascript/blacklight/autofocus.js +0 -20
- data/spec/presenters/index_presenter_spec.rb +0 -150
data/.solr_wrapper.yml
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
# Place
|
|
1
|
+
# Place configuration for solr_wrapper here
|
|
2
|
+
#
|
|
3
|
+
# Specify the port to run solr on
|
|
2
4
|
# port: 8983
|
|
5
|
+
#
|
|
6
|
+
# Specify a version of Solr to download
|
|
7
|
+
# version: 7.3.1
|
|
8
|
+
#
|
|
9
|
+
# Create a collection when starting solr
|
|
3
10
|
collection:
|
|
4
11
|
dir: lib/generators/blacklight/templates/solr/conf/
|
|
5
12
|
name: blacklight-core
|
data/.travis.yml
CHANGED
|
@@ -9,18 +9,20 @@ notifications:
|
|
|
9
9
|
|
|
10
10
|
matrix:
|
|
11
11
|
include:
|
|
12
|
-
- rvm: 2.5.
|
|
13
|
-
env: "RAILS_VERSION=5.1.
|
|
14
|
-
- rvm: 2.4.
|
|
15
|
-
env: "RAILS_VERSION=5.2.
|
|
16
|
-
- rvm: 2.
|
|
17
|
-
env: "RAILS_VERSION=5.1
|
|
18
|
-
- rvm: 2.
|
|
19
|
-
env: "RAILS_VERSION=5.
|
|
20
|
-
- rvm:
|
|
21
|
-
env: "RAILS_VERSION=5.1
|
|
12
|
+
- rvm: 2.5.3
|
|
13
|
+
env: "RAILS_VERSION=5.1.6"
|
|
14
|
+
- rvm: 2.4.5
|
|
15
|
+
env: "RAILS_VERSION=5.2.1"
|
|
16
|
+
- rvm: 2.5.3
|
|
17
|
+
env: "RAILS_VERSION=5.2.1 BLACKLIGHT_API_TEST=true ENGINE_CART_RAILS_OPTIONS=\"--api --skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-test\""
|
|
18
|
+
- rvm: 2.4.5
|
|
19
|
+
env: "RAILS_VERSION=5.1.6"
|
|
20
|
+
- rvm: 2.3.8
|
|
21
|
+
env: "RAILS_VERSION=5.2.1"
|
|
22
|
+
- rvm: jruby-9.2.0.0
|
|
23
|
+
env: "RAILS_VERSION=5.1.6 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
|
|
22
24
|
allow_failures:
|
|
23
|
-
- rvm: jruby-9.
|
|
25
|
+
- rvm: jruby-9.2.0.0
|
|
24
26
|
fast_finish: true
|
|
25
27
|
|
|
26
28
|
before_install:
|
|
@@ -35,6 +37,6 @@ notifications:
|
|
|
35
37
|
|
|
36
38
|
global_env:
|
|
37
39
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
|
38
|
-
- ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-
|
|
40
|
+
- ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
|
39
41
|
|
|
40
|
-
jdk:
|
|
42
|
+
jdk: oraclejdk9
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -34,9 +34,9 @@ rails generate blacklight:install
|
|
|
34
34
|
|
|
35
35
|
## Dependencies
|
|
36
36
|
|
|
37
|
-
* Ruby 2.
|
|
37
|
+
* Ruby 2.2+
|
|
38
38
|
* Bundler
|
|
39
|
-
* Rails 5.
|
|
39
|
+
* Rails 5.1+
|
|
40
40
|
|
|
41
41
|
## Configuring Apache Solr
|
|
42
42
|
You'll also want some information about how Blacklight expects [Apache Solr](http://lucene.apache.org/solr ) to run, which you can find in [README_SOLR](https://github.com/projectblacklight/blacklight/wiki/README_SOLR)
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
7.0.0.
|
|
1
|
+
7.0.0.rc2
|
data/Vagrantfile
CHANGED
|
@@ -19,21 +19,23 @@ Blacklight = function () {
|
|
|
19
19
|
listeners.push('turbolinks:load');
|
|
20
20
|
} else {
|
|
21
21
|
// Turbolinks < 5
|
|
22
|
-
listeners.push('page:load', '
|
|
22
|
+
listeners.push('page:load', 'DOMContentLoaded');
|
|
23
23
|
}
|
|
24
24
|
} else {
|
|
25
|
-
listeners.push('
|
|
25
|
+
listeners.push('DOMContentLoaded');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
return listeners
|
|
28
|
+
return listeners;
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
}();
|
|
32
32
|
|
|
33
33
|
// turbolinks triggers page:load events on page transition
|
|
34
34
|
// If app isn't using turbolinks, this event will never be triggered, no prob.
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
Blacklight.listeners().forEach(function (listener) {
|
|
36
|
+
document.addEventListener(listener, function () {
|
|
37
|
+
Blacklight.activate();
|
|
38
|
+
});
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
$('.no-js').removeClass('no-js').addClass('js');
|
|
@@ -114,11 +116,11 @@ Blacklight.onLoad(function () {
|
|
|
114
116
|
|
|
115
117
|
Pass in options for your class name and labels:
|
|
116
118
|
$("form.something").blCheckboxSubmit({
|
|
117
|
-
checked_label: "Selected",
|
|
118
|
-
unchecked_label: "Select",
|
|
119
|
-
progress_label: "Saving...",
|
|
120
119
|
//cssClass is added to elements added, plus used for id base
|
|
121
120
|
cssClass: "toggle_my_kinda_form",
|
|
121
|
+
error: function() {
|
|
122
|
+
#optional callback
|
|
123
|
+
},
|
|
122
124
|
success: function(after_success_check_state) {
|
|
123
125
|
#optional callback
|
|
124
126
|
}
|
|
@@ -142,7 +144,7 @@ Blacklight.onLoad(function () {
|
|
|
142
144
|
var uniqueId = form.attr('data-doc-id') || Math.random();
|
|
143
145
|
// if form is currently using method delete to change state,
|
|
144
146
|
// then checkbox is currently checked
|
|
145
|
-
var checked = form.find('input[name=_method][value=delete]').
|
|
147
|
+
var checked = form.find('input[name=_method][value=delete]').length != 0;
|
|
146
148
|
|
|
147
149
|
var checkbox = $('<input type="checkbox">').addClass(options.cssClass).attr('id', options.cssClass + '_' + uniqueId);
|
|
148
150
|
var label = $('<label>').addClass(options.cssClass).attr('for', options.cssClass + '_' + uniqueId).attr('title', form.attr('title') || '');
|
|
@@ -182,10 +184,9 @@ Blacklight.onLoad(function () {
|
|
|
182
184
|
type: form.attr('method').toUpperCase(),
|
|
183
185
|
data: form.serialize(),
|
|
184
186
|
error: function () {
|
|
185
|
-
alert('Error');
|
|
186
|
-
updateStateFor(checked);
|
|
187
187
|
label.removeAttr('disabled');
|
|
188
188
|
checkbox.removeAttr('disabled');
|
|
189
|
+
options.error.call();
|
|
189
190
|
},
|
|
190
191
|
success: function (data, status, xhr) {
|
|
191
192
|
//if app isn't running at all, xhr annoyingly
|
|
@@ -197,10 +198,9 @@ Blacklight.onLoad(function () {
|
|
|
197
198
|
checkbox.removeAttr('disabled');
|
|
198
199
|
options.success.call(form, checked, xhr.responseJSON);
|
|
199
200
|
} else {
|
|
200
|
-
alert('Error');
|
|
201
|
-
updateStateFor(checked);
|
|
202
201
|
label.removeAttr('disabled');
|
|
203
202
|
checkbox.removeAttr('disabled');
|
|
203
|
+
options.error.call();
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
});
|
|
@@ -215,6 +215,9 @@ Blacklight.onLoad(function () {
|
|
|
215
215
|
$.fn.blCheckboxSubmit.defaults = {
|
|
216
216
|
//cssClass is added to elements added, plus used for id base
|
|
217
217
|
cssClass: 'blCheckboxSubmit',
|
|
218
|
+
error: function () {
|
|
219
|
+
alert("Error");
|
|
220
|
+
},
|
|
218
221
|
success: function () {} //callback
|
|
219
222
|
};
|
|
220
223
|
})(jQuery);
|
|
@@ -252,8 +255,6 @@ Blacklight.onLoad(function () {
|
|
|
252
255
|
Blacklight.doResizeFacetLabelsAndCounts();
|
|
253
256
|
});
|
|
254
257
|
})(jQuery);
|
|
255
|
-
//= require blacklight/core
|
|
256
|
-
|
|
257
258
|
/*
|
|
258
259
|
The blacklight modal plugin can display some interactions inside a Bootstrap
|
|
259
260
|
modal window, including some multi-page interactions.
|
|
@@ -368,7 +369,7 @@ Blacklight.modal.receiveAjax = function (contents) {
|
|
|
368
369
|
// important we don't execute script tags, we shouldn't.
|
|
369
370
|
// code modelled off of JQuery ajax.load. https://github.com/jquery/jquery/blob/master/src/ajax/load.js?source=c#L62
|
|
370
371
|
var container = $('<div>').append(jQuery.parseHTML(contents)).find(Blacklight.modal.containerSelector).first();
|
|
371
|
-
if (container.
|
|
372
|
+
if (container.length !== 0) {
|
|
372
373
|
contents = container.html();
|
|
373
374
|
}
|
|
374
375
|
|
|
@@ -444,7 +445,6 @@ Blacklight.modal.checkCloseModal = function (event) {
|
|
|
444
445
|
Blacklight.onLoad(function () {
|
|
445
446
|
Blacklight.modal.setupModal();
|
|
446
447
|
});
|
|
447
|
-
//= require blacklight/core
|
|
448
448
|
(function ($) {
|
|
449
449
|
Blacklight.doSearchContextBehavior = function () {
|
|
450
450
|
if (typeof Blacklight.do_search_context_behavior == 'function') {
|
|
@@ -7,19 +7,20 @@
|
|
|
7
7
|
not to use the Blacklight CSS file at all in your local app. */
|
|
8
8
|
|
|
9
9
|
@import "mixins";
|
|
10
|
-
@import '
|
|
11
|
-
@import "
|
|
12
|
-
@import "
|
|
13
|
-
@import "
|
|
14
|
-
@import "
|
|
15
|
-
@import "
|
|
16
|
-
@import "
|
|
17
|
-
@import "
|
|
18
|
-
@import "
|
|
19
|
-
@import "
|
|
20
|
-
@import "
|
|
21
|
-
@import "
|
|
22
|
-
@import "
|
|
23
|
-
@import "
|
|
24
|
-
@import "
|
|
25
|
-
@import "
|
|
10
|
+
@import 'blacklight_defaults';
|
|
11
|
+
@import "bootstrap_overrides";
|
|
12
|
+
@import "layout";
|
|
13
|
+
@import "header";
|
|
14
|
+
@import "constraints";
|
|
15
|
+
@import "controls";
|
|
16
|
+
@import "search_form";
|
|
17
|
+
@import "search_results";
|
|
18
|
+
@import "pagination";
|
|
19
|
+
@import "group";
|
|
20
|
+
@import "bookmark";
|
|
21
|
+
@import "balanced_list";
|
|
22
|
+
@import "facets";
|
|
23
|
+
@import "search_history";
|
|
24
|
+
@import "modal";
|
|
25
|
+
@import "twitter_typeahead";
|
|
26
|
+
@import "icons";
|
|
@@ -19,12 +19,6 @@
|
|
|
19
19
|
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
|
20
20
|
|
|
21
21
|
&#{$infix} {
|
|
22
|
-
@include media-breakpoint-down($breakpoint) {
|
|
23
|
-
.top-panel-heading {
|
|
24
|
-
margin-right: 3em;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
22
|
@include media-breakpoint-up($next) {
|
|
29
23
|
|
|
30
24
|
// scss-lint:disable ImportantRule
|
|
@@ -42,11 +36,6 @@
|
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
38
|
|
|
45
|
-
.top-panel-heading {
|
|
46
|
-
@extend .navbar-light;
|
|
47
|
-
@extend .clearfix;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
39
|
.facets-heading {
|
|
51
40
|
@extend .h4;
|
|
52
41
|
line-height: inherit;
|
|
@@ -55,7 +44,7 @@
|
|
|
55
44
|
.facet-limit {
|
|
56
45
|
margin-bottom: $spacer;
|
|
57
46
|
|
|
58
|
-
.card-
|
|
47
|
+
.card-body {
|
|
59
48
|
padding: $spacer;
|
|
60
49
|
}
|
|
61
50
|
}
|
|
@@ -147,7 +136,7 @@
|
|
|
147
136
|
}
|
|
148
137
|
}
|
|
149
138
|
|
|
150
|
-
|
|
139
|
+
|
|
151
140
|
|
|
152
141
|
/* style for pivot facet's nested list */
|
|
153
142
|
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
.blacklight-icons {
|
|
2
|
-
display: inline-
|
|
2
|
+
display: inline-flex;
|
|
3
3
|
height: $font-size-base;
|
|
4
|
-
vertical-align: text-top;
|
|
5
4
|
width: $font-size-base;
|
|
6
5
|
}
|
|
7
6
|
|
|
7
|
+
.blacklight-icons svg {
|
|
8
|
+
height: 1rem;
|
|
9
|
+
width: 1rem;
|
|
10
|
+
top: .125rem;
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
@each $color, $value in $theme-colors {
|
|
9
15
|
.btn-#{$color} {
|
|
10
16
|
.blacklight-icons g {
|
|
@@ -16,6 +16,7 @@ module Blacklight
|
|
|
16
16
|
# doesn't already exist or the `:define_method` option is not `false`
|
|
17
17
|
def build
|
|
18
18
|
return if skip?
|
|
19
|
+
|
|
19
20
|
callback = opts.fetch(:callback, nil).inspect
|
|
20
21
|
validator = opts.fetch(:validator, nil).inspect
|
|
21
22
|
klass.class_eval <<EORUBY, __FILE__, __LINE__ + 1
|
|
@@ -70,7 +70,7 @@ module Blacklight::Bookmarks
|
|
|
70
70
|
# is simpler.
|
|
71
71
|
def create
|
|
72
72
|
@bookmarks = if params[:bookmarks]
|
|
73
|
-
|
|
73
|
+
permit_bookmarks[:bookmarks]
|
|
74
74
|
else
|
|
75
75
|
[{ document_id: params[:id], document_type: blacklight_config.document_model.to_s }]
|
|
76
76
|
end
|
|
@@ -90,28 +90,30 @@ module Blacklight::Bookmarks
|
|
|
90
90
|
flash[:error] = I18n.t('blacklight.bookmarks.add.failure', count: @bookmarks.length)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
redirect_back fallback_location: bookmarks_path
|
|
95
|
-
else
|
|
96
|
-
# Deprecated in Rails 5.0
|
|
97
|
-
redirect_to :back
|
|
98
|
-
end
|
|
93
|
+
redirect_back fallback_location: bookmarks_path
|
|
99
94
|
end
|
|
100
95
|
end
|
|
101
96
|
|
|
102
97
|
# Beware, :id is the Solr document_id, not the actual Bookmark id.
|
|
103
98
|
# idempotent, as DELETE is supposed to be.
|
|
104
99
|
def destroy
|
|
105
|
-
|
|
100
|
+
@bookmarks =
|
|
101
|
+
if params[:bookmarks]
|
|
102
|
+
permit_bookmarks[:bookmarks]
|
|
103
|
+
else
|
|
104
|
+
[{ document_id: params[:id], document_type: blacklight_config.document_model.to_s }]
|
|
105
|
+
end
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
success = @bookmarks.all? do |bookmark|
|
|
108
|
+
bookmark = current_or_guest_user.bookmarks.find_by(bookmark)
|
|
109
|
+
bookmark && bookmark.delete && bookmark.destroyed?
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
if success
|
|
108
113
|
if request.xhr?
|
|
109
114
|
render(json: { bookmarks: { count: current_or_guest_user.bookmarks.count } })
|
|
110
|
-
elsif respond_to? :redirect_back
|
|
111
|
-
redirect_back fallback_location: bookmarks_path, notice: I18n.t('blacklight.bookmarks.remove.success')
|
|
112
115
|
else
|
|
113
|
-
|
|
114
|
-
redirect_to :back, notice: I18n.t('blacklight.bookmarks.remove.success')
|
|
116
|
+
redirect_back fallback_location: bookmarks_path, notice: I18n.t('blacklight.bookmarks.remove.success')
|
|
115
117
|
end
|
|
116
118
|
elsif request.xhr?
|
|
117
119
|
head 500 # ajaxy request needs no redirect and should not have flash set
|
|
@@ -141,4 +143,8 @@ module Blacklight::Bookmarks
|
|
|
141
143
|
def start_new_search_session?
|
|
142
144
|
action_name == "index"
|
|
143
145
|
end
|
|
146
|
+
|
|
147
|
+
def permit_bookmarks
|
|
148
|
+
params.permit(bookmarks: [:document_id, :document_type])
|
|
149
|
+
end
|
|
144
150
|
end
|
|
@@ -8,9 +8,11 @@ module Blacklight::Catalog
|
|
|
8
8
|
# The following code is executed when someone includes blacklight::catalog in their
|
|
9
9
|
# own controller.
|
|
10
10
|
included do
|
|
11
|
-
|
|
11
|
+
if respond_to? :helper_method
|
|
12
|
+
helper_method :sms_mappings, :has_search_parameters?, :facet_limit_for
|
|
13
|
+
end
|
|
12
14
|
|
|
13
|
-
helper Blacklight::Facet
|
|
15
|
+
helper Blacklight::Facet if respond_to? :helper
|
|
14
16
|
|
|
15
17
|
# The index action will more than likely throw this one.
|
|
16
18
|
# Example: when the standard query parser is used, and a user submits a "bad" query.
|
|
@@ -31,7 +33,6 @@ module Blacklight::Catalog
|
|
|
31
33
|
format.atom { render layout: false }
|
|
32
34
|
format.json do
|
|
33
35
|
@presenter = Blacklight::JsonPresenter.new(@response,
|
|
34
|
-
facets_from_request,
|
|
35
36
|
blacklight_config)
|
|
36
37
|
end
|
|
37
38
|
additional_response_formats(format)
|
|
@@ -47,11 +48,19 @@ module Blacklight::Catalog
|
|
|
47
48
|
|
|
48
49
|
respond_to do |format|
|
|
49
50
|
format.html { @search_context = setup_next_and_previous_documents }
|
|
50
|
-
format.json
|
|
51
|
+
format.json
|
|
51
52
|
additional_export_formats(@document, format)
|
|
52
53
|
end
|
|
53
54
|
end
|
|
54
55
|
|
|
56
|
+
# get a single document from the index
|
|
57
|
+
def raw
|
|
58
|
+
raise(ActionController::RoutingError, 'Not Found') unless blacklight_config.raw_endpoint.enabled
|
|
59
|
+
|
|
60
|
+
_, @document = search_service.fetch(params[:id])
|
|
61
|
+
render json: @document
|
|
62
|
+
end
|
|
63
|
+
|
|
55
64
|
# updates the search counter (allows the show view to paginate)
|
|
56
65
|
def track
|
|
57
66
|
search_session['counter'] = params[:counter]
|
|
@@ -63,7 +72,7 @@ module Blacklight::Catalog
|
|
|
63
72
|
path = uri.query ? "#{uri.path}?#{uri.query}" : uri.path
|
|
64
73
|
redirect_to path, status: 303
|
|
65
74
|
else
|
|
66
|
-
redirect_to
|
|
75
|
+
redirect_to({ action: :show, id: params[:id] }, status: 303)
|
|
67
76
|
end
|
|
68
77
|
end
|
|
69
78
|
|
|
@@ -71,6 +80,7 @@ module Blacklight::Catalog
|
|
|
71
80
|
def facet
|
|
72
81
|
@facet = blacklight_config.facet_fields[params[:id]]
|
|
73
82
|
raise ActionController::RoutingError, 'Not Found' unless @facet
|
|
83
|
+
|
|
74
84
|
@response = search_service.facet_field_response(@facet.key)
|
|
75
85
|
@display_facet = @response.aggregations[@facet.field]
|
|
76
86
|
@pagination = facet_paginator(@facet, @display_facet)
|
|
@@ -100,6 +110,8 @@ module Blacklight::Catalog
|
|
|
100
110
|
end
|
|
101
111
|
end
|
|
102
112
|
|
|
113
|
+
# @return [Array] first value is a Blacklight::Solr::Response and the second
|
|
114
|
+
# is a list of documents
|
|
103
115
|
def action_documents
|
|
104
116
|
search_service.fetch(Array(params[:id]))
|
|
105
117
|
end
|
|
@@ -153,7 +165,7 @@ module Blacklight::Catalog
|
|
|
153
165
|
end
|
|
154
166
|
|
|
155
167
|
def search_service
|
|
156
|
-
search_service_class.new(blacklight_config, search_state.to_h)
|
|
168
|
+
search_service_class.new(config: blacklight_config, user_params: search_state.to_h)
|
|
157
169
|
end
|
|
158
170
|
|
|
159
171
|
##
|
|
@@ -258,7 +270,7 @@ module Blacklight::Catalog
|
|
|
258
270
|
flash[:error] = I18n.t('blacklight.sms.errors.carrier.blank')
|
|
259
271
|
elsif params[:to].gsub(/[^\d]/, '').length != 10
|
|
260
272
|
flash[:error] = I18n.t('blacklight.sms.errors.to.invalid', to: params[:to])
|
|
261
|
-
elsif !sms_mappings.
|
|
273
|
+
elsif !sms_mappings.value?(params[:carrier])
|
|
262
274
|
flash[:error] = I18n.t('blacklight.sms.errors.carrier.invalid')
|
|
263
275
|
end
|
|
264
276
|
|