blacklight-hierarchy 4.2.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79579c36f70d48f54d5968f3123e636b59dd5bcc267603967a4c161f991d1da8
4
- data.tar.gz: c7046b2a00788761b9901cb625f4b845db1d91877cce3c09a07a76751bb84ea3
3
+ metadata.gz: d7bacf2b0748d1154d75223505d631c5d38edd91a1bb72f514bd0809fb57cce8
4
+ data.tar.gz: 752c9cb4ba854489493681452862fcbb8dd332d0a1c505c849890f2ae0d85184
5
5
  SHA512:
6
- metadata.gz: 0e26f0a52342f53fe9e06c1c253dd46a44dbc2cce4590edeafe978e410b71f0471e2ec70b65844a5cd0bf3b1e30ae8e0be25c0733be739dd6f7508f0d16afc0b
7
- data.tar.gz: 11d377fc4e98d6a7352b4db13c85d8ac3431531604ce55ed1185b2c2c7291f7e4df771954f3e3ddbfce73ed551212843416b4c0fecdd61d289eb8455e9ad387a
6
+ metadata.gz: baf85f7b64a20872faa888b8513d82b469757325a0da6dfa597f653f8040059413cb42f8a9cd8ec41636529a335b4c7247173a16447d85ee1f81adee91ae6a07
7
+ data.tar.gz: 966af183ac26d3db3346018af9bff71e714d5dbc22af73664fc4bab5d8eba816cec2c564408c4dd050685c1cc14d52f13b09c14b50d98c3f5e4495174490cb29
@@ -0,0 +1,53 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby: [2.6, 2.7]
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby }}
28
+ - name: Install dependencies
29
+ run: bundle install
30
+ - name: Run tests
31
+ run: bundle exec rake ci
32
+ env:
33
+ ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
34
+ test_rails5:
35
+ runs-on: ubuntu-latest
36
+ strategy:
37
+ matrix:
38
+ ruby: [2.5, 2.6]
39
+ steps:
40
+ - uses: actions/checkout@v2
41
+ - name: Set up Ruby
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: ${{ matrix.ruby }}
45
+ - name: Install dependencies
46
+ run: bundle install
47
+ env:
48
+ RAILS_VERSION: 5.2.4.2
49
+ - name: Run tests
50
+ run: bundle exec rake ci
51
+ env:
52
+ RAILS_VERSION: 5.2.4.2
53
+ ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
@@ -26,7 +26,7 @@ module Blacklight
26
26
 
27
27
  def qfacet_selected?
28
28
  config = helpers.facet_configuration_for_field(field_name)
29
- helpers.search_state.has_facet?(config, value: item.qvalue)
29
+ helpers.search_state.filter(config).include?(item.qvalue)
30
30
  end
31
31
  end
32
32
  end
@@ -1,6 +1,8 @@
1
1
  require 'deprecation'
2
2
 
3
3
  module Blacklight::HierarchyHelper
4
+ extend Deprecation
5
+
4
6
  # Putting bare HTML strings in a helper sucks. But in this case, with a
5
7
  # lot of recursive tree-walking going on, it's an order of magnitude faster
6
8
  # than either render(:partial) or content_tag
@@ -8,27 +10,29 @@ module Blacklight::HierarchyHelper
8
10
  item = data[:_]
9
11
  subset = data.reject { |k, _v| !k.is_a?(String) }
10
12
 
11
- li_class = subset.empty? ? 'h-leaf' : 'h-node'
12
- id = SecureRandom.uuid
13
- ul = ''
14
- li = ''
15
- li << facet_toggle_button(field_name, id) if subset.any?
16
- li << if item.nil?
17
- key
18
- elsif qfacet_selected?(field_name, item)
19
- render_selected_qfacet_value(field_name, item)
20
- else
21
- render_qfacet_value(field_name, item, id: id)
22
- end
23
-
24
- unless subset.empty?
25
- subul = subset.keys.sort.collect do |subkey|
26
- render_facet_hierarchy_item(field_name, subset[subkey], subkey)
27
- end.join('')
28
- ul = "<ul role=\"group\">#{subul}</ul>".html_safe
29
- end
13
+ Deprecation.silence(Blacklight::HierarchyHelper) do
14
+ li_class = subset.empty? ? 'h-leaf' : 'h-node'
15
+ id = SecureRandom.uuid
16
+ ul = ''
17
+ li = ''
18
+ li << facet_toggle_button(field_name, id) if subset.any?
19
+ li << if item.nil?
20
+ key
21
+ elsif qfacet_selected?(field_name, item)
22
+ render_selected_qfacet_value(field_name, item)
23
+ else
24
+ render_qfacet_value(field_name, item, id: id)
25
+ end
26
+
27
+ unless subset.empty?
28
+ subul = subset.keys.sort.collect do |subkey|
29
+ render_facet_hierarchy_item(field_name, subset[subkey], subkey)
30
+ end.join('')
31
+ ul = "<ul role=\"group\">#{subul}</ul>".html_safe
32
+ end
30
33
 
31
- %(<li class="#{li_class}" role="treeitem">#{li.html_safe}#{ul.html_safe}</li>).html_safe
34
+ %(<li class="#{li_class}" role="treeitem">#{li.html_safe}#{ul.html_safe}</li>).html_safe
35
+ end
32
36
  end
33
37
  deprecation_deprecate :render_facet_hierarchy_item
34
38
 
@@ -54,10 +58,12 @@ module Blacklight::HierarchyHelper
54
58
  deprecation_deprecate :render_hierarchy
55
59
 
56
60
  def render_qfacet_value(facet_solr_field, item, options = {})
57
- id = options.delete(:id)
58
- facet_config = facet_configuration_for_field(facet_solr_field)
59
- path_for_facet = facet_item_presenter(facet_config, item.qvalue, facet_solr_field).href
60
- (link_to_unless(options[:suppress_link], item.value, path_for_facet, id: id, class: 'facet_select') + ' ' + render_facet_count(item.hits)).html_safe
61
+ Deprecation.silence(Blacklight::FacetsHelperBehavior) do
62
+ id = options.delete(:id)
63
+ facet_config = facet_configuration_for_field(facet_solr_field)
64
+ path_for_facet = facet_item_presenter(facet_config, item.qvalue, facet_solr_field).href
65
+ (link_to_unless(options[:suppress_link], item.value, path_for_facet, id: id, class: 'facet_select') + ' ' + render_facet_count(item.hits)).html_safe
66
+ end
61
67
  end
62
68
  deprecation_deprecate :render_qfacet_value
63
69
 
@@ -18,8 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  s.require_paths = ['lib']
20
20
 
21
- # A version of blacklight with view_component is required
22
- s.add_dependency 'blacklight', '~> 7.9'
21
+ s.add_dependency 'blacklight', '~> 7.13'
23
22
  s.add_dependency 'rails', '>= 5.1', '< 7'
24
23
  s.add_dependency 'deprecation'
25
24
 
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Hierarchy
3
- VERSION = '4.2.1'.freeze
3
+ VERSION = '4.3.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-hierarchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-09 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blacklight
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '7.9'
19
+ version: '7.13'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '7.9'
26
+ version: '7.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,7 @@ extensions: []
150
150
  extra_rdoc_files: []
151
151
  files:
152
152
  - ".coveralls.yml"
153
+ - ".github/workflows/ruby.yml"
153
154
  - ".gitignore"
154
155
  - ".rspec"
155
156
  - ".rubocop.yml"
@@ -207,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
208
  - !ruby/object:Gem::Version
208
209
  version: '0'
209
210
  requirements: []
210
- rubygems_version: 3.1.2
211
+ rubygems_version: 3.1.4
211
212
  signing_key:
212
213
  specification_version: 4
213
214
  summary: Hierarchical Facets for Blacklight