blacklight-hierarchy 5.1.0 → 6.0.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: '05896464df5a8c0e3b6d878771afb366c74eb679a9acbb3cc91b48fc1ec21a67'
4
- data.tar.gz: f6544b27132185268d971b49e634b6f83a4ad8986e78014f65cc121d233a7fb1
3
+ metadata.gz: ee133f1b21f148557b8c40603fde045e4c79fbcf41fd6baa02883a07341c399c
4
+ data.tar.gz: 20badd3b19799248b0da5e8191921e49a3835e52f5c0a044f88f5c4eb27490e8
5
5
  SHA512:
6
- metadata.gz: e239a2df4fac7caf7a0cce0917fd361c04c1a29ba904246275a592769ede706425cf8a4573c2734829f402f43555c76d3b8b393b6a645350644e4aabe60d5659
7
- data.tar.gz: c727ad909a5820f59e4484ef3cf517ade8e48ec61646b943d79f1a52991e2eff290a73bc2033f00bfe62d418ddedc1ebb138fa9f246fc8713857cca1aff34028
6
+ metadata.gz: b4ad69b3c7dee5a5ac12f430affc11f43f67b572533bcc9b456e2ec7321a329de7f4ac407e87679e6dacf63c3408d110fbcf4107496e4c665a2f464c2f650531
7
+ data.tar.gz: 6c8498f864b8b6ae8e71863d2a0cb249470000852b5907101aadc86590e6975c73c91ae6b3d5e4c6e23003a7a8cc59279fa7dde5bf258556f02a155ec94cde6a
@@ -18,7 +18,7 @@ jobs:
18
18
  runs-on: ubuntu-latest
19
19
  strategy:
20
20
  matrix:
21
- ruby: [2.7, 3.0]
21
+ ruby: [2.7, '3.0']
22
22
  steps:
23
23
  - uses: actions/checkout@v2
24
24
  - name: Set up Ruby
data/README.md CHANGED
@@ -83,15 +83,17 @@ Facet fields should be added for each permutation of hierarchy key and term valu
83
83
  config.facet_display[:hierarchy].each{ |k,v| puts "#{k}_#{v}" }
84
84
  ```
85
85
 
86
- ### Overriding the icon
87
- The icon is available in an engine configuration. You can change them in an initializer in your app.
86
+ ### Changing the icons
87
+ We store our closed/open icons as the SASS variables `$b-h-closed-icon` and `$b-h-closed-icon` in `hierarchy.scss`. By default we use SVGs provided by the [Font Awesome](https://github.com/FortAwesome/Font-Awesome) library. To change the icon, reassign these SASS variables with new SVG code.
88
88
 
89
- ```ruby
90
- Blacklight::Hierarchy::Engine.config.closed_icon = '➕'
91
- Blacklight::Hierarchy::Engine.config.opened_icon = '➖'
89
+ ```scss
90
+ /* app/assets/stylesheets/blacklight/hierarchy/hierarchy.scss */
92
91
 
92
+ // plus sign
93
+ $b-h-closed-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d='M200 344V280H136C122.7 280 112 269.3 112 256C112 242.7 122.7 232 136 232H200V168C200 154.7 210.7 144 224 144C237.3 144 248 154.7 248 168V232H312C325.3 232 336 242.7 336 256C336 269.3 325.3 280 312 280H248V344C248 357.3 237.3 368 224 368C210.7 368 200 357.3 200 344zM0 96C0 60.65 28.65 32 64 32H384C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96zM48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80H64C55.16 80 48 87.16 48 96z'/></svg>") !default;
93
94
  ```
94
95
 
96
+
95
97
  ### Aria Labels
96
98
  For screen reader purposes we have used "Toggle subgroup" as the aria-label attribute of the button. This is internationalized using rails' i18n feature.
97
99
 
@@ -19,6 +19,7 @@ Blacklight.onLoad(function(){
19
19
  $(Blacklight.do_hierarchical_facet_expand_contract_behavior.list, this).each(function() {
20
20
  if($('span.selected', this).length != 0){
21
21
  li.addClass('twiddle-open');
22
+ li.children('.collapse').addClass('in');
22
23
  }
23
24
  });
24
25
 
@@ -1,3 +1,8 @@
1
+ // plus sign
2
+ $b-h-closed-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d='M200 344V280H136C122.7 280 112 269.3 112 256C112 242.7 122.7 232 136 232H200V168C200 154.7 210.7 144 224 144C237.3 144 248 154.7 248 168V232H312C325.3 232 336 242.7 336 256C336 269.3 325.3 280 312 280H248V344C248 357.3 237.3 368 224 368C210.7 368 200 357.3 200 344zM0 96C0 60.65 28.65 32 64 32H384C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96zM48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80H64C55.16 80 48 87.16 48 96z'/></svg>") !default;
3
+ // minus sign
4
+ $b-h-opened-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d='M312 232C325.3 232 336 242.7 336 256C336 269.3 325.3 280 312 280H136C122.7 280 112 269.3 112 256C112 242.7 122.7 232 136 232H312zM0 96C0 60.65 28.65 32 64 32H384C419.3 32 448 60.65 448 96V416C448 451.3 419.3 480 384 480H64C28.65 480 0 451.3 0 416V96zM48 96V416C48 424.8 55.16 432 64 432H384C392.8 432 400 424.8 400 416V96C400 87.16 392.8 80 384 80H64C55.16 80 48 87.16 48 96z'/></svg>") !default;
5
+
1
6
  $text-muted: #777 !default;
2
7
 
3
8
  .facet-hierarchy {
@@ -34,8 +39,21 @@ $text-muted: #777 !default;
34
39
  }
35
40
  }
36
41
 
42
+ .twiddle>.toggle-handle {
43
+ background-color: transparent;
44
+ }
45
+
46
+ .twiddle>.toggle-handle .toggle-icon {
47
+ background-position: center;
48
+ background-repeat: no-repeat;
49
+ margin-top: 3px;
50
+ min-height: 20px;
51
+ min-width: 20px;
52
+ }
53
+
37
54
  .twiddle>.toggle-handle .closed {
38
- display: inline;
55
+ background-image: escape-svg($b-h-closed-icon);
56
+ display: inline-block;
39
57
  }
40
58
 
41
59
  .twiddle>.toggle-handle .opened {
@@ -47,7 +65,8 @@ $text-muted: #777 !default;
47
65
  }
48
66
 
49
67
  .twiddle-open>.toggle-handle .opened {
50
- display: inline;
68
+ background-image: escape-svg($b-h-opened-icon);
69
+ display: inline-block;
51
70
  }
52
71
 
53
72
  .h-leaf {
@@ -10,7 +10,7 @@
10
10
  <% end %>
11
11
 
12
12
  <% unless subset.empty? %>
13
- <ul id="<%= ul_id %>" class="collapse" data-b-h-collapsible-target="list" role=\"group\">
13
+ <ul id="<%= ul_id %>" class="collapse" data-b-h-collapsible-target="list" role="group">
14
14
  <% subset.keys.sort.each do |subkey| %>
15
15
  <%= render self.class.new(field_name: field_name, tree: subset[subkey], key: subkey) %>
16
16
  <% end %>
@@ -1,8 +1,8 @@
1
1
  <%= render(@layout.new(facet_field: @facet_field)) do |component| %>
2
- <% component.with(:label) do %>
2
+ <% component.label do %>
3
3
  <%= @facet_field.label %>
4
4
  <% end %>
5
- <% component.with(:body) do %>
5
+ <% component.body do %>
6
6
  <ul class="facet-hierarchy" role="tree">
7
7
  <% tree.keys.sort.collect do |key| %>
8
8
  <%= render Blacklight::Hierarchy::FacetFieldComponent.new(field_name: @facet_field.facet_field.field, tree: tree[key], key: key) %>
@@ -17,11 +17,13 @@ module Blacklight::HierarchyHelper
17
17
  data: {
18
18
  action: 'click->b-h-collapsible#toggle',
19
19
  toggle: 'collapse',
20
- target: "##{controls}"
20
+ bs_toggle: 'collapse',
21
+ target: "##{controls}",
22
+ bs_target: "##{controls}"
21
23
  },
22
24
  class: 'toggle-handle') do
23
- tag.span(Blacklight::Hierarchy::Engine.config.closed_icon, :'aria-hidden' => 'true', class: 'closed') +
24
- tag.span(Blacklight::Hierarchy::Engine.config.opened_icon, :'aria-hidden' => 'true', class: 'opened')
25
+ tag.div( :'aria-hidden' => 'true', class: 'closed toggle-icon') +
26
+ tag.div( :'aria-hidden' => 'true', class: 'opened toggle-icon')
25
27
  end
26
28
  end
27
29
 
@@ -18,7 +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
- s.add_dependency 'blacklight', '~> 7.13'
21
+ s.add_dependency 'blacklight', '~> 7.18'
22
22
  s.add_dependency 'rails', '>= 5.1', '< 7'
23
23
  s.add_dependency 'deprecation'
24
24
 
@@ -4,8 +4,6 @@ require 'rails'
4
4
  module Blacklight
5
5
  module Hierarchy
6
6
  class Engine < Rails::Engine
7
- config.closed_icon = '⊞'
8
- config.opened_icon = '⊟'
9
7
  end
10
8
  end
11
9
  end
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Hierarchy
3
- VERSION = '5.1.0'.freeze
3
+ VERSION = '6.0.0'.freeze
4
4
  end
5
5
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blacklight-hierarchy",
3
- "version": "5.1.0",
3
+ "version": "5.4.0",
4
4
  "description": "[![Build Status](https://github.com/sul-dlss/blacklight-hierarchy/workflows/CI/badge.svg)](https://github.com/sul-dlss/blacklight-hierarchy/actions?query=branch%3Amain)",
5
5
  "main": "app/assets/javascripts/blacklight/hierarchy/hierarchy.js",
6
6
  "files": [
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: 5.1.0
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael B. Klein
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-16 00:00:00.000000000 Z
11
+ date: 2022-02-11 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.13'
19
+ version: '7.18'
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.13'
26
+ version: '7.18'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ files:
194
194
  homepage: https://github.com/sul-dlss/blacklight-hierarchy
195
195
  licenses: []
196
196
  metadata: {}
197
- post_install_message:
197
+ post_install_message:
198
198
  rdoc_options: []
199
199
  require_paths:
200
200
  - lib
@@ -209,8 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubygems_version: 3.1.4
213
- signing_key:
212
+ rubygems_version: 3.2.32
213
+ signing_key:
214
214
  specification_version: 4
215
215
  summary: Hierarchical Facets for Blacklight
216
216
  test_files: