slimmer 11.1.1 → 12.0.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 +5 -0
- data/lib/slimmer.rb +0 -1
- data/lib/slimmer/headers.rb +0 -5
- data/lib/slimmer/skin.rb +0 -9
- data/lib/slimmer/version.rb +1 -1
- metadata +2 -3
- data/lib/slimmer/processors/report_a_problem_inserter.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55f0a341bbb309da449a52a668b281087674586c
|
4
|
+
data.tar.gz: e090f9302dfd9dea5d91184a50942bfe9751bd02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 464f4d805159cd667d1cdc3478fba42e18741e4f7d3978c717b608098099fb3b87f56b83c9b31f61ee8bd2fa1acaf7778ab62be006d363365bd673162b2d18ad
|
7
|
+
data.tar.gz: 7aa2bb20cb3c5a3151949436d6e2d36cae311ee31552ef17cb7e254f2a2569c93205dec13b0e5baf6e155c862714af4a1ec6379165cd23275929ffcec2bec1b7
|
data/CHANGELOG.md
CHANGED
data/lib/slimmer.rb
CHANGED
@@ -43,7 +43,6 @@ module Slimmer
|
|
43
43
|
autoload :HeaderContextInserter, 'slimmer/processors/header_context_inserter'
|
44
44
|
autoload :InsideHeaderInserter, 'slimmer/processors/inside_header_inserter'
|
45
45
|
autoload :NavigationMover, 'slimmer/processors/navigation_mover'
|
46
|
-
autoload :ReportAProblemInserter, 'slimmer/processors/report_a_problem_inserter'
|
47
46
|
autoload :SearchIndexSetter, 'slimmer/processors/search_index_setter'
|
48
47
|
autoload :SearchPathSetter, 'slimmer/processors/search_path_setter'
|
49
48
|
autoload :SearchParameterInserter, 'slimmer/processors/search_parameter_inserter'
|
data/lib/slimmer/headers.rb
CHANGED
@@ -13,7 +13,6 @@ module Slimmer
|
|
13
13
|
format: "Format",
|
14
14
|
page_owner: "Page-Owner",
|
15
15
|
organisations: "Organisations",
|
16
|
-
report_a_problem: "Report-a-Problem",
|
17
16
|
world_locations: "World-Locations",
|
18
17
|
result_count: "Result-Count",
|
19
18
|
search_parameters: "Search-Parameters",
|
@@ -32,9 +31,6 @@ module Slimmer
|
|
32
31
|
# @private
|
33
32
|
ORGANISATIONS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:organisations]}"
|
34
33
|
|
35
|
-
# @private
|
36
|
-
REPORT_A_PROBLEM_FORM = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:report_a_problem]}"
|
37
|
-
|
38
34
|
# @private
|
39
35
|
WORLD_LOCATIONS_HEADER = "#{HEADER_PREFIX}-#{SLIMMER_HEADER_MAPPING[:world_locations]}"
|
40
36
|
|
@@ -67,7 +63,6 @@ module Slimmer
|
|
67
63
|
# @option hash [String] organisations
|
68
64
|
# @option hash [String] page_owner
|
69
65
|
# @option hash [String] remove_search
|
70
|
-
# @option hash [String] report_a_problem
|
71
66
|
# @option hash [String] result_count
|
72
67
|
# @option hash [String] search_parameters
|
73
68
|
# @option hash [String] section
|
data/lib/slimmer/skin.rb
CHANGED
@@ -94,11 +94,6 @@ module Slimmer
|
|
94
94
|
def success(source_request, response, body)
|
95
95
|
wrapper_id = options[:wrapper_id] || 'wrapper'
|
96
96
|
|
97
|
-
# The variables set in the source request might not be encoded as UTF-8,
|
98
|
-
# Unicorn, for instance, will set them to be ASCII. This shouldn't matter
|
99
|
-
# normally because URI's should have UTF-8 characters percent encoded,
|
100
|
-
# but not all agents follow this.
|
101
|
-
request_url = source_request.url.force_encoding(Encoding::UTF_8)
|
102
97
|
processors = [
|
103
98
|
Processors::TitleInserter.new(),
|
104
99
|
Processors::TagMover.new(),
|
@@ -111,10 +106,6 @@ module Slimmer
|
|
111
106
|
Processors::MetadataInserter.new(response, options[:app_name]),
|
112
107
|
Processors::SearchParameterInserter.new(response),
|
113
108
|
Processors::SearchPathSetter.new(response),
|
114
|
-
Processors::ReportAProblemInserter.new(self,
|
115
|
-
request_url,
|
116
|
-
response.headers,
|
117
|
-
wrapper_id),
|
118
109
|
Processors::SearchRemover.new(response.headers),
|
119
110
|
]
|
120
111
|
|
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:
|
4
|
+
version: 12.0.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:
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -252,7 +252,6 @@ files:
|
|
252
252
|
- lib/slimmer/processors/inside_header_inserter.rb
|
253
253
|
- lib/slimmer/processors/metadata_inserter.rb
|
254
254
|
- lib/slimmer/processors/navigation_mover.rb
|
255
|
-
- lib/slimmer/processors/report_a_problem_inserter.rb
|
256
255
|
- lib/slimmer/processors/search_parameter_inserter.rb
|
257
256
|
- lib/slimmer/processors/search_path_setter.rb
|
258
257
|
- lib/slimmer/processors/search_remover.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Slimmer::Processors
|
2
|
-
class ReportAProblemInserter
|
3
|
-
include ERB::Util
|
4
|
-
|
5
|
-
def initialize(skin, url, headers, wrapper_id)
|
6
|
-
@skin = skin
|
7
|
-
@request_url = url
|
8
|
-
@headers = headers
|
9
|
-
@wrapper_id = wrapper_id
|
10
|
-
end
|
11
|
-
|
12
|
-
def filter(content_document, page_template)
|
13
|
-
if enabled? && container = page_template.at_css('#' + @wrapper_id)
|
14
|
-
container.add_child(report_a_problem_block)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def report_a_problem_block
|
19
|
-
request_url = @request_url
|
20
|
-
source = @headers[Slimmer::Headers::APPLICATION_NAME_HEADER]
|
21
|
-
page_owner = @headers[Slimmer::Headers::PAGE_OWNER_HEADER]
|
22
|
-
report_a_problem_template = @skin.template('report_a_problem.raw')
|
23
|
-
html = ERB.new(report_a_problem_template).result(binding)
|
24
|
-
Nokogiri::HTML.fragment(html)
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
def enabled?
|
29
|
-
@headers[Slimmer::Headers::REPORT_A_PROBLEM_FORM] != 'false'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|