slimmer 18.5.2 → 18.6.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: f4d01a71c91dcc05c81dbfe0b72a94505a46ef1ceca890db26144d48aac077ca
4
- data.tar.gz: e54b3f1e976748c8e522ac96b3d5bf51d00db5625a5da3633d6b3a14cc99ac10
3
+ metadata.gz: 46de5cf9b03bf7ca0232f46c17d808c3e2b16052ae191b792f838ca4afa4123e
4
+ data.tar.gz: 4f597f08678d84dd2aefb3901491b00534f8c4d5ff0e37d788e712dd92ba5a9a
5
5
  SHA512:
6
- metadata.gz: 2d4eb9f3f23b60a6e55bdc2060e9f7775987b8c0da333baeeedea541a92185201612c3c05b6c5eb8e9f2819db316216c39b012f6666021229c0a8894cbdc78d8
7
- data.tar.gz: ad166d4c8c8d0e361be75f40bbb716f9f841efbfe8306a4d03d06a5fdcba187cd6119d7d6043772f65bd81049159f3898b952a7f0589210f9bfbef71897ee1c5
6
+ metadata.gz: b4a9ffdcec2ff9a765423bde3ee69c63d5b3bd736b6a482223a1b6c44307fb0caa163fc5fcdf9a744b9ca5750ee5cec17636aab740bf5027e00072526028d421
7
+ data.tar.gz: 7aabf4bec3f2b9f42ffd2e1874d07e387c7a2c22b4103251fc2b3404e53d2bd87e09a011126b3bf5b1dd7aad25d3ab9cd7efc5fef3828c72e20a19b80e89dbc0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 18.6.1
2
+
3
+ * Update body classes for govuk-frontend-v5
4
+
5
+ # 18.6.0
6
+
7
+ * Remove the part of the body from the error message for SourceWrapperNotFoundError and do some cleanup
8
+ Use more explanatory error message. Apply this globally to all apps.
9
+
1
10
  # 18.5.2
2
11
 
3
12
  * Fix a mistake in 18.5.1
@@ -10,7 +10,14 @@ module Slimmer::Processors
10
10
  source_markup = src.at_css(@source_selector)
11
11
  destination_markup = dest.at_css(@destination_selector)
12
12
 
13
- raise(Slimmer::SourceWrapperNotFoundError, "Source wrapper div not found", caller) if source_markup.nil? && wrapper_check?
13
+ if source_markup.nil?
14
+ raise(Slimmer::SourceWrapperNotFoundError, <<~ERROR_MESSAGE, caller)
15
+ Slimmer did not find a div with ID "wrapper" in the source HTML.
16
+ This could be because a request was made to your Rails application
17
+ for a format that it does not support. For example a JavaScript request,
18
+ when the application only has HTML templates.
19
+ ERROR_MESSAGE
20
+ end
14
21
 
15
22
  css_classes = []
16
23
  css_classes << source_markup.attributes["class"].to_s.split(/ +/) if source_markup.has_attribute?("class")
@@ -26,9 +33,5 @@ module Slimmer::Processors
26
33
  def is_gem_layout?
27
34
  @headers[Slimmer::Headers::TEMPLATE_HEADER]&.start_with?("gem_layout")
28
35
  end
29
-
30
- def wrapper_check?
31
- ENV["SLIMMER_WRAPPER_CHECK"] == "true"
32
- end
33
36
  end
34
37
  end
data/lib/slimmer/skin.rb CHANGED
@@ -100,7 +100,6 @@ module Slimmer
100
100
  end
101
101
 
102
102
  def success(source_request, response, body)
103
- original_body = body.dup
104
103
  wrapper_id = options[:wrapper_id] || "wrapper"
105
104
  template_wrapper_id = "wrapper" # All templates in Static use `#wrapper`
106
105
 
@@ -123,12 +122,6 @@ module Slimmer
123
122
 
124
123
  template_name = response.headers[Headers::TEMPLATE_HEADER] || "gem_layout"
125
124
  process(processors, body, template(template_name), source_request.env)
126
- rescue SourceWrapperNotFoundError => e
127
- message = "#{e.message} "\
128
- "at: #{source_request.base_url}#{source_request.path} "\
129
- "length: #{original_body.to_s.length} "\
130
- "body: #{original_body.to_s[0..2000]}"
131
- raise SourceWrapperNotFoundError, message, caller
132
125
  end
133
126
  end
134
127
  end
@@ -3,7 +3,7 @@
3
3
  <title>Test Template</title>
4
4
  </head>
5
5
  <body>
6
- <script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
6
+ <script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');</script>
7
7
 
8
8
  <header id="global-header">
9
9
  <div class="header-wrapper"></div>
@@ -3,7 +3,7 @@
3
3
  <title>Test Template</title>
4
4
  </head>
5
5
  <body>
6
- <script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
6
+ <script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');</script>
7
7
 
8
8
  <header id="global-header">
9
9
  <div class="header-wrapper"></div>
@@ -1,3 +1,3 @@
1
1
  module Slimmer
2
- VERSION = "18.5.2".freeze
2
+ VERSION = "18.6.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: 18.5.2
4
+ version: 18.6.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: 2024-06-13 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 4.18.0
173
+ version: 5.0.1
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 4.18.0
180
+ version: 5.0.1
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: webmock
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
251
  - !ruby/object:Gem::Version
252
252
  version: '0'
253
253
  requirements: []
254
- rubygems_version: 3.5.11
254
+ rubygems_version: 3.5.14
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Thinner than the skinner