govuk-components 3.0.0 → 3.0.1b1

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: 27b0a10c2ac5ff55db6e0728ca288f9e3e93a64a284c92a14314c6aa46997273
4
- data.tar.gz: 19db68d4d07e8996a17ceb8f19dbe31635d8b8a88055f8f51614d0a5bee2be0e
3
+ metadata.gz: 46813fb35a694cb356d6d52e0d54b2bbee0592e4bc8825cd28c0db985f148230
4
+ data.tar.gz: 3abacda9044832ba050caf116b34adf6dbaadd2d36b91cbb79af9d0d640969aa
5
5
  SHA512:
6
- metadata.gz: a00087e5c6851c4061f8128668e6c92ad0b10af024439c5105f78b8a32659c593a48d4e85b450348c3776714fe6da3dea3eb217163da70d3381f67c5470ce5cd
7
- data.tar.gz: 63884ab095f6c87054d1bcb6d3b1afeaca1e8a797a4bffd282c45007fff3a0f64b4cbebde4f91299a061fb7f8003c93d984a90ef12608285ef58d7fd5fee307e
6
+ metadata.gz: 915605c041e4457b922aa94d02bc3a2205c4f4209cf56e7b8de28a19be1bf3b539052039bb8af053180566590818d19d5eb61daae09ed73209a4c6c9d47ce5cd
7
+ data.tar.gz: '02826866efc9a0169f3f3560b2624b89d26b2978ff25399f52d16911fb64cbdad0321b37ccdf35f70977972830e6f2dd824ddbc7939b523b76aabbe9c2e3f493'
@@ -11,11 +11,15 @@ module GovukComponent
11
11
  )
12
12
  end
13
13
 
14
- def initialize(actions: true, borders: true, classes: [], html_attributes: {})
14
+ def initialize(rows: nil, actions: true, borders: true, classes: [], html_attributes: {})
15
15
  super(classes: classes, html_attributes: html_attributes)
16
16
 
17
17
  @borders = borders
18
18
  @show_actions_column = actions
19
+
20
+ return unless rows.presence
21
+
22
+ build(rows)
19
23
  end
20
24
 
21
25
  def classes
@@ -31,5 +35,19 @@ module GovukComponent
31
35
  def default_classes
32
36
  %w(govuk-summary-list)
33
37
  end
38
+
39
+ def build(rows)
40
+ @show_actions_column = rows.any? { |r| r.key?(:actions) }
41
+
42
+ rows.each do |data|
43
+ k, v, a = data.values_at(:key, :value, :actions)
44
+
45
+ row(**data.slice(:classes, :html_attributes)) do |r|
46
+ r.key(**k)
47
+ r.value(**v)
48
+ Array.wrap(a).each { |ad| r.action(**ad) }
49
+ end
50
+ end
51
+ end
34
52
  end
35
53
  end
@@ -1,5 +1,5 @@
1
1
  module Govuk
2
2
  module Components
3
- VERSION = '3.0.0'.freeze
3
+ VERSION = '3.0.1b1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,22 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DfE developers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 6.1.4.4
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: '6.1'
@@ -24,9 +21,6 @@ dependencies:
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: 6.1.4.4
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
26
  version: '6.1'
@@ -34,9 +28,6 @@ dependencies:
34
28
  name: railties
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 6.1.4.4
40
31
  - - ">="
41
32
  - !ruby/object:Gem::Version
42
33
  version: '6.1'
@@ -44,9 +35,6 @@ dependencies:
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: 6.1.4.4
50
38
  - - ">="
51
39
  - !ruby/object:Gem::Version
52
40
  version: '6.1'
@@ -360,7 +348,7 @@ homepage: https://github.com/DFE-Digital/govuk-components
360
348
  licenses:
361
349
  - MIT
362
350
  metadata: {}
363
- post_install_message:
351
+ post_install_message:
364
352
  rdoc_options: []
365
353
  require_paths:
366
354
  - lib
@@ -371,12 +359,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
359
  version: '0'
372
360
  required_rubygems_version: !ruby/object:Gem::Requirement
373
361
  requirements:
374
- - - ">="
362
+ - - ">"
375
363
  - !ruby/object:Gem::Version
376
- version: '0'
364
+ version: 1.3.1
377
365
  requirements: []
378
- rubygems_version: 3.2.32
379
- signing_key:
366
+ rubygems_version: 3.1.6
367
+ signing_key:
380
368
  specification_version: 4
381
369
  summary: Lightweight set of reusable GOV.UK Design System components
382
370
  test_files: []