ccs-frontend_helpers 0.1.0.rc.2 → 0.1.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/Gemfile.lock +1 -1
  4. data/lib/ccs/components/ccs/dashboard_section/panel.rb +43 -41
  5. data/lib/ccs/components/ccs/dashboard_section.rb +50 -48
  6. data/lib/ccs/components/ccs/footer/link.rb +41 -39
  7. data/lib/ccs/components/ccs/footer/meta.rb +49 -48
  8. data/lib/ccs/components/ccs/footer/navigation.rb +51 -50
  9. data/lib/ccs/components/ccs/footer.rb +69 -67
  10. data/lib/ccs/components/ccs/header/link.rb +47 -45
  11. data/lib/ccs/components/ccs/header/navigation.rb +85 -84
  12. data/lib/ccs/components/ccs/header/service_authentication.rb +35 -34
  13. data/lib/ccs/components/ccs/header.rb +87 -85
  14. data/lib/ccs/components/ccs/logo.rb +36 -34
  15. data/lib/ccs/components/govuk/accordion/section/content.rb +42 -42
  16. data/lib/ccs/components/govuk/accordion/section/header.rb +48 -48
  17. data/lib/ccs/components/govuk/accordion/section.rb +49 -48
  18. data/lib/ccs/components/govuk/accordion.rb +43 -41
  19. data/lib/ccs/components/govuk/back_link.rb +39 -37
  20. data/lib/ccs/components/govuk/breadcrumbs/link.rb +42 -40
  21. data/lib/ccs/components/govuk/breadcrumbs.rb +40 -38
  22. data/lib/ccs/components/govuk/button.rb +83 -81
  23. data/lib/ccs/components/govuk/cookie_banner/action.rb +45 -43
  24. data/lib/ccs/components/govuk/cookie_banner/message.rb +57 -55
  25. data/lib/ccs/components/govuk/cookie_banner.rb +40 -38
  26. data/lib/ccs/components/govuk/details.rb +38 -36
  27. data/lib/ccs/components/govuk/error_message.rb +46 -44
  28. data/lib/ccs/components/govuk/error_summary/item.rb +41 -39
  29. data/lib/ccs/components/govuk/error_summary.rb +49 -47
  30. data/lib/ccs/components/govuk/field/input/character_count.rb +101 -99
  31. data/lib/ccs/components/govuk/field/input/file_upload.rb +29 -27
  32. data/lib/ccs/components/govuk/field/input/select.rb +61 -59
  33. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +39 -37
  34. data/lib/ccs/components/govuk/field/input/text_input.rb +75 -73
  35. data/lib/ccs/components/govuk/field/input/textarea.rb +43 -41
  36. data/lib/ccs/components/govuk/field/input.rb +46 -44
  37. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +43 -41
  38. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +48 -46
  39. data/lib/ccs/components/govuk/field/inputs/date_input.rb +68 -66
  40. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +29 -27
  41. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +26 -24
  42. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +32 -30
  43. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +39 -37
  44. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +27 -25
  45. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +26 -24
  46. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +32 -30
  47. data/lib/ccs/components/govuk/field/inputs/item.rb +100 -98
  48. data/lib/ccs/components/govuk/field/inputs/radios.rb +43 -41
  49. data/lib/ccs/components/govuk/field/inputs.rb +42 -40
  50. data/lib/ccs/components/govuk/field.rb +90 -88
  51. data/lib/ccs/components/govuk/fieldset/legend.rb +50 -48
  52. data/lib/ccs/components/govuk/fieldset.rb +40 -38
  53. data/lib/ccs/components/govuk/footer/link.rb +41 -39
  54. data/lib/ccs/components/govuk/footer/meta.rb +49 -48
  55. data/lib/ccs/components/govuk/footer/navigation.rb +51 -50
  56. data/lib/ccs/components/govuk/footer.rb +105 -103
  57. data/lib/ccs/components/govuk/form_group.rb +45 -43
  58. data/lib/ccs/components/govuk/header/link.rb +41 -39
  59. data/lib/ccs/components/govuk/header/navigation.rb +54 -53
  60. data/lib/ccs/components/govuk/header.rb +84 -82
  61. data/lib/ccs/components/govuk/hint.rb +33 -31
  62. data/lib/ccs/components/govuk/inset_text.rb +39 -37
  63. data/lib/ccs/components/govuk/label.rb +61 -59
  64. data/lib/ccs/components/govuk/notification_banner.rb +83 -81
  65. data/lib/ccs/components/govuk/pagination/increment/next.rb +29 -27
  66. data/lib/ccs/components/govuk/pagination/increment/previous.rb +28 -26
  67. data/lib/ccs/components/govuk/pagination/increment.rb +78 -76
  68. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +17 -15
  69. data/lib/ccs/components/govuk/pagination/item/form.rb +34 -32
  70. data/lib/ccs/components/govuk/pagination/item/tag.rb +33 -31
  71. data/lib/ccs/components/govuk/pagination/item.rb +47 -45
  72. data/lib/ccs/components/govuk/pagination.rb +69 -67
  73. data/lib/ccs/components/govuk/panel.rb +49 -47
  74. data/lib/ccs/components/govuk/phase_banner.rb +50 -48
  75. data/lib/ccs/components/govuk/skip_link.rb +39 -37
  76. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +40 -38
  77. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +30 -28
  78. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +28 -26
  79. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +47 -45
  80. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +49 -47
  81. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +44 -42
  82. data/lib/ccs/components/govuk/step_by_step_navigation.rb +41 -39
  83. data/lib/ccs/components/govuk/summary_list/action/link.rb +46 -44
  84. data/lib/ccs/components/govuk/summary_list/card/actions.rb +38 -36
  85. data/lib/ccs/components/govuk/summary_list/card/title.rb +37 -35
  86. data/lib/ccs/components/govuk/summary_list/card.rb +48 -46
  87. data/lib/ccs/components/govuk/summary_list/row/actions.rb +38 -36
  88. data/lib/ccs/components/govuk/summary_list/row/key.rb +30 -28
  89. data/lib/ccs/components/govuk/summary_list/row/value.rb +30 -28
  90. data/lib/ccs/components/govuk/summary_list/row.rb +47 -45
  91. data/lib/ccs/components/govuk/summary_list.rb +48 -46
  92. data/lib/ccs/components/govuk/table/body/data_cell.rb +38 -36
  93. data/lib/ccs/components/govuk/table/body/head_cell.rb +37 -35
  94. data/lib/ccs/components/govuk/table/header/head_cell.rb +39 -37
  95. data/lib/ccs/components/govuk/table.rb +83 -81
  96. data/lib/ccs/components/govuk/tabs/panel.rb +47 -45
  97. data/lib/ccs/components/govuk/tabs/tab.rb +42 -40
  98. data/lib/ccs/components/govuk/tabs.rb +48 -46
  99. data/lib/ccs/components/govuk/tag.rb +39 -37
  100. data/lib/ccs/components/govuk/warning_text.rb +49 -47
  101. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +16 -14
  102. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +17 -15
  103. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +17 -15
  104. data/lib/ccs/frontend_helpers/ccs_frontend.rb +1 -1
  105. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +17 -15
  106. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +17 -15
  107. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +17 -15
  108. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +17 -15
  109. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +17 -15
  110. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +17 -15
  111. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +17 -15
  112. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +17 -15
  113. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +19 -17
  114. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +32 -30
  115. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +38 -36
  116. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +19 -17
  117. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +17 -15
  118. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +17 -15
  119. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +27 -25
  120. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +17 -15
  121. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +18 -16
  122. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +17 -15
  123. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +19 -17
  124. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +18 -16
  125. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +19 -17
  126. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +17 -15
  127. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +19 -17
  128. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +19 -17
  129. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +17 -15
  130. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +17 -15
  131. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +17 -15
  132. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +24 -22
  133. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +17 -15
  134. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +17 -15
  135. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +17 -15
  136. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +17 -15
  137. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +17 -15
  138. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +19 -17
  139. data/lib/ccs/frontend_helpers/version.rb +1 -1
  140. metadata +2 -2
@@ -1,43 +1,45 @@
1
1
  require_relative '../../../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- class SummaryList < Base
6
- class Row < Base
7
- # = GOV.UK Summary list row key
8
- #
9
- # @!attribute [r] text
10
- # @return [String] Text for the summary list row key
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ class SummaryList < Base
7
+ class Row < Base
8
+ # = GOV.UK Summary list row key
9
+ #
10
+ # @!attribute [r] text
11
+ # @return [String] Text for the summary list row key
11
12
 
12
- class Key < Base
13
- private
13
+ class Key < Base
14
+ private
14
15
 
15
- attr_reader :text
16
+ attr_reader :text
16
17
 
17
- public
18
+ public
18
19
 
19
- # @param text [String] Text for the summary list row key
20
- # @param options [Hash] options that will be used in customising the HTML
21
- #
22
- # @option options [String] :classes additional CSS classes for the summary list row key HTML
20
+ # @param text [String] Text for the summary list row key
21
+ # @param options [Hash] options that will be used in customising the HTML
22
+ #
23
+ # @option options [String] :classes additional CSS classes for the summary list row key HTML
23
24
 
24
- def initialize(text:, **options)
25
- super(**options)
25
+ def initialize(text:, **options)
26
+ super(**options)
26
27
 
27
- @text = text
28
- end
28
+ @text = text
29
+ end
29
30
 
30
- # Generates the HTML for the GOV.UK Summary list row key
31
- #
32
- # @return [ActiveSupport::SafeBuffer]
31
+ # Generates the HTML for the GOV.UK Summary list row key
32
+ #
33
+ # @return [ActiveSupport::SafeBuffer]
33
34
 
34
- def render
35
- tag.dt(text, class: @options[:attributes][:class])
36
- end
35
+ def render
36
+ tag.dt(text, class: @options[:attributes][:class])
37
+ end
37
38
 
38
- # The default attributes for the summary list row key
39
+ # The default attributes for the summary list row key
39
40
 
40
- DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list__key' }.freeze
41
+ DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list__key' }.freeze
42
+ end
41
43
  end
42
44
  end
43
45
  end
@@ -1,43 +1,45 @@
1
1
  require_relative '../../../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- class SummaryList < Base
6
- class Row < Base
7
- # = GOV.UK Summary list row value
8
- #
9
- # @!attribute [r] text
10
- # @return [String] Text for the summary list row value
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ class SummaryList < Base
7
+ class Row < Base
8
+ # = GOV.UK Summary list row value
9
+ #
10
+ # @!attribute [r] text
11
+ # @return [String] Text for the summary list row value
11
12
 
12
- class Value < Base
13
- private
13
+ class Value < Base
14
+ private
14
15
 
15
- attr_reader :text
16
+ attr_reader :text
16
17
 
17
- public
18
+ public
18
19
 
19
- # @param text [String] Text for the summary list row value
20
- # @param options [Hash] options that will be used in customising the HTML
21
- #
22
- # @option options [String] :classes additional CSS classes for the summary list row value HTML
20
+ # @param text [String] Text for the summary list row value
21
+ # @param options [Hash] options that will be used in customising the HTML
22
+ #
23
+ # @option options [String] :classes additional CSS classes for the summary list row value HTML
23
24
 
24
- def initialize(text:, **options)
25
- super(**options)
25
+ def initialize(text:, **options)
26
+ super(**options)
26
27
 
27
- @text = text
28
- end
28
+ @text = text
29
+ end
29
30
 
30
- # Generates the HTML for the GOV.UK Summary list row value
31
- #
32
- # @return [ActiveSupport::SafeBuffer]
31
+ # Generates the HTML for the GOV.UK Summary list row value
32
+ #
33
+ # @return [ActiveSupport::SafeBuffer]
33
34
 
34
- def render
35
- tag.dd(text, class: @options[:attributes][:class])
36
- end
35
+ def render
36
+ tag.dd(text, class: @options[:attributes][:class])
37
+ end
37
38
 
38
- # The default attributes for the summary list row value
39
+ # The default attributes for the summary list row value
39
40
 
40
- DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list__value' }.freeze
41
+ DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list__value' }.freeze
42
+ end
41
43
  end
42
44
  end
43
45
  end
@@ -3,60 +3,62 @@ require_relative 'row/key'
3
3
  require_relative 'row/value'
4
4
  require_relative 'row/actions'
5
5
 
6
- module CCS::Components
7
- module GovUK
8
- class SummaryList < Base
9
- # = GOV.UK Summary list row
10
- #
11
- # Generates the HTML for a summary list row
12
- #
13
- # @!attribute [r] key
14
- # @return [Key] Initialised summary list cell for the key
15
- # @!attribute [r] value
16
- # @return [Value] Initialised summary list cell for the value
17
- # @!attribute [r] actions
18
- # @return [Actions] Initialised summary list cell for the actions
19
-
20
- class Row < Base
21
- private
22
-
23
- attr_reader :key, :value, :actions
24
-
25
- public
26
-
27
- # @param any_row_has_actions [Boolean] flag to indicate if any rows have actions
28
- # @param key [Hash] attributes for the key, see {CCS::Components::GovUK::SummaryList::Row::Key#initialize Key#initialize} for more details.
29
- # @param value [Hash] attributes for the value, see {CCS::Components::GovUK::SummaryList::Row::Value#initialize Value#initialize} for more details.
30
- # @param actions [Hash] attributes for the actions, see {CCS::Components::GovUK::SummaryList::Row::Actions#initialize Actions#initialize} for more details.
31
- # @param options [Hash] options that will be used in customising the HTML
6
+ module CCS
7
+ module Components
8
+ module GovUK
9
+ class SummaryList < Base
10
+ # = GOV.UK Summary list row
32
11
  #
33
- # @option options [String] :classes additional CSS classes for the summary list row HTML
12
+ # Generates the HTML for a summary list row
13
+ #
14
+ # @!attribute [r] key
15
+ # @return [Key] Initialised summary list cell for the key
16
+ # @!attribute [r] value
17
+ # @return [Value] Initialised summary list cell for the value
18
+ # @!attribute [r] actions
19
+ # @return [Actions] Initialised summary list cell for the actions
34
20
 
35
- def initialize(any_row_has_actions:, key:, value:, actions: nil, **options)
36
- super(**options)
21
+ class Row < Base
22
+ private
37
23
 
38
- @options[:attributes][:class] << ' govuk-summary-list__row--no-actions' if any_row_has_actions && !actions
24
+ attr_reader :key, :value, :actions
39
25
 
40
- @key = Key.new(context: @context, **key)
41
- @value = Value.new(context: @context, **value)
42
- @actions = Actions.new(context: @context, **actions) if actions
43
- end
26
+ public
44
27
 
45
- # Generates the HTML for the GOV.UK Summary list row
46
- #
47
- # @return [ActiveSupport::SafeBuffer]
28
+ # @param any_row_has_actions [Boolean] flag to indicate if any rows have actions
29
+ # @param key [Hash] attributes for the key, see {CCS::Components::GovUK::SummaryList::Row::Key#initialize Key#initialize} for more details.
30
+ # @param value [Hash] attributes for the value, see {CCS::Components::GovUK::SummaryList::Row::Value#initialize Value#initialize} for more details.
31
+ # @param actions [Hash] attributes for the actions, see {CCS::Components::GovUK::SummaryList::Row::Actions#initialize Actions#initialize} for more details.
32
+ # @param options [Hash] options that will be used in customising the HTML
33
+ #
34
+ # @option options [String] :classes additional CSS classes for the summary list row HTML
35
+
36
+ def initialize(any_row_has_actions:, key:, value:, actions: nil, **options)
37
+ super(**options)
38
+
39
+ @options[:attributes][:class] << ' govuk-summary-list__row--no-actions' if any_row_has_actions && !actions
48
40
 
49
- def render
50
- tag.div(class: options[:attributes][:class]) do
51
- concat(key.render)
52
- concat(value.render)
53
- concat(actions.render) if actions
41
+ @key = Key.new(context: @context, **key)
42
+ @value = Value.new(context: @context, **value)
43
+ @actions = Actions.new(context: @context, **actions) if actions
54
44
  end
55
- end
56
45
 
57
- # The default attributes for the summary list row
46
+ # Generates the HTML for the GOV.UK Summary list row
47
+ #
48
+ # @return [ActiveSupport::SafeBuffer]
49
+
50
+ def render
51
+ tag.div(class: options[:attributes][:class]) do
52
+ concat(key.render)
53
+ concat(value.render)
54
+ concat(actions.render) if actions
55
+ end
56
+ end
58
57
 
59
- DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list__row' }.freeze
58
+ # The default attributes for the summary list row
59
+
60
+ DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list__row' }.freeze
61
+ end
60
62
  end
61
63
  end
62
64
  end
@@ -2,69 +2,71 @@ require_relative '../base'
2
2
  require_relative 'summary_list/row'
3
3
  require_relative 'summary_list/card'
4
4
 
5
- module CCS::Components
6
- module GovUK
7
- # = GOV.UK Summary list
8
- #
9
- # This is used for generating the summary list component from the
10
- # {https://design-system.service.gov.uk/components/summary-list GDS - Components - Summary list}
11
- #
12
- # @!attribute [r] summary_list_rows
13
- # @return [Array<Row>] An array of the initialised summary list rows
14
- # @!attribute [r] card
15
- # @return [Card] Initialised summary list card
5
+ module CCS
6
+ module Components
7
+ module GovUK
8
+ # = GOV.UK Summary list
9
+ #
10
+ # This is used for generating the summary list component from the
11
+ # {https://design-system.service.gov.uk/components/summary-list GDS - Components - Summary list}
12
+ #
13
+ # @!attribute [r] summary_list_rows
14
+ # @return [Array<Row>] An array of the initialised summary list rows
15
+ # @!attribute [r] card
16
+ # @return [Card] Initialised summary list card
16
17
 
17
- class SummaryList < Base
18
- private
18
+ class SummaryList < Base
19
+ private
19
20
 
20
- attr_reader :summary_list_rows, :card
21
+ attr_reader :summary_list_rows, :card
21
22
 
22
- public
23
+ public
23
24
 
24
- # @param summary_list_items [Array<Hash>] An array of options for the summary list rows.
25
- # See {Components::GovUK::SummaryList::Row#initialize Row#initialize} for details of the items in the array.
26
- # @param card [Hash] attributes for the card, see {CCS::Components::GovUK::SummaryList::Card#initialize Card#initialize} for more details.
27
- # @param options [Hash] options that will be used in customising the HTML
28
- #
29
- # @option options [String] :classes additional CSS classes for the summary list HTML
30
- # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
25
+ # @param summary_list_items [Array<Hash>] An array of options for the summary list rows.
26
+ # See {Components::GovUK::SummaryList::Row#initialize Row#initialize} for details of the items in the array.
27
+ # @param card [Hash] attributes for the card, see {CCS::Components::GovUK::SummaryList::Card#initialize Card#initialize} for more details.
28
+ # @param options [Hash] options that will be used in customising the HTML
29
+ #
30
+ # @option options [String] :classes additional CSS classes for the summary list HTML
31
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
31
32
 
32
- def initialize(summary_list_items:, card: nil, **options)
33
- super(**options)
33
+ def initialize(summary_list_items:, card: nil, **options)
34
+ super(**options)
34
35
 
35
- any_row_has_actions = summary_list_items.any? { |summary_list_item| summary_list_item[:actions].present? }
36
+ any_row_has_actions = summary_list_items.any? { |summary_list_item| summary_list_item[:actions].present? }
36
37
 
37
- @summary_list_rows = summary_list_items.map { |summary_list_item| Row.new(any_row_has_actions: any_row_has_actions, context: @context, **summary_list_item) }
38
- @card = Card.new(context: @context, **card) if card
39
- end
38
+ @summary_list_rows = summary_list_items.map { |summary_list_item| Row.new(any_row_has_actions: any_row_has_actions, context: @context, **summary_list_item) }
39
+ @card = Card.new(context: @context, **card) if card
40
+ end
40
41
 
41
- # Generates the HTML for the GOV.UK Summary list component
42
- #
43
- # @return [ActiveSupport::SafeBuffer]
42
+ # Generates the HTML for the GOV.UK Summary list component
43
+ #
44
+ # @return [ActiveSupport::SafeBuffer]
44
45
 
45
- def render
46
- if card
47
- card.render do
46
+ def render
47
+ if card
48
+ card.render do
49
+ render_summary_list
50
+ end
51
+ else
48
52
  render_summary_list
49
53
  end
50
- else
51
- render_summary_list
52
54
  end
53
- end
54
55
 
55
- # The default attributes for the summary list
56
+ # The default attributes for the summary list
56
57
 
57
- DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list' }.freeze
58
+ DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list' }.freeze
58
59
 
59
- private
60
+ private
60
61
 
61
- # Generates the HTML for the actual summary list
62
- #
63
- # @return [ActiveSupport::SafeBuffer]
62
+ # Generates the HTML for the actual summary list
63
+ #
64
+ # @return [ActiveSupport::SafeBuffer]
64
65
 
65
- def render_summary_list
66
- tag.dl(**options[:attributes]) do
67
- summary_list_rows.each { |summary_list_row| concat(summary_list_row.render) }
66
+ def render_summary_list
67
+ tag.dl(**options[:attributes]) do
68
+ summary_list_rows.each { |summary_list_row| concat(summary_list_row.render) }
69
+ end
68
70
  end
69
71
  end
70
72
  end
@@ -1,49 +1,51 @@
1
1
  require_relative '../../../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- class Table < Base
6
- class Body
7
- # = GOV.UK Table Body data cell
8
- #
9
- # The individual table body data cell
10
- #
11
- # @!attribute [r] text
12
- # @return [String] Text for the cell
13
-
14
- class DataCell < Base
15
- private
16
-
17
- attr_reader :text
18
-
19
- public
20
-
21
- # @param text [String] the text of the cell
22
- # @param options [Hash] options that will be used in customising the HTML
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ class Table < Base
7
+ class Body
8
+ # = GOV.UK Table Body data cell
23
9
  #
24
- # @option options [String] :classes additional CSS classes for the cell
25
- # @option options [String] :format specify format of a cell
26
- # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the cell
10
+ # The individual table body data cell
11
+ #
12
+ # @!attribute [r] text
13
+ # @return [String] Text for the cell
27
14
 
28
- def initialize(text:, **options)
29
- super(**options)
15
+ class DataCell < Base
16
+ private
30
17
 
31
- @options[:attributes][:class] += " govuk-table__cell--#{@options[:format]}" if @options[:format]
18
+ attr_reader :text
32
19
 
33
- @text = text
34
- end
20
+ public
35
21
 
36
- # Generates the HTML for the GOV.UK Table Body data cell
37
- #
38
- # @return [ActiveSupport::SafeBuffer]
22
+ # @param text [String] the text of the cell
23
+ # @param options [Hash] options that will be used in customising the HTML
24
+ #
25
+ # @option options [String] :classes additional CSS classes for the cell
26
+ # @option options [String] :format specify format of a cell
27
+ # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the cell
39
28
 
40
- def render
41
- tag.td(text, **options[:attributes])
42
- end
29
+ def initialize(text:, **options)
30
+ super(**options)
31
+
32
+ @options[:attributes][:class] += " govuk-table__cell--#{@options[:format]}" if @options[:format]
43
33
 
44
- # The default attributes for the table body data cell
34
+ @text = text
35
+ end
45
36
 
46
- DEFAULT_ATTRIBUTES = { class: 'govuk-table__cell' }.freeze
37
+ # Generates the HTML for the GOV.UK Table Body data cell
38
+ #
39
+ # @return [ActiveSupport::SafeBuffer]
40
+
41
+ def render
42
+ tag.td(text, **options[:attributes])
43
+ end
44
+
45
+ # The default attributes for the table body data cell
46
+
47
+ DEFAULT_ATTRIBUTES = { class: 'govuk-table__cell' }.freeze
48
+ end
47
49
  end
48
50
  end
49
51
  end
@@ -1,48 +1,50 @@
1
1
  require_relative '../../../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- class Table < Base
6
- class Body
7
- # = GOV.UK Table Body head cell
8
- #
9
- # The individual table body head cell
10
- #
11
- # @!attribute [r] text
12
- # @return [String] Text for the cell
13
-
14
- class HeadCell < Base
15
- private
16
-
17
- attr_reader :text
18
-
19
- public
20
-
21
- # @param text [String] the text of the cell
22
- # @param options [Hash] options that will be used in customising the HTML
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ class Table < Base
7
+ class Body
8
+ # = GOV.UK Table Body head cell
23
9
  #
24
- # @option options [String] :classes additional CSS classes for the cell
25
- # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the cell
10
+ # The individual table body head cell
11
+ #
12
+ # @!attribute [r] text
13
+ # @return [String] Text for the cell
26
14
 
27
- def initialize(text:, **options)
28
- super(**options)
15
+ class HeadCell < Base
16
+ private
29
17
 
30
- @options[:attributes][:scope] = 'row'
18
+ attr_reader :text
31
19
 
32
- @text = text
33
- end
20
+ public
34
21
 
35
- # Generates the HTML for the GOV.UK Table Body head cell
36
- #
37
- # @return [ActiveSupport::SafeBuffer]
22
+ # @param text [String] the text of the cell
23
+ # @param options [Hash] options that will be used in customising the HTML
24
+ #
25
+ # @option options [String] :classes additional CSS classes for the cell
26
+ # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the cell
38
27
 
39
- def render
40
- tag.th(text, **options[:attributes])
41
- end
28
+ def initialize(text:, **options)
29
+ super(**options)
30
+
31
+ @options[:attributes][:scope] = 'row'
42
32
 
43
- # The default attributes for the table body head cell
33
+ @text = text
34
+ end
44
35
 
45
- DEFAULT_ATTRIBUTES = { class: 'govuk-table__header' }.freeze
36
+ # Generates the HTML for the GOV.UK Table Body head cell
37
+ #
38
+ # @return [ActiveSupport::SafeBuffer]
39
+
40
+ def render
41
+ tag.th(text, **options[:attributes])
42
+ end
43
+
44
+ # The default attributes for the table body head cell
45
+
46
+ DEFAULT_ATTRIBUTES = { class: 'govuk-table__header' }.freeze
47
+ end
46
48
  end
47
49
  end
48
50
  end
@@ -1,50 +1,52 @@
1
1
  require_relative '../../../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- class Table < Base
6
- class Header
7
- # = GOV.UK Table Header head cell
8
- #
9
- # The individual table header head cell
10
- #
11
- # @!attribute [r] text
12
- # @return [String] Text for the cell
13
-
14
- class HeadCell < Base
15
- private
16
-
17
- attr_reader :text
18
-
19
- public
20
-
21
- # @param text [String] the text of the cell
22
- # @param options [Hash] options that will be used in customising the HTML
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ class Table < Base
7
+ class Header
8
+ # = GOV.UK Table Header head cell
23
9
  #
24
- # @option options [String] :classes additional CSS classes for the cell
25
- # @option options [String] :format specify format of a cell
26
- # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the cell
10
+ # The individual table header head cell
11
+ #
12
+ # @!attribute [r] text
13
+ # @return [String] Text for the cell
27
14
 
28
- def initialize(text:, **options)
29
- super(**options)
15
+ class HeadCell < Base
16
+ private
30
17
 
31
- @options[:attributes][:class] += " govuk-table__header--#{@options[:format]}" if @options[:format]
32
- @options[:attributes][:scope] = 'col'
18
+ attr_reader :text
33
19
 
34
- @text = text
35
- end
20
+ public
36
21
 
37
- # Generates the HTML for the GOV.UK Table Header head cell
38
- #
39
- # @return [ActiveSupport::SafeBuffer]
22
+ # @param text [String] the text of the cell
23
+ # @param options [Hash] options that will be used in customising the HTML
24
+ #
25
+ # @option options [String] :classes additional CSS classes for the cell
26
+ # @option options [String] :format specify format of a cell
27
+ # @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the cell
40
28
 
41
- def render
42
- tag.th(text, **options[:attributes])
43
- end
29
+ def initialize(text:, **options)
30
+ super(**options)
31
+
32
+ @options[:attributes][:class] += " govuk-table__header--#{@options[:format]}" if @options[:format]
33
+ @options[:attributes][:scope] = 'col'
44
34
 
45
- # The default attributes for the table header head cell
35
+ @text = text
36
+ end
46
37
 
47
- DEFAULT_ATTRIBUTES = { class: 'govuk-table__header' }.freeze
38
+ # Generates the HTML for the GOV.UK Table Header head cell
39
+ #
40
+ # @return [ActiveSupport::SafeBuffer]
41
+
42
+ def render
43
+ tag.th(text, **options[:attributes])
44
+ end
45
+
46
+ # The default attributes for the table header head cell
47
+
48
+ DEFAULT_ATTRIBUTES = { class: 'govuk-table__header' }.freeze
49
+ end
48
50
  end
49
51
  end
50
52
  end