blacklight 7.6.0 → 7.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '087bb21bf2c345072d1fade572f09741ab819c5f44e8b563c6818530c1da6da8'
4
- data.tar.gz: eebaefbf5c6ec5b3f245ef17ce59c006ac09ffefb047f336aa185cace7bd293e
3
+ metadata.gz: 25f35365c3e8f37c1a405aa2c3ed398c82643f275ba6326dd678ad39edb3c101
4
+ data.tar.gz: a55e315a722c78ceed677a739d2dd3debd6f332849e50c7ecb9e269bbf83449e
5
5
  SHA512:
6
- metadata.gz: edce2eb3d01ea8ea635515c70db1b9e584ea96d4a360378897bc8340a94919f9ffa6f7be6824aa644c07929b3623f0f90f14280eef71b180f0d2022da8f0f677
7
- data.tar.gz: ac8cc8d0432746cc80b01d330cc6bad45fc54ac4a2386a11c7c54285a1202ced0cd5b0f51f603e0281c4e33520565514ffadc8f549fa66ca0fb45533afe8c774
6
+ metadata.gz: a7df6ed0d222bbeff7e710066370d8e298bdec544663fb486c72a20b5a7ec85868d29e984982f1bb2a61e2e0ed2bd17ce9880debf1df9e155d075e49fb284ad5
7
+ data.tar.gz: b04f3d9435d93a6bf144eba9b942b747d4632dd577916f62273813611688c6f02d5faf9263cd84219389609fe2dd687aef91c1b0d4ba5e46b8122a595f3e3f25
data/.gitignore CHANGED
@@ -14,6 +14,5 @@ log/*
14
14
  tmp/*
15
15
  pkg/*
16
16
  .internal_test_app
17
- .vagrant
18
17
  /spec/examples.txt
19
18
  node_modules/*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.6.0
1
+ 7.7.0
@@ -91,10 +91,11 @@ module Blacklight::ConfigurationHelperBehavior
91
91
  end
92
92
 
93
93
  # Shortcut for commonly needed operation, look up display
94
- # label for the key specified. Returns "Keyword" if a label
95
- # can't be found.
94
+ # label for the key specified.
96
95
  def label_for_search_field(key)
97
96
  field_config = blacklight_config.search_fields[key]
97
+ return if key.nil? && field_config.nil?
98
+
98
99
  field_config ||= Blacklight::Configuration::NullField.new(key: key)
99
100
 
100
101
  field_config.display_label('search')
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Blacklight
4
4
  class Icon
5
- attr_reader :icon_name, :aria_hidden, :label, :role
5
+ attr_reader :icon_name, :aria_hidden, :label, :role, :additional_options
6
6
  ##
7
7
  # @param [String, Symbol] icon_name
8
8
  # @param [Hash] options
@@ -10,12 +10,14 @@ module Blacklight
10
10
  # @param [Boolean] aria_hidden include aria_hidden attribute
11
11
  # @param [Boolean] label include <title> and aria-label as part of svg
12
12
  # @param [String] role role attribute to be included in svg
13
- def initialize(icon_name, classes: '', aria_hidden: false, label: true, role: 'img')
13
+ # @param [Hash] additional_options the way forward instead of named arguments
14
+ def initialize(icon_name, classes: '', aria_hidden: false, label: true, role: 'img', additional_options: {})
14
15
  @icon_name = icon_name
15
16
  @classes = classes
16
17
  @aria_hidden = aria_hidden
17
18
  @label = label
18
19
  @role = role
20
+ @additional_options = additional_options
19
21
  end
20
22
 
21
23
  ##
@@ -30,11 +32,11 @@ module Blacklight
30
32
  end
31
33
 
32
34
  def icon_label
33
- I18n.translate("blacklight.icon.#{icon_name}", default: "#{icon_name} icon")
35
+ I18n.translate("blacklight.icon.#{icon_name_context}", default: "#{icon_name} icon")
34
36
  end
35
37
 
36
38
  def unique_id
37
- @unique_id ||= "bl-icon-#{icon_name}-#{SecureRandom.hex(8)}"
39
+ @unique_id ||= "bl-icon-#{icon_name_context}-#{SecureRandom.hex(8)}"
38
40
  end
39
41
 
40
42
  ##
@@ -66,6 +68,10 @@ module Blacklight
66
68
 
67
69
  private
68
70
 
71
+ def icon_name_context
72
+ [icon_name, additional_options[:label_context]].compact.join('_')
73
+ end
74
+
69
75
  def file
70
76
  # Rails.application.assets is `nil` in production mode (where compile assets is enabled).
71
77
  # This workaround is based off of this comment: https://github.com/fphilipe/premailer-rails/issues/145#issuecomment-225992564
@@ -1,6 +1,6 @@
1
- <% # Using the Bootstrap Pagination class -%>
2
- <div class='pagination-search-widgets'>
3
- <% if @search_context[:prev] || @search_context[:next] %>
1
+ <% if @search_context[:prev] || @search_context[:next] %>
2
+ <div class='pagination-search-widgets'>
3
+
4
4
  <div class="page-links">
5
5
  <%= link_to_previous_document @search_context[:prev] %> |
6
6
 
@@ -8,5 +8,5 @@
8
8
 
9
9
  <%= link_to_next_document @search_context[:next] %>
10
10
  </div>
11
- <% end %>
12
- </div>
11
+ </div>
12
+ <% end %>
@@ -17,7 +17,7 @@
17
17
  <%= content_for(:head) %>
18
18
  </head>
19
19
  <body class="<%= render_body_class %>">
20
- <nav id="skip-link" role="navigation" aria-label="<%= t('blacklight.skip_links') %>">
20
+ <nav id="skip-link" role="navigation" aria-label="<%= t('blacklight.skip_links.label') %>">
21
21
  <%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
22
22
  <%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
23
23
  <%= content_for(:skip_links) %>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blacklight-frontend",
3
- "version": "7.5.1",
3
+ "version": "7.7.0",
4
4
  "description": "[![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)",
5
5
  "main": "app/assets/javascripts/blacklight",
6
6
  "scripts": {
@@ -274,6 +274,9 @@ RSpec.describe Blacklight::ConfigurationHelperBehavior do
274
274
  it 'handles a missing key' do
275
275
  expect(helper.label_for_search_field('not-found')).to eq 'Not Found'
276
276
  end
277
+ it 'handles a missing field' do
278
+ expect(helper.label_for_search_field(nil)).to eq nil
279
+ end
277
280
  end
278
281
 
279
282
  describe '#sort_field_label' do
@@ -35,6 +35,15 @@ RSpec.describe Blacklight::Icon do
35
35
  .not_to have_css 'svg[aria-labelledby^="bl-icon-search-"]'
36
36
  end
37
37
  end
38
+
39
+ context ' with a label context' do
40
+ subject { described_class.new(:search, classes: 'awesome', aria_hidden: true, additional_options: { label_context: 'foo' }) }
41
+
42
+ it 'adds title' do
43
+ expect(Capybara.string(subject.svg))
44
+ .to have_css 'title[id^="bl-icon-search_foo-"]', text: 'search icon'
45
+ end
46
+ end
38
47
  end
39
48
 
40
49
  describe '#options' do
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe "catalog/_previous_next_doc.html.erb" do
4
+ it "without next or previous does not render content" do
5
+ assign(:search_context, {})
6
+ render
7
+ expect(rendered).not_to have_selector ".pagination-search-widgets"
8
+ end
9
+
10
+ it "with next or previous does render content" do
11
+ assign(:search_context, next: 'foo', prev: 'bar')
12
+ allow(view).to receive(:link_to_previous_document).and_return('')
13
+ allow(view).to receive(:item_page_entry_info).and_return('')
14
+ allow(view).to receive(:link_to_next_document).and_return('')
15
+ render
16
+ expect(rendered).to have_selector ".pagination-search-widgets"
17
+ end
18
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.0
4
+ version: 7.7.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: 2020-02-14 00:00:00.000000000 Z
20
+ date: 2020-03-04 00:00:00.000000000 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: rails
@@ -309,7 +309,6 @@ files:
309
309
  - README.md
310
310
  - Rakefile
311
311
  - VERSION
312
- - Vagrantfile
313
312
  - app/assets/images/blacklight/list.svg
314
313
  - app/assets/images/blacklight/logo.png
315
314
  - app/assets/images/blacklight/search.svg
@@ -594,7 +593,6 @@ files:
594
593
  - lib/railties/blacklight.rake
595
594
  - package-lock.json
596
595
  - package.json
597
- - provision.sh
598
596
  - spec/controllers/alternate_controller_spec.rb
599
597
  - spec/controllers/application_controller_spec.rb
600
598
  - spec/controllers/blacklight/base_spec.rb
@@ -699,6 +697,7 @@ files:
699
697
  - spec/views/catalog/_index.html.erb_spec.rb
700
698
  - spec/views/catalog/_index_header.html.erb_spec.rb
701
699
  - spec/views/catalog/_paginate_compact.html.erb_spec.rb
700
+ - spec/views/catalog/_previous_next_doc.html.erb_spec.rb
702
701
  - spec/views/catalog/_search_header.erb_spec.rb
703
702
  - spec/views/catalog/_show.html.erb_spec.rb
704
703
  - spec/views/catalog/_show_sidebar.erb_spec.rb
@@ -739,7 +738,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
739
738
  - !ruby/object:Gem::Version
740
739
  version: '0'
741
740
  requirements: []
742
- rubygems_version: 3.0.3
741
+ rubygems_version: 3.1.1
743
742
  signing_key:
744
743
  specification_version: 4
745
744
  summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
@@ -849,6 +848,7 @@ test_files:
849
848
  - spec/views/catalog/_index.html.erb_spec.rb
850
849
  - spec/views/catalog/_index_header.html.erb_spec.rb
851
850
  - spec/views/catalog/_paginate_compact.html.erb_spec.rb
851
+ - spec/views/catalog/_previous_next_doc.html.erb_spec.rb
852
852
  - spec/views/catalog/_search_header.erb_spec.rb
853
853
  - spec/views/catalog/_show.html.erb_spec.rb
854
854
  - spec/views/catalog/_show_sidebar.erb_spec.rb
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # -*- mode: ruby -*-
4
- # vi: set ft=ruby :
5
-
6
- # All Vagrant configuration is done below. The "2" in Vagrant.configure
7
- # configures the configuration version (we support older styles for
8
- # backwards compatibility). Please don't change it unless you know what
9
- # you're doing.
10
- Vagrant.configure(2) do |config|
11
- # The most common configuration options are documented and commented below.
12
- # For a complete reference, please see the online documentation at
13
- # https://docs.vagrantup.com.
14
-
15
- # Every Vagrant development environment requires a box. You can search for
16
- # boxes at https://atlas.hashicorp.com/search.
17
- config.vm.box = "bento/centos-7.1"
18
- config.vm.hostname = "blacklight"
19
- config.vm.synced_folder ".", "/home/vagrant/sync", type: 'virtualbox'
20
-
21
- # Disable automatic box update checking. If you disable this, then
22
- # boxes will only be checked for updates when the user runs
23
- # `vagrant box outdated`. This is not recommended.
24
- # config.vm.box_check_update = false
25
-
26
- # Create a forwarded port mapping which allows access to a specific port
27
- # within the machine from a port on the host machine. In the example below,
28
- # accessing "localhost:8080" will access port 80 on the guest machine.
29
- # config.vm.network "forwarded_port", guest: 80, host: 8080
30
- config.vm.network "forwarded_port", guest: 8983, host: 8983, auto_correct: true
31
- config.vm.network "forwarded_port", guest: 3000, host: 3000, auto_correct: true
32
-
33
- # Create a private network, which allows host-only access to the machine
34
- # using a specific IP.
35
- # config.vm.network "private_network", ip: "192.168.33.10"
36
-
37
- # Create a public network, which generally matched to bridged network.
38
- # Bridged networks make the machine appear as another physical device on
39
- # your network.
40
- # config.vm.network "public_network"
41
-
42
- # Share an additional folder to the guest VM. The first argument is
43
- # the path on the host to the actual folder. The second argument is
44
- # the path on the guest to mount the folder. And the optional third
45
- # argument is a set of non-required options.
46
- # config.vm.synced_folder "../data", "/vagrant_data"
47
-
48
- # Provider-specific configuration so you can fine-tune various
49
- # backing providers for Vagrant. These expose provider-specific options.
50
- # Example for VirtualBox:
51
- #
52
- # config.vm.provider "virtualbox" do |vb|
53
- # # Display the VirtualBox GUI when booting the machine
54
- # vb.gui = true
55
- #
56
- # # Customize the amount of memory on the VM:
57
- # vb.memory = "1024"
58
- # end
59
- #
60
- # View the documentation for the provider you are using for more
61
- # information on available options.
62
-
63
- # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
64
- # such as FTP and Heroku are also available. See the documentation at
65
- # https://docs.vagrantup.com/v2/push/atlas.html for more information.
66
- # config.push.define "atlas" do |push|
67
- # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
68
- # end
69
-
70
- # Enable provisioning with a shell script. Additional provisioners such as
71
- # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
72
- # documentation for more information about their specific syntax and use.
73
- # config.vm.provision "shell", inline: <<-SHELL
74
- # sudo apt-get update
75
- # sudo apt-get install -y apache2
76
- # SHELL
77
-
78
- config.vm.provision "shell", path: "provision.sh"
79
- end
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This script is used by the Vagrant file to provision the box
4
-
5
- # Install server dependencies
6
- sudo yum install -y epel-release
7
- sudo yum install -y curl git java-1.8.0-openjdk-devel nodejs yum-utils gcc bzip2 kernel-devel dkms
8
-
9
- # Install RVM and Ruby
10
- su - vagrant -c 'gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3'
11
- su - vagrant -c 'curl -sSL https://get.rvm.io | bash -s stable'
12
- su - vagrant -c 'rvm 2.2.3 --install --default'
13
-
14
- # Install bundler gem and bundle install
15
- su - vagrant -c 'gem install bundler'
16
- su - vagrant -c 'cd /home/vagrant/sync && bundle install'
17
-
18
- # Create the test application
19
- su - vagrant -c 'cd /home/vagrant/sync && rake engine_cart:generate'
20
-
21
- # Output some instructions on what to do next
22
- echo "
23
- Now to start Solr and Blacklight run the following from within the Blacklight directory:
24
-
25
- vagrant ssh
26
- cd /home/vagrant/sync
27
- rake blacklight:server[\"-b 0.0.0.0\"]
28
-
29
- Now you can make changes to Blacklight and see the results.
30
- "