slimmer 15.4.0 → 15.4.1

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: 863bbe9dee726275663817de72e9565a12f648b792d49e736d87bba0d0de9367
4
- data.tar.gz: 946b29270aa371b28a6b8c7e910e263bb0718f48bd337922de79a6bb1ce1475e
3
+ metadata.gz: 9198a64c1829a19f7f0a89e3b0e7ae4b504b728cac13f935398343e962e1d63c
4
+ data.tar.gz: 6baeb15e0d17b8f3b3f9bd51b8ebe3a324a7c7511372d37d0f8713ef4785c518
5
5
  SHA512:
6
- metadata.gz: 823996625c9137fa1139ab7ea3d32f28f17c1d77edcbf2c4613c6038a6fa1c80263972c1d5cdeceb9dbabcd9c6985d6d183335034e97c43e32da3d290e8338c8
7
- data.tar.gz: bdc96ffc6f0d51f93733158873fc12b0fb8a01de806cbfca43b3a40570787cb3564f25ad1f019bb763e38a276e14fa7134e7a030a344f12aca9386e937e19a0d
6
+ metadata.gz: 11ec9e71961fd062c4a7b3378134fc090f9e574ea487093d81b4eb8a3b0a6a31e38633c93cedd9efdde3848971cc429aea0666bb01048edcac1d6587a54689b5
7
+ data.tar.gz: e412a52f54e6d1eee23769a6aa0d6b9a3a3bec0b6147f349cde5f448886c70fb283db165d5794d4dae8068ec4aff84c086d0474c511a54bef1a8fff730df57ca
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 15.4.1
2
+
3
+ * Add support for layout header component in static (#263)
4
+
1
5
  # 15.4.0
2
6
 
3
7
  * Hoist `<async>` and `<defer>` JS Script tags to `<head>`. (#261)
@@ -6,6 +6,14 @@ module Slimmer::Processors
6
6
 
7
7
  def filter(_src, dest)
8
8
  header_value = @headers[Slimmer::Headers::SHOW_ACCOUNTS_HEADER]
9
+ layout_header = dest.at_css(".gem-c-layout-header")
10
+ static_header = dest.at_css("#global-header")
11
+ if header_value && layout_header
12
+ static_header.remove if static_header
13
+ elsif !header_value
14
+ layout_header.remove if layout_header
15
+ end
16
+
9
17
  if header_value == "signed-in"
10
18
  remove_signed_out(dest)
11
19
  elsif header_value == "signed-out"
@@ -18,12 +26,22 @@ module Slimmer::Processors
18
26
 
19
27
  def remove_signed_out(dest)
20
28
  signed_out = dest.at_css("#global-header #accounts-signed-out")
29
+ signed_out_link = dest.css(".gem-c-layout-header [data-link-for='accounts-signed-out']")
30
+
21
31
  signed_out.remove if signed_out
32
+ signed_out_link.each do |link|
33
+ link.parent.remove
34
+ end
22
35
  end
23
36
 
24
37
  def remove_signed_in(dest)
25
38
  signed_in = dest.at_css("#global-header #accounts-signed-in")
39
+ signed_in_link = dest.css(".gem-c-layout-header [data-link-for='accounts-signed-in']")
40
+
26
41
  signed_in.remove if signed_in
42
+ signed_in_link.each do |link|
43
+ link.parent.remove
44
+ end
27
45
  end
28
46
  end
29
47
  end
@@ -1,3 +1,3 @@
1
1
  module Slimmer
2
- VERSION = "15.4.0".freeze
2
+ VERSION = "15.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.4.0
4
+ version: 15.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport