slimmer 15.1.1 → 15.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/slimmer.rb +1 -0
- data/lib/slimmer/headers.rb +5 -0
- data/lib/slimmer/processors/accounts_shower.rb +29 -0
- data/lib/slimmer/skin.rb +1 -0
- data/lib/slimmer/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adfdc8dd1fa7b69450bbbae9daf9cbd352704a621947aad067fc5aabad239132
|
4
|
+
data.tar.gz: ef11b30a4f27806579d0a7e690f9e71b08210d10625722de29b6a320d5cf1840
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75bba48992276cc1d656c72271dd6ecb192af0467205cfc12411a8b53b26d65d534f25801b5e70b4a0304fbf08fa6202440891956bd36547f03dc488ec1aee64
|
7
|
+
data.tar.gz: '038f855917b3f9fe4d66c0e15737efadd8b4724e23b47dab25573f18962e0b525449780566421f8b07759d17bda1947bdbc1e75ef032752645126fda9a3378d3'
|
data/CHANGELOG.md
CHANGED
data/lib/slimmer.rb
CHANGED
@@ -28,6 +28,7 @@ module Slimmer
|
|
28
28
|
autoload :HTTPClient, "slimmer/http_client"
|
29
29
|
|
30
30
|
module Processors
|
31
|
+
autoload :AccountsShower, "slimmer/processors/accounts_shower"
|
31
32
|
autoload :BodyClassCopier, "slimmer/processors/body_class_copier"
|
32
33
|
autoload :BodyInserter, "slimmer/processors/body_inserter"
|
33
34
|
autoload :ConditionalCommentMover, "slimmer/processors/conditional_comment_mover"
|
data/lib/slimmer/headers.rb
CHANGED
@@ -20,6 +20,7 @@ module Slimmer
|
|
20
20
|
skip: "Skip",
|
21
21
|
template: "Template",
|
22
22
|
remove_search: "Remove-Search",
|
23
|
+
show_accounts: "Show-Accounts",
|
23
24
|
}.freeze
|
24
25
|
|
25
26
|
# @private
|
@@ -55,6 +56,9 @@ module Slimmer
|
|
55
56
|
# @private
|
56
57
|
REMOVE_SEARCH_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:remove_search]}".freeze
|
57
58
|
|
59
|
+
# @private
|
60
|
+
SHOW_ACCOUNTS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:show_accounts]}".freeze
|
61
|
+
|
58
62
|
# Set the "slimmer headers" to configure the page
|
59
63
|
#
|
60
64
|
# @param hash [Hash] the options
|
@@ -66,6 +70,7 @@ module Slimmer
|
|
66
70
|
# @option hash [String] result_count
|
67
71
|
# @option hash [String] search_parameters
|
68
72
|
# @option hash [String] section
|
73
|
+
# @option hash [String] show_accounts
|
69
74
|
# @option hash [String] skip
|
70
75
|
# @option hash [String] template
|
71
76
|
# @option hash [String] world_locations
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Slimmer::Processors
|
2
|
+
class AccountsShower
|
3
|
+
def initialize(headers)
|
4
|
+
@headers = headers
|
5
|
+
end
|
6
|
+
|
7
|
+
def filter(_src, dest)
|
8
|
+
header_value = @headers[Slimmer::Headers::SHOW_ACCOUNTS_HEADER]
|
9
|
+
if header_value == "signed-in"
|
10
|
+
remove_signed_out(dest)
|
11
|
+
elsif header_value == "signed-out"
|
12
|
+
remove_signed_in(dest)
|
13
|
+
else
|
14
|
+
remove_signed_out(dest)
|
15
|
+
remove_signed_in(dest)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove_signed_out(dest)
|
20
|
+
signed_out = dest.at_css("#global-header #accounts-signed-out")
|
21
|
+
signed_out.remove if signed_out
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove_signed_in(dest)
|
25
|
+
signed_in = dest.at_css("#global-header #accounts-signed-in")
|
26
|
+
signed_in.remove if signed_in
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/slimmer/skin.rb
CHANGED
@@ -107,6 +107,7 @@ module Slimmer
|
|
107
107
|
Processors::SearchParameterInserter.new(response),
|
108
108
|
Processors::SearchPathSetter.new(response),
|
109
109
|
Processors::SearchRemover.new(response.headers),
|
110
|
+
Processors::AccountsShower.new(response.headers),
|
110
111
|
]
|
111
112
|
|
112
113
|
template_name = response.headers[Headers::TEMPLATE_HEADER] || "core_layout"
|
data/lib/slimmer/version.rb
CHANGED
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
|
+
version: 15.2.0
|
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: 2020-
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -252,6 +252,7 @@ files:
|
|
252
252
|
- lib/slimmer/govuk_request_id.rb
|
253
253
|
- lib/slimmer/headers.rb
|
254
254
|
- lib/slimmer/http_client.rb
|
255
|
+
- lib/slimmer/processors/accounts_shower.rb
|
255
256
|
- lib/slimmer/processors/body_class_copier.rb
|
256
257
|
- lib/slimmer/processors/body_inserter.rb
|
257
258
|
- lib/slimmer/processors/conditional_comment_mover.rb
|
@@ -294,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
294
295
|
- !ruby/object:Gem::Version
|
295
296
|
version: '0'
|
296
297
|
requirements: []
|
297
|
-
rubygems_version: 3.
|
298
|
+
rubygems_version: 3.1.4
|
298
299
|
signing_key:
|
299
300
|
specification_version: 4
|
300
301
|
summary: Thinner than the skinner
|