blacklight 6.19.2 → 6.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +16 -25
  3. data/Gemfile +2 -0
  4. data/README.md +1 -1
  5. data/VERSION +1 -1
  6. data/app/helpers/blacklight/layout_helper_behavior.rb +7 -0
  7. data/app/models/concerns/blacklight/document.rb +16 -0
  8. data/app/values/blacklight/types.rb +28 -0
  9. data/app/views/catalog/_facet_pagination.html.erb +2 -2
  10. data/app/views/catalog/_per_page_widget.html.erb +1 -1
  11. data/app/views/catalog/_search_form.html.erb +1 -1
  12. data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
  13. data/app/views/catalog/_sort_widget.html.erb +1 -1
  14. data/app/views/catalog/_thumbnail_default.html.erb +3 -3
  15. data/app/views/catalog/email.html.erb +3 -1
  16. data/app/views/catalog/email_success.html.erb +4 -2
  17. data/app/views/catalog/facet.html.erb +3 -1
  18. data/app/views/catalog/sms.html.erb +4 -1
  19. data/app/views/catalog/sms_success.html.erb +5 -2
  20. data/app/views/layouts/blacklight.html.erb +2 -2
  21. data/app/views/shared/_ajax_modal.html.erb +2 -2
  22. data/blacklight.gemspec +1 -2
  23. data/config/locales/blacklight.de.yml +4 -0
  24. data/config/locales/blacklight.en.yml +4 -0
  25. data/config/locales/blacklight.es.yml +4 -0
  26. data/config/locales/blacklight.fr.yml +4 -0
  27. data/config/locales/blacklight.it.yml +4 -0
  28. data/config/locales/blacklight.pt-BR.yml +4 -0
  29. data/config/locales/blacklight.sq.yml +1 -0
  30. data/config/locales/blacklight.zh.yml +1 -0
  31. data/config/routes.rb +1 -1
  32. data/lib/blacklight/engine.rb +6 -2
  33. data/lib/blacklight/utils.rb +7 -3
  34. data/solr/conf/schema.xml +0 -2
  35. data/spec/features/search_spec.rb +6 -2
  36. data/spec/helpers/layout_helper_spec.rb +10 -0
  37. data/spec/models/solr_document_spec.rb +25 -1
  38. data/spec/routing/catalog_routing_spec.rb +16 -0
  39. data/spec/spec_helper.rb +5 -20
  40. metadata +9 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29725d7ac098fe4dfcdadceabf7b03066f14c680a9af21afa54191d643e87e7a
4
- data.tar.gz: e36bfb2a98c4eccdd1368f8a06a7a377e5fa5f1d3282a48384e31470148b3c50
3
+ metadata.gz: 57d198c6aed6d4e2cca7c1945904e4b13139ba1788acd6363d427aa30d436c14
4
+ data.tar.gz: 92364314b9bbb7fcb9afc3f229a641afcd05ba43e1df4b19c8512e0e256523f9
5
5
  SHA512:
6
- metadata.gz: f00f3c5c21af357d7c695888835a92a7ca63ca361fdb670fee07254f69a444fca4bc6d7d0ccd396bb871346eabc6ef6015c82d4dbadd81c1a3e7ccb584f56545
7
- data.tar.gz: 4f06db656530cb3b32364815ae24fff6c4ddcd8fe12373e08d6088b263025b9acb292c616ac45377ba43f96dbb6230875e98553fe4c7bd87b5f18f5819557a92
6
+ metadata.gz: 11048e0150ec7619375f56771faf38d1bdd0797f0f19cf67c8d8926f9f1e26adab9caf1a0f4fae084be28807aa0ab4e7320c149f688181f49eea8dedfd73d7c7
7
+ data.tar.gz: ece97e66b4d5a6c1f91b5ea9491811d06983435e592936e973de5e253fcf8405351b601999480340384ef229affa3e703b261a628a41286975b20a83e789ea2e
@@ -1,34 +1,15 @@
1
- dist: trusty
1
+ dist: bionic
2
2
  addons:
3
3
  chrome: stable
4
4
  language: ruby
5
- sudo: false
6
5
 
7
6
  notifications:
8
7
  email: false
9
8
 
10
9
  rvm:
11
- - 2.5.0
12
-
13
- matrix:
14
- include:
15
- - rvm: 2.5.0
16
- env: "RAILS_VERSION=5.2.0"
17
- - rvm: 2.4.4
18
- env: "RAILS_VERSION=4.2.10"
19
- - rvm: 2.2.10
20
- env: "RAILS_VESION=5.0.7"
21
- - rvm: 2.3.7
22
- env: "RAILS_VERSION=5.1.6"
23
- - rvm: jruby-9.1.17.0
24
- env: "RAILS_VERSION=5.2.0 JRUBY_OPTS=\"-J-Xms512m -J-Xmx1024m\""
25
- allow_failures:
26
- - rvm: jruby-9.1.17.0
27
- - rvm: 2.4.4
28
- env: "RAILS_VERSION=4.2.10"
29
- - rvm: 2.2.10
30
- env: "RAILS_VESION=5.0.7"
31
- fast_finish: true
10
+ - 2.5.7
11
+ - 2.6.5
12
+ - 2.7.0
32
13
 
33
14
  before_install:
34
15
  - gem update --system
@@ -39,7 +20,9 @@ before_script:
39
20
  - if [[ "${RAILS_VERSION}" =~ ^4.2.* ]]; then perl -pi -e "s/ActiveRecord::Migration\[[\d\.]+\]/ActiveRecord::Migration/" db/migrate/*; fi
40
21
 
41
22
  env:
42
- - "RAILS_VERSION=5.1.1"
23
+ - "RAILS_VERSION=5.1.7"
24
+ - "RAILS_VERSION=5.2.0"
25
+
43
26
 
44
27
  notifications:
45
28
  irc: "irc.freenode.org#blacklight"
@@ -49,5 +32,13 @@ notifications:
49
32
  global_env:
50
33
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
51
34
  - ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-bundle --skip-listen --skip-spring --skip-yarn --skip-keeps --skip-action-cable --skip-coffee --skip-test'
35
+ - CC_TEST_REPORTER_ID=5042c7358c96b0b926088a4cda3e132fffe7a66ce8047cdb1dc6f0b4b6676b79
36
+
37
+ jdk: openjdk11
52
38
 
53
- jdk: oraclejdk8
39
+ before_script:
40
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
41
+ - chmod +x ./cc-test-reporter
42
+ - ./cc-test-reporter before-build
43
+ after_script:
44
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/Gemfile CHANGED
@@ -32,6 +32,8 @@ else
32
32
  end
33
33
 
34
34
  case ENV['RAILS_VERSION']
35
+ when /^5.[12]/
36
+ gem 'sass-rails', '~> 5.0'
35
37
  when /^4.2/
36
38
  gem 'responders', '~> 2.0'
37
39
  gem 'sass-rails', '>= 5.0'
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Blacklight
2
2
 
3
- [![Build Status](https://travis-ci.org/projectblacklight/blacklight.png?branch=master)](https://travis-ci.org/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight) [![Coverage Status](https://coveralls.io/repos/github/projectblacklight/blacklight/badge.svg?branch=master)](https://coveralls.io/github/projectblacklight/blacklight?branch=master)
3
+ [![Build Status](https://travis-ci.org/projectblacklight/blacklight.png?branch=master)](https://travis-ci.org/projectblacklight/blacklight) [![Gem Version](https://badge.fury.io/rb/blacklight.png)](http://badge.fury.io/rb/blacklight) [![Test Coverage](https://api.codeclimate.com/v1/badges/83fd270492c136594e59/test_coverage)](https://codeclimate.com/github/projectblacklight/blacklight/test_coverage)
4
4
 
5
5
  Blacklight is an open source Solr user interface discovery platform.
6
6
  You can use Blacklight to enable searching and browsing of your collections.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.19.2
1
+ 6.24.0
@@ -11,6 +11,13 @@ module Blacklight
11
11
  "#{main_content_classes} show-document"
12
12
  end
13
13
 
14
+ ##
15
+ # Attributes to add to the <html> tag (e.g. lang and dir)
16
+ # @return [Hash]
17
+ def html_tag_attributes
18
+ { lang: I18n.locale }
19
+ end
20
+
14
21
  ##
15
22
  # Classes added to a document's sidebar div
16
23
  # @return [String]
@@ -144,6 +144,22 @@ module Blacklight::Document
144
144
  def unique_key
145
145
  @unique_key ||= 'id'
146
146
  end
147
+
148
+ # Define an attribute reader on a document model
149
+ # @Example
150
+ # class SolrDocument
151
+ # include Blacklight::Solr::Document
152
+ # attribute :title, Blacklight::Types::String, 'title_tesim'
153
+ # end
154
+ #
155
+ # doc = SolrDocument.new(title_tesim: ["One flew over the cuckoo's nest"])
156
+ # doc.title
157
+ # #=> "One flew over the cuckoo's nest"
158
+ def attribute(name, type, field)
159
+ define_method name do
160
+ type.coerce(self[field])
161
+ end
162
+ end
147
163
  end
148
164
 
149
165
  private
@@ -0,0 +1,28 @@
1
+ module Blacklight
2
+ # These are data types that blacklight can use to coerce values from the index
3
+ module Types
4
+ class Array
5
+ def self.coerce(input)
6
+ ::Array.wrap(input)
7
+ end
8
+ end
9
+
10
+ class String
11
+ def self.coerce(input)
12
+ ::Array.wrap(input).first
13
+ end
14
+ end
15
+
16
+ class Date
17
+ def self.coerce(input)
18
+ field = String.coerce(input)
19
+ return if field.blank?
20
+ begin
21
+ ::Date.parse(field)
22
+ rescue ArgumentError
23
+ Rails.logger.info "Unable to parse date: #{field.first.inspect}"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,10 +1,10 @@
1
1
  <div class="prev_next_links btn-group pull-left">
2
2
  <%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), params: search_state.to_h, param_name: blacklight_config.facet_paginator_class.request_keys[:page], class: 'btn btn-link', data: { ajax_modal: "preserve" } do %>
3
- <span class="disabled btn btn-disabled"><%= raw(t('views.pagination.previous')) %></span>
3
+ <%= content_tag :span, raw(t('views.pagination.previous')), class: 'disabled btn btn-disabled' %>
4
4
  <% end %>
5
5
 
6
6
  <%= link_to_next_page @pagination, raw(t('views.pagination.next')), params: search_state.to_h, param_name: blacklight_config.facet_paginator_class.request_keys[:page], class: 'btn btn-link', data: { ajax_modal: "preserve" } do %>
7
- <span class="disabled btn btn-disabled"><%= raw(t('views.pagination.next')) %></span>
7
+ <%= content_tag :span, raw(t('views.pagination.next')), class: 'disabled btn btn-disabled' %>
8
8
  <% end %>
9
9
  </div>
10
10
 
@@ -7,7 +7,7 @@
7
7
  </button>
8
8
  <ul class="dropdown-menu" role="menu">
9
9
  <%- per_page_options_for_select.each do |(label, count)| %>
10
- <li><%= link_to(label, url_for(search_state.params_for_search(per_page: count))) %></li>
10
+ <li role="menuitem"><%= link_to(label, url_for(search_state.params_for_search(per_page: count))) %></li>
11
11
  <%- end -%>
12
12
  </ul>
13
13
  </div>
@@ -1,4 +1,4 @@
1
- <%= form_tag search_action_url, method: :get, class: 'search-query-form clearfix navbar-form', role: 'search' do %>
1
+ <%= form_tag search_action_url, method: :get, class: 'search-query-form clearfix navbar-form', role: 'search', 'aria-label' => t('blacklight.search.form.submit') do %>
2
2
  <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:q, :search_field, :qt, :page, :utf8)) %>
3
3
  <div class="input-group">
4
4
  <% if search_fields.length > 1 %>
@@ -1,4 +1,4 @@
1
- <div id="sortAndPerPage" class="clearfix">
1
+ <div id="sortAndPerPage" class="clearfix" role="navigation" aria-label="<%= t('blacklight.search.per_page.aria_label')%>">
2
2
  <%= render :partial => "paginate_compact", :object => @response if show_pagination? %>
3
3
  <%= render_results_collection_tools wrapping_class: "search-widgets pull-right" %>
4
4
  </div>
@@ -6,7 +6,7 @@
6
6
 
7
7
  <ul class="dropdown-menu" role="menu">
8
8
  <%- active_sort_fields.each do |sort_key, field_config| %>
9
- <li><%= link_to(sort_field_label(sort_key), url_for(search_state.params_for_search(sort: sort_key))) %></li>
9
+ <li role="menuitem"><%= link_to(sort_field_label(sort_key), url_for(search_state.params_for_search(sort: sort_key))) %></li>
10
10
  <%- end -%>
11
11
  </ul>
12
12
  </div>
@@ -1,5 +1,5 @@
1
- <%- if has_thumbnail?(document) && tn = render_thumbnail_tag(document, {}, :counter => document_counter_with_offset(document_counter)) %>
1
+ <%- if has_thumbnail?(document) && tn = render_thumbnail_tag(document, { alt: '' }, 'aria-hidden': true, tabindex: -1, counter: document_counter_with_offset(document_counter)) %>
2
2
  <div class="document-thumbnail">
3
3
  <%= tn %>
4
- </div>
5
- <%- end %>
4
+ </div>
5
+ <%- end %>
@@ -1,5 +1,7 @@
1
1
  <div class="modal-header">
2
- <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-hidden="true">×</button>
2
+ <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
3
+ <span aria-hidden="true">&times;</span>
4
+ </button>
3
5
  <h1 class="modal-title"><%= t('blacklight.email.form.title') %></h1>
4
6
  </div>
5
7
  <%= render :partial => 'email_form' %>
@@ -1,9 +1,11 @@
1
1
  <div class="modal-header">
2
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
2
+ <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
3
+ <span aria-hidden="true">&times;</span>
4
+ </button>
3
5
  <h1><%= t('blacklight.email.form.title') %></h1>
4
6
  </div>
5
7
 
6
8
  <div class="modal-body">
7
9
  <%= render :partial=>'/flash_msg' %>
8
10
  <span class="ajax-close-modal"></span>
9
- </div>
11
+ </div>
@@ -3,7 +3,9 @@
3
3
  </div>
4
4
 
5
5
  <div class="modal-header">
6
- <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-hidden="true">×</button>
6
+ <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
7
+ <span aria-hidden="true">&times;</span>
8
+ </button>
7
9
 
8
10
  <h3 class="modal-title"><%= facet_field_label(@facet.key) %></h3>
9
11
  <%= render partial: 'facet_index_navigation' if @facet.index_range && @display_facet.index? %>
@@ -1,5 +1,8 @@
1
1
  <div class="modal-header">
2
- <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-hidden="true">×</button>
2
+ <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
3
+ <span aria-hidden="true">&times;</span>
4
+ </button>
5
+
3
6
  <h1 class="modal-title"><%= t('blacklight.sms.form.title') %></h1>
4
7
  </div>
5
8
  <%= render :partial => 'sms_form' %>
@@ -1,9 +1,12 @@
1
1
  <div class="modal-header">
2
- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
2
+ <button type="button" class="ajax-modal-close close" data-dismiss="modal" aria-label="<%= t('blacklight.modal.close') %>">
3
+ <span aria-hidden="true">&times;</span>
4
+ </button>
5
+
3
6
  <h1 class="modal-title"><%= t('blacklight.sms.form.title') %></h1>
4
7
  </div>
5
8
 
6
9
  <div class="modal-body">
7
10
  <%= render :partial=>'/flash_msg' %>
8
11
  <span class="ajax-close-modal"></span>
9
- </div>
12
+ </div>
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" class="no-js">
2
+ <%= content_tag :html, class: 'no-js', **html_tag_attributes do %>
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -41,4 +41,4 @@
41
41
 
42
42
  <%= render :partial => 'shared/footer' %>
43
43
  </body>
44
- </html>
44
+ <% end %>
@@ -1,5 +1,5 @@
1
- <div id="ajax-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal menu" aria-hidden="true">
2
- <div class="modal-dialog">
1
+ <div id="ajax-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
2
+ <div class="modal-dialog" role="document">
3
3
  <div class="modal-content">
4
4
  </div>
5
5
  </div>
@@ -40,11 +40,10 @@ Gem::Specification.new do |s|
40
40
  s.add_development_dependency "rspec-its"
41
41
  s.add_development_dependency "rspec-collection_matchers", ">= 1.0"
42
42
  s.add_development_dependency "capybara", '>= 2', '< 4'
43
- s.add_development_dependency 'chromedriver-helper', '< 2.0.0' # 2.1.0 is causing "Unable to find chromedriver" on Travis
43
+ s.add_development_dependency 'webdrivers', '~> 3.0'
44
44
  s.add_development_dependency "selenium-webdriver", '>= 3.13.1'
45
45
  s.add_development_dependency 'engine_cart', '~> 2.1'
46
46
  s.add_development_dependency "equivalent-xml"
47
- s.add_development_dependency "coveralls"
48
47
  s.add_development_dependency "simplecov"
49
48
  s.add_development_dependency "rubocop", '~> 0.47.0' # pending release of 0.48.1
50
49
  s.add_development_dependency "rubocop-rspec", '~> 1.8.0'
@@ -25,6 +25,9 @@ de:
25
25
  and: 'und'
26
26
  or: 'oder'
27
27
 
28
+ modal:
29
+ close: Schließen
30
+
28
31
  bookmarks:
29
32
  title: 'Lesezeichen'
30
33
  page_title: 'Lesezeichen - %{application_name}'
@@ -157,6 +160,7 @@ de:
157
160
  button_label: '%{count} pro Seite'
158
161
  title: 'Anzahl der Ergebnisse pro Seite angezeigt werden'
159
162
  submit: 'Aktualisieren'
163
+ aria_label: 'Ergebnisnavigation'
160
164
  sort:
161
165
  label: 'Ordnen bei %{field}'
162
166
  submit: 'Ergebnisse ordnen'
@@ -25,6 +25,9 @@ en:
25
25
  and: 'and'
26
26
  or: 'or'
27
27
 
28
+ modal:
29
+ close: "Close"
30
+
28
31
  bookmarks:
29
32
  title: 'Bookmarks'
30
33
  page_title: 'Bookmarks - %{application_name}'
@@ -157,6 +160,7 @@ en:
157
160
  button_label: '%{count} per page'
158
161
  title: 'Number of results to display per page'
159
162
  submit: 'Update'
163
+ aria_label: 'Results navigation'
160
164
  sort:
161
165
  label: 'Sort by %{field}'
162
166
  submit: 'sort results'
@@ -25,6 +25,9 @@ es:
25
25
  and: 'y'
26
26
  or: 'o'
27
27
 
28
+ modal:
29
+ close: cerca
30
+
28
31
  bookmarks:
29
32
  title: 'Favoritos'
30
33
  page_title: 'Favoritos - %{application_name}'
@@ -157,6 +160,7 @@ es:
157
160
  button_label: '%{count} por página'
158
161
  title: 'El número de resultados a mostrar por página'
159
162
  submit: 'Actualización'
163
+ aria_label: 'Navegación de resultados'
160
164
  sort:
161
165
  label: 'Ordenar por %{field}'
162
166
  submit: 'Resultados de ordenación'
@@ -25,6 +25,9 @@ fr:
25
25
  and: 'et'
26
26
  or: 'ou'
27
27
 
28
+ modal:
29
+ close: Fermer
30
+
28
31
  bookmarks:
29
32
  title: 'Favoris'
30
33
  page_title: 'Favoris - %{application_name}'
@@ -162,6 +165,7 @@ fr:
162
165
  button_label: '%{count} par page'
163
166
  title: 'Nombre de résultats à afficher par page'
164
167
  submit: 'mettre à jour'
168
+ aria_label: 'Navigation dans les résultats'
165
169
  sort:
166
170
  label: 'Trier par %{field}'
167
171
  submit: 'trier les résultats'
@@ -25,6 +25,9 @@ it:
25
25
  and: 'e'
26
26
  or: 'o'
27
27
 
28
+ modal:
29
+ close: Vicino
30
+
28
31
  bookmarks:
29
32
  title: 'Preferiti'
30
33
  page_title: 'Preferiti - %{application_name}'
@@ -157,6 +160,7 @@ it:
157
160
  button_label: '%{count} per pagina'
158
161
  title: 'Risultati per pagina'
159
162
  submit: 'Aggiorna'
163
+ aria_label: 'Navigazione dei risultati'
160
164
  sort:
161
165
  label: 'Ordina per %{field}'
162
166
  submit: 'Ordina i risultati'
@@ -25,6 +25,9 @@ pt-BR:
25
25
  and: 'e'
26
26
  or: 'ou'
27
27
 
28
+ modal:
29
+ close: Fechar
30
+
28
31
  bookmarks:
29
32
  title: 'Favoritos'
30
33
  page_title: 'Favoritos - %{application_name}'
@@ -156,6 +159,7 @@ pt-BR:
156
159
  button_label: '%{count} por página'
157
160
  title: 'Número de resultados para mostrar por página'
158
161
  submit: 'Atualizar'
162
+ aria_label: 'Navegação de resultados'
159
163
  sort:
160
164
  label: 'Ordenar por %{field}'
161
165
  submit: 'ordenar resultados'
@@ -160,6 +160,7 @@ sq:
160
160
  button_label: '%{count} për faqe'
161
161
  title: 'Numri i rezultateve që do të shfaqen për faqe'
162
162
  submit: 'Përditëso'
163
+ aria_label: 'Rezultatet e lundrimit'
163
164
  sort:
164
165
  label: 'Klasifikoj sipas %{field}'
165
166
  submit: 'klasifiko rezultatet'
@@ -160,6 +160,7 @@ zh:
160
160
  button_label: '%{count} 每页'
161
161
  title: '每页显示结果数'
162
162
  submit: '更新'
163
+ aria_label: '结果导航'
163
164
  sort:
164
165
  label: '按 %{field} 排序'
165
166
  submit: '排序'
@@ -7,7 +7,7 @@ Blacklight::Engine.routes.draw do
7
7
  put "saved_searches/save/:id", :to => "saved_searches#save", :as => "save_search"
8
8
  delete "saved_searches/forget/:id", :to => "saved_searches#forget", :as => "forget_search"
9
9
  post "saved_searches/forget/:id", :to => "saved_searches#forget"
10
- post "/catalog/:id/track", to: 'catalog#track', as: 'track_search_context'
10
+ post "/catalog/:id/track", to: 'catalog#track', as: 'track_search_context', constraints: { id: Blacklight::Engine.config.routes.identifier_constraint }
11
11
 
12
12
  resources :suggest, only: :index, defaults: { format: 'json' }
13
13
  end
@@ -7,7 +7,7 @@ module Blacklight
7
7
  require 'twitter-typeahead-rails'
8
8
 
9
9
  # BlacklightHelper is needed by all helpers, so we inject it
10
- # into action view base here.
10
+ # into action view base here.
11
11
  initializer 'blacklight.helpers' do |app|
12
12
  ActionView::Base.send :include, BlacklightHelper
13
13
  end
@@ -43,8 +43,12 @@ module Blacklight
43
43
  'Cricket' => 'mms.mycricket.com'
44
44
  }
45
45
 
46
+ config.routes = OpenStruct.new
47
+ # Set identifier_constraint to enforce a format for the document identifiers
48
+ config.routes.identifier_constraint = /[\w-]+/
49
+
46
50
  config.bookmarks_http_method = :post
47
-
51
+
48
52
  config.email_regexp = defined?(Devise) ? Devise.email_regexp : /\A[^@\s]+@[^@\s]+\z/
49
53
  end
50
54
  end
@@ -22,7 +22,7 @@ module Blacklight
22
22
  def to_h
23
23
  @table
24
24
  end
25
-
25
+
26
26
  def select *args, &block
27
27
  self.class.new to_h.select(*args, &block)
28
28
  end
@@ -58,7 +58,7 @@ module Blacklight
58
58
  end
59
59
 
60
60
  ##
61
- # An OpenStruct refinement that converts any hash-keys into
61
+ # An OpenStruct refinement that converts any hash-keys into
62
62
  # additional instances of NestedOpenStructWithHashAccess
63
63
  class NestedOpenStructWithHashAccess < OpenStructWithHashAccess
64
64
  attr_reader :nested_class
@@ -161,7 +161,11 @@ module Blacklight
161
161
  len = args.length
162
162
 
163
163
  if len.zero?
164
- new_ostruct_member(mid)
164
+ if respond_to?(:new_ostruct_member!, true)
165
+ new_ostruct_member!(mid)
166
+ else
167
+ new_ostruct_member(mid)
168
+ end
165
169
  @table[mid]
166
170
  else
167
171
  super
@@ -308,7 +308,6 @@
308
308
  <analyzer>
309
309
  <tokenizer class="solr.StandardTokenizerFactory"/>
310
310
  <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
311
- <filter class="solr.StandardFilterFactory"/>
312
311
  <filter class="solr.LowerCaseFilterFactory"/>
313
312
  <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
314
313
  </analyzer>
@@ -317,7 +316,6 @@
317
316
  <fieldType class="solr.TextField" name="textSuggest" positionIncrementGap="100">
318
317
  <analyzer>
319
318
  <tokenizer class="solr.KeywordTokenizerFactory"/>
320
- <filter class="solr.StandardFilterFactory"/>
321
319
  <filter class="solr.LowerCaseFilterFactory"/>
322
320
  <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
323
321
  </analyzer>
@@ -1,6 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe "Search Page" do
3
+ RSpec.describe "Search Page" do
4
+ it 'declares the page language in the html lang attribute' do
5
+ visit root_path
6
+ expect(page).to have_selector('html[lang=en]')
7
+ end
8
+
4
9
  it "shows welcome" do
5
10
  visit root_path
6
11
  expect(page).to have_selector("input#q")
@@ -116,4 +121,3 @@ describe "Search Page" do
116
121
  expect(page).to have_content "No results found for your search"
117
122
  end
118
123
  end
119
-
@@ -35,4 +35,14 @@ describe LayoutHelper do
35
35
  expect(helper.container_classes).to eq 'container'
36
36
  end
37
37
  end
38
+
39
+ describe '#html_tag_attributes' do
40
+ before do
41
+ allow(I18n).to receive(:locale).and_return('x')
42
+ end
43
+
44
+ it 'returns the current locale as the lang' do
45
+ expect(helper.html_tag_attributes).to include lang: 'x'
46
+ end
47
+ end
38
48
  end
@@ -18,10 +18,34 @@ RSpec.describe SolrDocument do
18
18
  it { is_expected.to eq ['Book'] }
19
19
  end
20
20
  end
21
-
21
+
22
22
  describe "#id" do
23
23
  subject { solrdoc.id }
24
24
  it { is_expected.to eq '00282214' }
25
25
  end
26
26
  end
27
+
28
+ describe '.attribute' do
29
+ subject(:title) { document.title }
30
+ let(:doc_class) do
31
+ Class.new(SolrDocument) do
32
+ attribute :title, Blacklight::Types::String, 'title_tesim'
33
+ attribute :author, Blacklight::Types::Array, 'author_tesim'
34
+ attribute :date, Blacklight::Types::Date, 'date_dtsi'
35
+
36
+ end
37
+ end
38
+ let(:document) do
39
+ doc_class.new(id: '123',
40
+ title_tesim: ['Good Omens'],
41
+ author_tesim: ['Neil Gaiman', 'Terry Pratchett'],
42
+ date_dtsi: '1990-01-01T00:00:00Z')
43
+ end
44
+
45
+ it "casts the attributes" do
46
+ expect(document.title).to eq 'Good Omens'
47
+ expect(document.author).to eq ['Neil Gaiman', 'Terry Pratchett']
48
+ expect(document.date).to eq Date.new(1990)
49
+ end
50
+ end
27
51
  end
@@ -21,6 +21,22 @@ describe "Routing" do
21
21
  end
22
22
  end
23
23
 
24
+ describe 'tracking' do
25
+ context 'when the routing constraint is set to allow periods' do
26
+ before do
27
+ if Rails.version < '5.2.0'
28
+ skip 'requires https://github.com/rails/rails/pull/22435'
29
+ end
30
+ allow(Blacklight::Engine.config.routes).to receive(:identifier_constraint).and_return(%r{[^/]+})
31
+ Rails.application.reload_routes!
32
+ end
33
+
34
+ it 'routes to #track' do
35
+ expect(post('/catalog/gallica.bnf.fr/track')).to route_to('catalog#track', id: 'gallica.bnf.fr')
36
+ end
37
+ end
38
+ end
39
+
24
40
 
25
41
  describe "solr_document_path for SolrDocument", :test => true do
26
42
  it "routes correctly" do
@@ -5,14 +5,9 @@
5
5
 
6
6
  ENV["RAILS_ENV"] ||= 'test'
7
7
 
8
- if ENV["COVERAGE"] or ENV["CI"]
9
- require 'simplecov'
10
- require 'coveralls'
11
-
12
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
13
- SimpleCov.start do
14
- add_filter "/spec/"
15
- end
8
+ require 'simplecov'
9
+ SimpleCov.start do
10
+ add_filter "/spec/"
16
11
  end
17
12
 
18
13
  require 'rsolr'
@@ -25,20 +20,10 @@ require 'rspec/rails'
25
20
  require 'rspec/its'
26
21
  require 'rspec/collection_matchers'
27
22
  require 'capybara/rspec'
28
- require 'selenium-webdriver'
23
+ require 'webdrivers'
29
24
  require 'equivalent-xml'
30
25
 
31
- Capybara.javascript_driver = :headless_chrome
32
-
33
- Capybara.register_driver :headless_chrome do |app|
34
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
35
- chromeOptions: { args: %w[headless disable-gpu] }
36
- )
37
-
38
- Capybara::Selenium::Driver.new(app,
39
- browser: :chrome,
40
- desired_capabilities: capabilities)
41
- end
26
+ Capybara.javascript_driver = :selenium_chrome_headless
42
27
 
43
28
  # Requires supporting ruby files with custom matchers and macros, etc,
44
29
  # in spec/support/ and its subdirectories.
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: 6.19.2
4
+ version: 6.24.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: 2019-01-11 00:00:00.000000000 Z
20
+ date: 2021-01-23 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -234,19 +234,19 @@ dependencies:
234
234
  - !ruby/object:Gem::Version
235
235
  version: '4'
236
236
  - !ruby/object:Gem::Dependency
237
- name: chromedriver-helper
237
+ name: webdrivers
238
238
  requirement: !ruby/object:Gem::Requirement
239
239
  requirements:
240
- - - "<"
240
+ - - "~>"
241
241
  - !ruby/object:Gem::Version
242
- version: 2.0.0
242
+ version: '3.0'
243
243
  type: :development
244
244
  prerelease: false
245
245
  version_requirements: !ruby/object:Gem::Requirement
246
246
  requirements:
247
- - - "<"
247
+ - - "~>"
248
248
  - !ruby/object:Gem::Version
249
- version: 2.0.0
249
+ version: '3.0'
250
250
  - !ruby/object:Gem::Dependency
251
251
  name: selenium-webdriver
252
252
  requirement: !ruby/object:Gem::Requirement
@@ -289,20 +289,6 @@ dependencies:
289
289
  - - ">="
290
290
  - !ruby/object:Gem::Version
291
291
  version: '0'
292
- - !ruby/object:Gem::Dependency
293
- name: coveralls
294
- requirement: !ruby/object:Gem::Requirement
295
- requirements:
296
- - - ">="
297
- - !ruby/object:Gem::Version
298
- version: '0'
299
- type: :development
300
- prerelease: false
301
- version_requirements: !ruby/object:Gem::Requirement
302
- requirements:
303
- - - ">="
304
- - !ruby/object:Gem::Version
305
- version: '0'
306
292
  - !ruby/object:Gem::Dependency
307
293
  name: simplecov
308
294
  requirement: !ruby/object:Gem::Requirement
@@ -478,6 +464,7 @@ files:
478
464
  - app/presenters/blacklight/rendering/terminator.rb
479
465
  - app/presenters/blacklight/show_presenter.rb
480
466
  - app/services/blacklight/field_retriever.rb
467
+ - app/values/blacklight/types.rb
481
468
  - app/views/_flash_msg.html.erb
482
469
  - app/views/_user_util_links.html.erb
483
470
  - app/views/blacklight/nav/_bookmark.html.erb
@@ -784,8 +771,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
784
771
  - !ruby/object:Gem::Version
785
772
  version: '0'
786
773
  requirements: []
787
- rubyforge_project:
788
- rubygems_version: 2.7.6
774
+ rubygems_version: 3.1.4
789
775
  signing_key:
790
776
  specification_version: 4
791
777
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)