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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/Gemfile.lock +1 -1
- data/lib/ccs/components/ccs/dashboard_section/panel.rb +43 -41
- data/lib/ccs/components/ccs/dashboard_section.rb +50 -48
- data/lib/ccs/components/ccs/footer/link.rb +41 -39
- data/lib/ccs/components/ccs/footer/meta.rb +49 -48
- data/lib/ccs/components/ccs/footer/navigation.rb +51 -50
- data/lib/ccs/components/ccs/footer.rb +69 -67
- data/lib/ccs/components/ccs/header/link.rb +47 -45
- data/lib/ccs/components/ccs/header/navigation.rb +85 -84
- data/lib/ccs/components/ccs/header/service_authentication.rb +35 -34
- data/lib/ccs/components/ccs/header.rb +87 -85
- data/lib/ccs/components/ccs/logo.rb +36 -34
- data/lib/ccs/components/govuk/accordion/section/content.rb +42 -42
- data/lib/ccs/components/govuk/accordion/section/header.rb +48 -48
- data/lib/ccs/components/govuk/accordion/section.rb +49 -48
- data/lib/ccs/components/govuk/accordion.rb +43 -41
- data/lib/ccs/components/govuk/back_link.rb +39 -37
- data/lib/ccs/components/govuk/breadcrumbs/link.rb +42 -40
- data/lib/ccs/components/govuk/breadcrumbs.rb +40 -38
- data/lib/ccs/components/govuk/button.rb +83 -81
- data/lib/ccs/components/govuk/cookie_banner/action.rb +45 -43
- data/lib/ccs/components/govuk/cookie_banner/message.rb +57 -55
- data/lib/ccs/components/govuk/cookie_banner.rb +40 -38
- data/lib/ccs/components/govuk/details.rb +38 -36
- data/lib/ccs/components/govuk/error_message.rb +46 -44
- data/lib/ccs/components/govuk/error_summary/item.rb +41 -39
- data/lib/ccs/components/govuk/error_summary.rb +49 -47
- data/lib/ccs/components/govuk/field/input/character_count.rb +101 -99
- data/lib/ccs/components/govuk/field/input/file_upload.rb +29 -27
- data/lib/ccs/components/govuk/field/input/select.rb +61 -59
- data/lib/ccs/components/govuk/field/input/text_input/fix.rb +39 -37
- data/lib/ccs/components/govuk/field/input/text_input.rb +75 -73
- data/lib/ccs/components/govuk/field/input/textarea.rb +43 -41
- data/lib/ccs/components/govuk/field/input.rb +46 -44
- data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +43 -41
- data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +48 -46
- data/lib/ccs/components/govuk/field/inputs/date_input.rb +68 -66
- data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +29 -27
- data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +26 -24
- data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +32 -30
- data/lib/ccs/components/govuk/field/inputs/item/divider.rb +39 -37
- data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +27 -25
- data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +26 -24
- data/lib/ccs/components/govuk/field/inputs/item/radio.rb +32 -30
- data/lib/ccs/components/govuk/field/inputs/item.rb +100 -98
- data/lib/ccs/components/govuk/field/inputs/radios.rb +43 -41
- data/lib/ccs/components/govuk/field/inputs.rb +42 -40
- data/lib/ccs/components/govuk/field.rb +90 -88
- data/lib/ccs/components/govuk/fieldset/legend.rb +50 -48
- data/lib/ccs/components/govuk/fieldset.rb +40 -38
- data/lib/ccs/components/govuk/footer/link.rb +41 -39
- data/lib/ccs/components/govuk/footer/meta.rb +49 -48
- data/lib/ccs/components/govuk/footer/navigation.rb +51 -50
- data/lib/ccs/components/govuk/footer.rb +105 -103
- data/lib/ccs/components/govuk/form_group.rb +45 -43
- data/lib/ccs/components/govuk/header/link.rb +41 -39
- data/lib/ccs/components/govuk/header/navigation.rb +54 -53
- data/lib/ccs/components/govuk/header.rb +84 -82
- data/lib/ccs/components/govuk/hint.rb +33 -31
- data/lib/ccs/components/govuk/inset_text.rb +39 -37
- data/lib/ccs/components/govuk/label.rb +61 -59
- data/lib/ccs/components/govuk/notification_banner.rb +83 -81
- data/lib/ccs/components/govuk/pagination/increment/next.rb +29 -27
- data/lib/ccs/components/govuk/pagination/increment/previous.rb +28 -26
- data/lib/ccs/components/govuk/pagination/increment.rb +78 -76
- data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +17 -15
- data/lib/ccs/components/govuk/pagination/item/form.rb +34 -32
- data/lib/ccs/components/govuk/pagination/item/tag.rb +33 -31
- data/lib/ccs/components/govuk/pagination/item.rb +47 -45
- data/lib/ccs/components/govuk/pagination.rb +69 -67
- data/lib/ccs/components/govuk/panel.rb +49 -47
- data/lib/ccs/components/govuk/phase_banner.rb +50 -48
- data/lib/ccs/components/govuk/skip_link.rb +39 -37
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +40 -38
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +30 -28
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +28 -26
- data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +47 -45
- data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +49 -47
- data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +44 -42
- data/lib/ccs/components/govuk/step_by_step_navigation.rb +41 -39
- data/lib/ccs/components/govuk/summary_list/action/link.rb +46 -44
- data/lib/ccs/components/govuk/summary_list/card/actions.rb +38 -36
- data/lib/ccs/components/govuk/summary_list/card/title.rb +37 -35
- data/lib/ccs/components/govuk/summary_list/card.rb +48 -46
- data/lib/ccs/components/govuk/summary_list/row/actions.rb +38 -36
- data/lib/ccs/components/govuk/summary_list/row/key.rb +30 -28
- data/lib/ccs/components/govuk/summary_list/row/value.rb +30 -28
- data/lib/ccs/components/govuk/summary_list/row.rb +47 -45
- data/lib/ccs/components/govuk/summary_list.rb +48 -46
- data/lib/ccs/components/govuk/table/body/data_cell.rb +38 -36
- data/lib/ccs/components/govuk/table/body/head_cell.rb +37 -35
- data/lib/ccs/components/govuk/table/header/head_cell.rb +39 -37
- data/lib/ccs/components/govuk/table.rb +83 -81
- data/lib/ccs/components/govuk/tabs/panel.rb +47 -45
- data/lib/ccs/components/govuk/tabs/tab.rb +42 -40
- data/lib/ccs/components/govuk/tabs.rb +48 -46
- data/lib/ccs/components/govuk/tag.rb +39 -37
- data/lib/ccs/components/govuk/warning_text.rb +49 -47
- data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +16 -14
- data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +17 -15
- data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +17 -15
- data/lib/ccs/frontend_helpers/ccs_frontend.rb +1 -1
- data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +32 -30
- data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +38 -36
- data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +27 -25
- data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +18 -16
- data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +18 -16
- data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +19 -17
- data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +24 -22
- data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +17 -15
- data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +19 -17
- data/lib/ccs/frontend_helpers/version.rb +1 -1
- metadata +2 -2
@@ -1,43 +1,45 @@
|
|
1
1
|
require_relative '../../../base'
|
2
2
|
|
3
|
-
module CCS
|
4
|
-
module
|
5
|
-
|
6
|
-
class
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
13
|
+
class Key < Base
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
+
attr_reader :text
|
16
17
|
|
17
|
-
|
18
|
+
public
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
25
|
-
|
25
|
+
def initialize(text:, **options)
|
26
|
+
super(**options)
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
@text = text
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
# Generates the HTML for the GOV.UK Summary list row key
|
32
|
+
#
|
33
|
+
# @return [ActiveSupport::SafeBuffer]
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
def render
|
36
|
+
tag.dt(text, class: @options[:attributes][:class])
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
+
# The default attributes for the summary list row key
|
39
40
|
|
40
|
-
|
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
|
4
|
-
module
|
5
|
-
|
6
|
-
class
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
13
|
+
class Value < Base
|
14
|
+
private
|
14
15
|
|
15
|
-
|
16
|
+
attr_reader :text
|
16
17
|
|
17
|
-
|
18
|
+
public
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
25
|
-
|
25
|
+
def initialize(text:, **options)
|
26
|
+
super(**options)
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
@text = text
|
29
|
+
end
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
# Generates the HTML for the GOV.UK Summary list row value
|
32
|
+
#
|
33
|
+
# @return [ActiveSupport::SafeBuffer]
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
def render
|
36
|
+
tag.dd(text, class: @options[:attributes][:class])
|
37
|
+
end
|
37
38
|
|
38
|
-
|
39
|
+
# The default attributes for the summary list row value
|
39
40
|
|
40
|
-
|
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
|
7
|
-
module
|
8
|
-
|
9
|
-
|
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
|
-
#
|
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
|
-
|
36
|
-
|
21
|
+
class Row < Base
|
22
|
+
private
|
37
23
|
|
38
|
-
|
24
|
+
attr_reader :key, :value, :actions
|
39
25
|
|
40
|
-
|
41
|
-
@value = Value.new(context: @context, **value)
|
42
|
-
@actions = Actions.new(context: @context, **actions) if actions
|
43
|
-
end
|
26
|
+
public
|
44
27
|
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
50
|
-
|
51
|
-
|
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
|
-
|
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
|
-
|
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
|
6
|
-
module
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
18
|
-
|
18
|
+
class SummaryList < Base
|
19
|
+
private
|
19
20
|
|
20
|
-
|
21
|
+
attr_reader :summary_list_rows, :card
|
21
22
|
|
22
|
-
|
23
|
+
public
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
33
|
-
|
33
|
+
def initialize(summary_list_items:, card: nil, **options)
|
34
|
+
super(**options)
|
34
35
|
|
35
|
-
|
36
|
+
any_row_has_actions = summary_list_items.any? { |summary_list_item| summary_list_item[:actions].present? }
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
42
|
+
# Generates the HTML for the GOV.UK Summary list component
|
43
|
+
#
|
44
|
+
# @return [ActiveSupport::SafeBuffer]
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
56
|
+
# The default attributes for the summary list
|
56
57
|
|
57
|
-
|
58
|
+
DEFAULT_ATTRIBUTES = { class: 'govuk-summary-list' }.freeze
|
58
59
|
|
59
|
-
|
60
|
+
private
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
|
62
|
+
# Generates the HTML for the actual summary list
|
63
|
+
#
|
64
|
+
# @return [ActiveSupport::SafeBuffer]
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
4
|
-
module
|
5
|
-
|
6
|
-
class
|
7
|
-
|
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
|
-
#
|
25
|
-
#
|
26
|
-
#
|
10
|
+
# The individual table body data cell
|
11
|
+
#
|
12
|
+
# @!attribute [r] text
|
13
|
+
# @return [String] Text for the cell
|
27
14
|
|
28
|
-
|
29
|
-
|
15
|
+
class DataCell < Base
|
16
|
+
private
|
30
17
|
|
31
|
-
|
18
|
+
attr_reader :text
|
32
19
|
|
33
|
-
|
34
|
-
end
|
20
|
+
public
|
35
21
|
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
29
|
+
def initialize(text:, **options)
|
30
|
+
super(**options)
|
31
|
+
|
32
|
+
@options[:attributes][:class] += " govuk-table__cell--#{@options[:format]}" if @options[:format]
|
43
33
|
|
44
|
-
|
34
|
+
@text = text
|
35
|
+
end
|
45
36
|
|
46
|
-
|
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
|
4
|
-
module
|
5
|
-
|
6
|
-
class
|
7
|
-
|
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
|
-
#
|
25
|
-
#
|
10
|
+
# The individual table body head cell
|
11
|
+
#
|
12
|
+
# @!attribute [r] text
|
13
|
+
# @return [String] Text for the cell
|
26
14
|
|
27
|
-
|
28
|
-
|
15
|
+
class HeadCell < Base
|
16
|
+
private
|
29
17
|
|
30
|
-
|
18
|
+
attr_reader :text
|
31
19
|
|
32
|
-
|
33
|
-
end
|
20
|
+
public
|
34
21
|
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
40
|
-
|
41
|
-
|
28
|
+
def initialize(text:, **options)
|
29
|
+
super(**options)
|
30
|
+
|
31
|
+
@options[:attributes][:scope] = 'row'
|
42
32
|
|
43
|
-
|
33
|
+
@text = text
|
34
|
+
end
|
44
35
|
|
45
|
-
|
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
|
4
|
-
module
|
5
|
-
|
6
|
-
class
|
7
|
-
|
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
|
-
#
|
25
|
-
#
|
26
|
-
#
|
10
|
+
# The individual table header head cell
|
11
|
+
#
|
12
|
+
# @!attribute [r] text
|
13
|
+
# @return [String] Text for the cell
|
27
14
|
|
28
|
-
|
29
|
-
|
15
|
+
class HeadCell < Base
|
16
|
+
private
|
30
17
|
|
31
|
-
|
32
|
-
@options[:attributes][:scope] = 'col'
|
18
|
+
attr_reader :text
|
33
19
|
|
34
|
-
|
35
|
-
end
|
20
|
+
public
|
36
21
|
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
35
|
+
@text = text
|
36
|
+
end
|
46
37
|
|
47
|
-
|
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
|