design_system 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcb99fac1317a11961209f05ceea3b990641b0da3b600aaf2e464c222e637d9e
4
- data.tar.gz: be35906a281147718c1dede6c2633bd0848e5699354de2740f0f9d77e6b45e67
3
+ metadata.gz: 595e6566bee790e2e58689975b8d3a04fca3d7c82dae7a7cdc7c83a2d4af994f
4
+ data.tar.gz: fbe54327bb743981ed087ae04a70961ca3ef5251830a63f6a68770916976640e
5
5
  SHA512:
6
- metadata.gz: fae68336c0f36918fff9fa9a1a68bc3b639ed1e2690f57d21f9e82f3c0636e7d10780cb63bb8e6f9fc0093486f855b1d6f799415404616678227b4a7df3b3149
7
- data.tar.gz: '0953cbc759d37877df2512cad7d653de06ddb4d51f950b5c829af708dd8e01bee63c2a3d5708008fb132b9d11907b271192fecf2c251048b59c8d4bf977fb573'
6
+ metadata.gz: 33641e32c8413442ac88b5efc2d08564de2f0aa5696f0a4ae6b7ff37a72f6219c1387a0bcd9c11f28440b76ca7574e5280c5e2e69c45870f0ba10f77da956bea
7
+ data.tar.gz: fa37c40c5bf864018d67bc3c721188dab80e046bc92f20905ee4615a16099232b3bb592afba5192622302c54c58ef413b9e03026905a63563479ebac53bacdc3
@@ -74,12 +74,12 @@ module DesignSystemHelper
74
74
  will_paginate(collection, defaults.merge!(options))
75
75
  end
76
76
 
77
- def ds_alert(message)
78
- DesignSystem::Registry.builder(brand, 'notification', self).render_alert(message)
77
+ def ds_alert(message = nil, &)
78
+ DesignSystem::Registry.builder(brand, 'notification', self).render_alert(message, &)
79
79
  end
80
80
 
81
- def ds_notice(message)
82
- DesignSystem::Registry.builder(brand, 'notification', self).render_notice(message)
81
+ def ds_notice(message = nil, &)
82
+ DesignSystem::Registry.builder(brand, 'notification', self).render_notice(message, &)
83
83
  end
84
84
 
85
85
  def ds_heading(text, level: 2, **options)
@@ -7,19 +7,21 @@ module DesignSystem
7
7
  class Notification < Base
8
8
  include ActionView::Helpers::SanitizeHelper
9
9
 
10
- def render_alert(msg)
10
+ def render_alert(msg = nil, &)
11
+ content_to_display = block_given? ? capture(&) : msg
11
12
  content_tag(:div, class: "#{brand}-error-summary", 'aria-labelledby': 'error-summary-title', role: 'alert',
12
13
  tabindex: '-1') do
13
- content_tag(:h2, sanitize(msg, tags: %w[b p br a], attributes: %w[href target]),
14
+ content_tag(:h2, content_to_display,
14
15
  class: "#{brand}-error-summary__title", id: 'error-summary-title')
15
16
  end
16
17
  end
17
18
 
18
- def render_notice(msg)
19
+ def render_notice(msg = nil, &)
20
+ content_to_display = block_given? ? capture(&) : msg
19
21
  content_tag(:div, class: "#{brand}-notification-banner", role: 'region',
20
22
  'aria-labelledby': "#{brand}-notification-banner-title",
21
23
  'data-module': "#{brand}-notification-banner") do
22
- banner_tile + banner_content(msg)
24
+ banner_tile + banner_content(content_to_display)
23
25
  end
24
26
  end
25
27
 
@@ -32,9 +34,9 @@ module DesignSystem
32
34
  end
33
35
  end
34
36
 
35
- def banner_content(msg)
37
+ def banner_content(content)
36
38
  content_tag(:div, class: "#{brand}-notification-banner__content") do
37
- content_tag(:p, sanitize(msg, tags: %w[b p br a], attributes: %w[href targ]),
39
+ content_tag(:p, content,
38
40
  class: "#{brand}-notification-banner__heading")
39
41
  end
40
42
  end
@@ -5,8 +5,9 @@ module DesignSystem
5
5
  module Builders
6
6
  # This class provides Nhsuk notifications html.
7
7
  class Notification < ::DesignSystem::Govuk::Builders::Notification
8
- def render_notice(msg)
9
- content = content_tag(:p, sanitize(msg, tags: %w[b p br a], attributes: %w[href target]))
8
+ def render_notice(msg = nil, &)
9
+ content_to_display = block_given? ? capture(&) : msg
10
+ content = content_tag(:p, content_to_display)
10
11
  content_tag(:div, class: "#{brand}-inset-text") do
11
12
  content_tag(:span, 'Information:', class: "#{brand}-u-visually-hidden") + content
12
13
  end
@@ -1,3 +1,3 @@
1
1
  module DesignSystem
2
- VERSION = '0.10.0'.freeze
2
+ VERSION = '0.11.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: design_system
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filis Liu
@@ -448,7 +448,7 @@ files:
448
448
  - lib/tasks/design_system_tasks.rake
449
449
  - lib/tasks/govuk.rake
450
450
  - lib/tasks/nhsuk.rake
451
- - public/design_system/static/design_system-0.10.0/design_system.js
451
+ - public/design_system/static/design_system-0.11.0/design_system.js
452
452
  - public/design_system/static/govuk-frontend-5.11.1/fonts/bold-affa96571d-v2.woff
453
453
  - public/design_system/static/govuk-frontend-5.11.1/fonts/bold-b542beb274-v2.woff2
454
454
  - public/design_system/static/govuk-frontend-5.11.1/fonts/light-94a07e06a1-v2.woff2