ccs-frontend_helpers 2.1.0 → 2.3.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 +4 -4
- data/.rubocop.yml +7 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +23 -1
- data/Gemfile +5 -5
- data/Gemfile.lock +109 -100
- data/README.md +2 -0
- data/bun.lock +18 -0
- data/ccs-frontend_helpers.gemspec +2 -2
- data/lib/ccs/components/ccs/contact_us.rb +2 -2
- data/lib/ccs/components/ccs/dashboard_section/panel.rb +2 -2
- data/lib/ccs/components/ccs/dashboard_section.rb +2 -2
- data/lib/ccs/components/ccs/footer/link.rb +2 -2
- data/lib/ccs/components/ccs/footer.rb +2 -2
- data/lib/ccs/components/ccs/header/link.rb +23 -5
- data/lib/ccs/components/ccs/header.rb +2 -2
- data/lib/ccs/components/ccs/password_strength.rb +2 -2
- data/lib/ccs/components/govuk/back_link.rb +2 -2
- data/lib/ccs/components/govuk/breadcrumbs/link.rb +2 -2
- data/lib/ccs/components/govuk/breadcrumbs.rb +2 -2
- data/lib/ccs/components/govuk/button.rb +2 -2
- data/lib/ccs/components/govuk/cookie_banner/action.rb +2 -2
- data/lib/ccs/components/govuk/cookie_banner/message.rb +2 -2
- data/lib/ccs/components/govuk/cookie_banner.rb +2 -2
- data/lib/ccs/components/govuk/details.rb +2 -2
- data/lib/ccs/components/govuk/error_message.rb +2 -2
- data/lib/ccs/components/govuk/error_summary/item.rb +2 -2
- data/lib/ccs/components/govuk/error_summary.rb +2 -2
- data/lib/ccs/components/govuk/field/input/character_count.rb +2 -0
- data/lib/ccs/components/govuk/field/input/file_upload.rb +60 -4
- data/lib/ccs/components/govuk/field/input/select.rb +2 -2
- data/lib/ccs/components/govuk/field/input/text_input/fix.rb +2 -2
- data/lib/ccs/components/govuk/field/input/text_input.rb +2 -2
- data/lib/ccs/components/govuk/field/input/textarea.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/item/radio.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/item.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs/radios.rb +2 -2
- data/lib/ccs/components/govuk/field/inputs.rb +1 -1
- data/lib/ccs/components/govuk/field.rb +2 -2
- data/lib/ccs/components/govuk/fieldset/legend.rb +2 -2
- data/lib/ccs/components/govuk/fieldset.rb +2 -2
- data/lib/ccs/components/govuk/footer/link.rb +2 -2
- data/lib/ccs/components/govuk/footer.rb +2 -2
- data/lib/ccs/components/govuk/form_group.rb +2 -2
- data/lib/ccs/components/govuk/header/link.rb +2 -2
- data/lib/ccs/components/govuk/header.rb +2 -2
- data/lib/ccs/components/govuk/hint.rb +2 -2
- data/lib/ccs/components/govuk/inset_text.rb +2 -2
- data/lib/ccs/components/govuk/label.rb +2 -2
- data/lib/ccs/components/govuk/notification_banner.rb +2 -2
- data/lib/ccs/components/govuk/pagination/increment/next.rb +2 -2
- data/lib/ccs/components/govuk/pagination/increment/previous.rb +2 -2
- data/lib/ccs/components/govuk/pagination/increment.rb +2 -2
- data/lib/ccs/components/govuk/pagination/item/form.rb +2 -2
- data/lib/ccs/components/govuk/pagination/item/tag.rb +2 -2
- data/lib/ccs/components/govuk/pagination/item.rb +2 -2
- data/lib/ccs/components/govuk/pagination.rb +2 -2
- data/lib/ccs/components/govuk/panel.rb +2 -2
- data/lib/ccs/components/govuk/phase_banner.rb +2 -2
- data/lib/ccs/components/govuk/service_navigation.rb +2 -2
- data/lib/ccs/components/govuk/skip_link.rb +2 -2
- data/lib/ccs/components/govuk/step_by_step_navigation.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/action/link.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/card/actions.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/card/title.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/card.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/row/actions.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/row/key.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/row/value.rb +2 -2
- data/lib/ccs/components/govuk/summary_list/row.rb +2 -2
- data/lib/ccs/components/govuk/summary_list.rb +2 -2
- data/lib/ccs/components/govuk/table/body/data_cell.rb +2 -2
- data/lib/ccs/components/govuk/table/body/head_cell.rb +2 -2
- data/lib/ccs/components/govuk/table/header/head_cell.rb +2 -2
- data/lib/ccs/components/govuk/table.rb +2 -2
- data/lib/ccs/components/govuk/tabs/panel.rb +2 -2
- data/lib/ccs/components/govuk/tabs/tab.rb +2 -2
- data/lib/ccs/components/govuk/tabs.rb +2 -2
- data/lib/ccs/components/govuk/tag.rb +2 -2
- data/lib/ccs/components/govuk/task_list/item/status.rb +2 -2
- data/lib/ccs/components/govuk/task_list/item/title.rb +2 -2
- data/lib/ccs/components/govuk/task_list/item.rb +2 -2
- data/lib/ccs/components/govuk/task_list.rb +2 -2
- data/lib/ccs/components/govuk/warning_text.rb +2 -2
- data/lib/ccs/frontend_helpers/ccs_frontend/contact_us.rb +2 -2
- data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +2 -2
- data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +2 -2
- data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +2 -2
- data/lib/ccs/frontend_helpers/ccs_frontend/password_strength.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +4 -4
- data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +4 -4
- data/lib/ccs/frontend_helpers/govuk_frontend/exit_this_page.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/password_input.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/service_navigation.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/task_list.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +2 -2
- data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +2 -2
- data/lib/ccs/frontend_helpers/version.rb +1 -1
- data/package.json +2 -2
- metadata +7 -11
- data/yarn.lock +0 -13
@@ -28,8 +28,8 @@ module CCS
|
|
28
28
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
|
29
29
|
# If the link is blank then it defaults to +{ aria: { current: 'page' } }+
|
30
30
|
|
31
|
-
def initialize(text:, href: nil, **
|
32
|
-
super(**
|
31
|
+
def initialize(text:, href: nil, **)
|
32
|
+
super(**)
|
33
33
|
|
34
34
|
@text = text
|
35
35
|
@href = href
|
@@ -27,8 +27,8 @@ module CCS
|
|
27
27
|
# @option options [Boolean] :collapse_on_mobile indicates if it is to colapse breadcrumbs on mobile
|
28
28
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
29
29
|
|
30
|
-
def initialize(breadcrumb_links:, **
|
31
|
-
super(**
|
30
|
+
def initialize(breadcrumb_links:, **)
|
31
|
+
super(**)
|
32
32
|
@options[:attributes][:class] << ' govuk-breadcrumbs--collapse-on-mobile' if @options[:collapse_on_mobile]
|
33
33
|
(@options[:attributes][:aria] ||= {})[:label] ||= 'Breadcrumb'
|
34
34
|
|
@@ -29,8 +29,8 @@ module CCS
|
|
29
29
|
# @option options [ActionView::Helpers::FormBuilder] :form the form builder used to create the submit button
|
30
30
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
31
31
|
|
32
|
-
def initialize(text:, **
|
33
|
-
super(**
|
32
|
+
def initialize(text:, **)
|
33
|
+
super(**)
|
34
34
|
|
35
35
|
if @options[:attributes][:disabled]
|
36
36
|
@options[:attributes][:aria] ||= {}
|
@@ -31,8 +31,8 @@ module CCS
|
|
31
31
|
# If the +:type+ key is present with a value of +:button+,
|
32
32
|
# the action will be rendered as a button
|
33
33
|
|
34
|
-
def initialize(text:, href: nil, **
|
35
|
-
super(**
|
34
|
+
def initialize(text:, href: nil, **)
|
35
|
+
super(**)
|
36
36
|
|
37
37
|
@text = text
|
38
38
|
@href = href
|
@@ -35,8 +35,8 @@ module CCS
|
|
35
35
|
# @option options [String] :classes additional CSS classes for the cookie message HTML
|
36
36
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
37
37
|
|
38
|
-
def initialize(heading_text: nil, content: nil, text: nil, actions: nil, **
|
39
|
-
super(**
|
38
|
+
def initialize(heading_text: nil, content: nil, text: nil, actions: nil, **)
|
39
|
+
super(**)
|
40
40
|
|
41
41
|
@heading_text = heading_text
|
42
42
|
@content = content
|
@@ -26,8 +26,8 @@ module CCS
|
|
26
26
|
# @option options [String] :classes additional CSS classes for the cookie banner HTML
|
27
27
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
28
28
|
|
29
|
-
def initialize(messages:, **
|
30
|
-
super(**
|
29
|
+
def initialize(messages:, **)
|
30
|
+
super(**)
|
31
31
|
|
32
32
|
(@options[:attributes][:data] ||= {})[:nosnippet] = 'true'
|
33
33
|
@options[:attributes][:role] = 'region'
|
@@ -24,8 +24,8 @@ module CCS
|
|
24
24
|
# @option options [String] :classes additional CSS classes for the details HTML
|
25
25
|
# @option options [Hash] :attributes ({ data: { module: 'govuk-details' } }) any additional attributes that will added as part of the HTML
|
26
26
|
|
27
|
-
def initialize(summary_text:, **
|
28
|
-
super(**
|
27
|
+
def initialize(summary_text:, **)
|
28
|
+
super(**)
|
29
29
|
|
30
30
|
@summary_text = summary_text
|
31
31
|
end
|
@@ -30,8 +30,8 @@ module CCS
|
|
30
30
|
# @option options [String] :visually_hidden_text ('Error') visualy hidden text before the error message
|
31
31
|
# @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the HTML
|
32
32
|
|
33
|
-
def initialize(message:, attribute:, **
|
34
|
-
super(**
|
33
|
+
def initialize(message:, attribute:, **)
|
34
|
+
super(**)
|
35
35
|
|
36
36
|
@options[:attributes][:id] ||= "#{attribute}-error" if attribute
|
37
37
|
|
@@ -27,8 +27,8 @@ module CCS
|
|
27
27
|
#
|
28
28
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML.
|
29
29
|
|
30
|
-
def initialize(text:, href: nil, **
|
31
|
-
super(**
|
30
|
+
def initialize(text:, href: nil, **)
|
31
|
+
super(**)
|
32
32
|
|
33
33
|
@text = text
|
34
34
|
@href = href
|
@@ -31,8 +31,8 @@ module CCS
|
|
31
31
|
# @option options [String] :classes additional CSS classes for the error summary HTML
|
32
32
|
# @option options [Hash] :attributes ({}) any additional attributes that will be added as part of the HTML
|
33
33
|
|
34
|
-
def initialize(title:, error_summary_items: [], description: nil, **
|
35
|
-
super(**
|
34
|
+
def initialize(title:, error_summary_items: [], description: nil, **)
|
35
|
+
super(**)
|
36
36
|
|
37
37
|
@title = title
|
38
38
|
@error_summary_items = error_summary_items.map { |error_summary_item| Item.new(context: @context, **error_summary_item) }
|
@@ -58,6 +58,8 @@ module CCS
|
|
58
58
|
def initialise_textarea(attribute, character_count_attribute, character_count_options, context, options)
|
59
59
|
set_character_count_from_group_options(character_count_options, options)
|
60
60
|
|
61
|
+
character_count_attribute = options.dig(:attributes, :id) if options.dig(:attributes, :id)
|
62
|
+
|
61
63
|
((options[:attributes] ||= {})[:aria] ||= {})[:describedby] = [options.dig(:attributes, :aria, :describedby), "#{character_count_attribute}-info"].compact.join(' ')
|
62
64
|
options[:classes] = "govuk-js-character-count #{options[:classes]}".rstrip
|
63
65
|
|
@@ -9,8 +9,52 @@ module CCS
|
|
9
9
|
#
|
10
10
|
# This is used for generating the file upload component from the
|
11
11
|
# {https://design-system.service.gov.uk/components/file-upload GDS - Components - File Upload}
|
12
|
+
#
|
13
|
+
# @!attribute [r] javascript
|
14
|
+
# @return [Boolean] Used to enable JavaScript enhancements for the component
|
15
|
+
# @!attribute [r] file_upload_javascript_options
|
16
|
+
# @return [Hash] HTML options for the JavaScript part of file upload
|
12
17
|
|
13
18
|
class FileUpload < Input
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :javascript, :file_upload_javascript_options
|
22
|
+
|
23
|
+
public
|
24
|
+
|
25
|
+
# @param (see CCS::Components::GovUK::Field::Upload#initialize)
|
26
|
+
# @param javascript [Boolean] used to enable JavaScript enhancements for the component
|
27
|
+
#
|
28
|
+
# @option (see CCS::Components::GovUK::Field::Upload#initialize)
|
29
|
+
|
30
|
+
def initialize(attribute:, javascript: false, **)
|
31
|
+
super(attribute: attribute, **)
|
32
|
+
|
33
|
+
@javascript = javascript
|
34
|
+
|
35
|
+
return unless javascript
|
36
|
+
|
37
|
+
@file_upload_javascript_options = {
|
38
|
+
class: 'govuk-drop-zone',
|
39
|
+
data: {
|
40
|
+
module: 'govuk-file-upload'
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
%i[choose_files_button no_file_chosen multiple_files_chosen drop_instruction entered_drop_zone left_drop_zone].each do |data_attribute|
|
45
|
+
data_attribute_name = :"#{data_attribute}_text"
|
46
|
+
if options[data_attribute_name]
|
47
|
+
if options[data_attribute_name].is_a? Hash
|
48
|
+
options[data_attribute_name].each do |key, value|
|
49
|
+
@file_upload_javascript_options[:data][:"i18n.#{data_attribute.to_s.gsub('_', '-')}.#{key}"] = value
|
50
|
+
end
|
51
|
+
else
|
52
|
+
@file_upload_javascript_options[:data][:"i18n.#{data_attribute.to_s.gsub('_', '-')}"] = options[data_attribute_name]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
14
58
|
# @param (see CCS::Components::GovUK::Field::Input#initialize)
|
15
59
|
#
|
16
60
|
# @option (see CCS::Components::GovUK::Field::Input#initialize)
|
@@ -21,10 +65,12 @@ module CCS
|
|
21
65
|
|
22
66
|
def render
|
23
67
|
super do
|
24
|
-
|
25
|
-
options[:form]
|
26
|
-
|
27
|
-
|
68
|
+
javascript_wrapper do
|
69
|
+
if options[:form]
|
70
|
+
options[:form].file_field(attribute, **options[:attributes])
|
71
|
+
else
|
72
|
+
context.file_field_tag(attribute, **options[:attributes])
|
73
|
+
end
|
28
74
|
end
|
29
75
|
end
|
30
76
|
end
|
@@ -32,6 +78,16 @@ module CCS
|
|
32
78
|
# The default attributes for the file upload
|
33
79
|
|
34
80
|
DEFAULT_ATTRIBUTES = { class: 'govuk-file-upload' }.freeze
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
def javascript_wrapper(&)
|
85
|
+
if javascript
|
86
|
+
tag.div(**file_upload_javascript_options, &)
|
87
|
+
else
|
88
|
+
yield
|
89
|
+
end
|
90
|
+
end
|
35
91
|
end
|
36
92
|
end
|
37
93
|
end
|
@@ -32,8 +32,8 @@ module CCS
|
|
32
32
|
#
|
33
33
|
# @option (see CCS::Components::GovUK::Field::Input#initialize)
|
34
34
|
|
35
|
-
def initialize(attribute:, items:, selected: nil, **
|
36
|
-
super(attribute: attribute, **
|
35
|
+
def initialize(attribute:, items:, selected: nil, **)
|
36
|
+
super(attribute: attribute, **)
|
37
37
|
|
38
38
|
@items = items.map do |item|
|
39
39
|
[
|
@@ -28,8 +28,8 @@ module CCS
|
|
28
28
|
# @option options [String] :classes additional CSS classes for the prefix/suffix HTML
|
29
29
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
30
30
|
|
31
|
-
def initialize(text:, fix:, **
|
32
|
-
super(**
|
31
|
+
def initialize(text:, fix:, **)
|
32
|
+
super(**)
|
33
33
|
|
34
34
|
@options[:attributes][:class] = "govuk-input__#{fix}fix #{@options[:attributes][:class]}".rstrip
|
35
35
|
(@options[:attributes][:aria] ||= {})[:hidden] = true
|
@@ -42,8 +42,8 @@ module CCS
|
|
42
42
|
#
|
43
43
|
# @option (see CCS::Components::GovUK::Field::Input#initialize)
|
44
44
|
|
45
|
-
def initialize(attribute:, field_type: :text, value: nil, prefix: nil, suffix: nil, input_wrapper: {}, **
|
46
|
-
super(attribute: attribute, **
|
45
|
+
def initialize(attribute:, field_type: :text, value: nil, prefix: nil, suffix: nil, input_wrapper: {}, **)
|
46
|
+
super(attribute: attribute, **)
|
47
47
|
|
48
48
|
@field_type = :"#{field_type}_field"
|
49
49
|
@value = @options[:model] ? @options[:model].send(attribute) : value
|
@@ -26,8 +26,8 @@ module CCS
|
|
26
26
|
#
|
27
27
|
# @option (see CCS::Components::GovUK::Field::Input#initialize)
|
28
28
|
|
29
|
-
def initialize(attribute:, content: nil, rows: 5, **
|
30
|
-
super(attribute: attribute, **
|
29
|
+
def initialize(attribute:, content: nil, rows: 5, **)
|
30
|
+
super(attribute: attribute, **)
|
31
31
|
|
32
32
|
@options[:attributes][:rows] ||= rows
|
33
33
|
|
@@ -22,8 +22,8 @@ module CCS
|
|
22
22
|
#
|
23
23
|
# @option (see CCS::Components::GovUK::Field::Inputs#initialize)
|
24
24
|
|
25
|
-
def initialize(attribute:, checkbox_items:, **
|
26
|
-
super(attribute: attribute, **
|
25
|
+
def initialize(attribute:, checkbox_items:, **)
|
26
|
+
super(attribute: attribute, **)
|
27
27
|
|
28
28
|
@options[:values] ||= []
|
29
29
|
@options[:values] = (@options[:model] || @options[:form].object).send(attribute) || [] if @options[:model] || @options[:form]
|
@@ -16,8 +16,8 @@ module CCS
|
|
16
16
|
#
|
17
17
|
# @option (see CCS::Components::GovUK::Field::Items::Item#initialize))
|
18
18
|
|
19
|
-
def initialize(attribute:, label:, **
|
20
|
-
super(attribute: attribute, item_class: 'govuk-checkboxes__item', **
|
19
|
+
def initialize(attribute:, label:, **)
|
20
|
+
super(attribute: attribute, item_class: 'govuk-checkboxes__item', **)
|
21
21
|
|
22
22
|
label[:classes] = "govuk-checkboxes__label #{label[:classes]}".rstrip
|
23
23
|
end
|
@@ -16,8 +16,8 @@ module CCS
|
|
16
16
|
#
|
17
17
|
# @option (see CCS::Components::GovUK::Field::Items::Item#initialize))
|
18
18
|
|
19
|
-
def initialize(attribute:, label:, **
|
20
|
-
super(attribute: attribute, item_class: 'govuk-radios__item', **
|
19
|
+
def initialize(attribute:, label:, **)
|
20
|
+
super(attribute: attribute, item_class: 'govuk-radios__item', **)
|
21
21
|
|
22
22
|
label[:classes] = "govuk-radios__label #{label[:classes]}".rstrip
|
23
23
|
end
|
@@ -56,8 +56,8 @@ module CCS
|
|
56
56
|
# @option conditional [ActiveSupport::SafeBuffer] content the HTML content
|
57
57
|
# @option conditional [Hash] attributes[:id] the id of the conditional section
|
58
58
|
|
59
|
-
def initialize(attribute:, value:, item_class:, hint: nil, conditional: nil, **
|
60
|
-
super(**
|
59
|
+
def initialize(attribute:, value:, item_class:, hint: nil, conditional: nil, **)
|
60
|
+
super(**)
|
61
61
|
|
62
62
|
initialise_item_hint(attribute, value, hint) if hint
|
63
63
|
initialize_item_conditional(attribute, value, conditional) if conditional && conditional[:content]
|
@@ -28,8 +28,8 @@ module CCS
|
|
28
28
|
#
|
29
29
|
# @option (see CCS::Components::GovUK::Field::Inputs#initialize)
|
30
30
|
|
31
|
-
def initialize(attribute:, radio_items:, **
|
32
|
-
super(attribute: attribute, **
|
31
|
+
def initialize(attribute:, radio_items:, **)
|
32
|
+
super(attribute: attribute, **)
|
33
33
|
|
34
34
|
@options[:value] = (@options[:model] || @options[:form].object).send(attribute) if @options[:model] || @options[:form]
|
35
35
|
|
@@ -45,8 +45,8 @@ module CCS
|
|
45
45
|
# @option options [String] :classes additional CSS classes for the field HTML
|
46
46
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
47
47
|
|
48
|
-
def initialize(attribute:, form_group: nil, hint: nil, before_input: nil, after_input: nil, **
|
49
|
-
super(**
|
48
|
+
def initialize(attribute:, form_group: nil, hint: nil, before_input: nil, after_input: nil, **)
|
49
|
+
super(**)
|
50
50
|
|
51
51
|
(hint[:attributes] ||= {})[:id] = "#{attribute}-hint" if hint && !hint.dig(:attributes, :id)
|
52
52
|
|
@@ -32,8 +32,8 @@ module CCS
|
|
32
32
|
# @option caption [String] :text text for the caption
|
33
33
|
# @option caption [String] :classes additional CSS classes for the caption HTML
|
34
34
|
|
35
|
-
def initialize(text:, is_page_heading: nil, caption: nil, **
|
36
|
-
super(**
|
35
|
+
def initialize(text:, is_page_heading: nil, caption: nil, **)
|
36
|
+
super(**)
|
37
37
|
|
38
38
|
@text = text
|
39
39
|
@is_page_heading = is_page_heading
|
@@ -26,8 +26,8 @@ module CCS
|
|
26
26
|
# @option options [String] :classes additional CSS classes for the fieldset HTML
|
27
27
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
28
28
|
|
29
|
-
def initialize(legend: nil, **
|
30
|
-
super(**
|
29
|
+
def initialize(legend: nil, **)
|
30
|
+
super(**)
|
31
31
|
|
32
32
|
@legend = Legend.new(context: @context, **legend) if legend
|
33
33
|
end
|
@@ -29,8 +29,8 @@ module CCS
|
|
29
29
|
#
|
30
30
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
31
31
|
|
32
|
-
def initialize(text:, href:, li_class:, **
|
33
|
-
super(**
|
32
|
+
def initialize(text:, href:, li_class:, **)
|
33
|
+
super(**)
|
34
34
|
|
35
35
|
@text = text
|
36
36
|
@href = href
|
@@ -34,8 +34,8 @@ module CCS
|
|
34
34
|
# @option options [ActiveSupport::SafeBuffer,String] :copyright The copyright information, (default: '© Crown copyright')
|
35
35
|
# @option options [Hash] :attributes additional attributes that will added as part of the HTML
|
36
36
|
|
37
|
-
def initialize(navigation: nil, meta: nil, **
|
38
|
-
super(**
|
37
|
+
def initialize(navigation: nil, meta: nil, **)
|
38
|
+
super(**)
|
39
39
|
|
40
40
|
@options[:copyright] ||= '© Crown copyright'
|
41
41
|
|
@@ -27,8 +27,8 @@ module CCS
|
|
27
27
|
# @option options [String] :classes additional CSS classes for the form group HTML
|
28
28
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
29
29
|
|
30
|
-
def initialize(attribute:, error_message: nil, **
|
31
|
-
super(**
|
30
|
+
def initialize(attribute:, error_message: nil, **)
|
31
|
+
super(**)
|
32
32
|
|
33
33
|
@options[:attributes][:id] ||= "#{attribute}-form-group"
|
34
34
|
@options[:attributes][:class][..15] = 'govuk-form-group govuk-form-group--error' if error_message
|
@@ -27,8 +27,8 @@ module CCS
|
|
27
27
|
# @option options [Boolean] :active flag to mark the navigation item as active or not
|
28
28
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
29
29
|
|
30
|
-
def initialize(text:, href: nil, **
|
31
|
-
super(**
|
30
|
+
def initialize(text:, href: nil, **)
|
31
|
+
super(**)
|
32
32
|
|
33
33
|
@text = text
|
34
34
|
@href = href
|
@@ -38,8 +38,8 @@ module CCS
|
|
38
38
|
# @option options [Boolean] :use_tudor_crown flag to use the new tudor crown for the GOV.UK Logo
|
39
39
|
# @option options [Hash] :attributes additional attributes that will added as part of the header HTML
|
40
40
|
|
41
|
-
def initialize(navigation: nil, menu_button: nil, service: nil, **
|
42
|
-
super(**
|
41
|
+
def initialize(navigation: nil, menu_button: nil, service: nil, **)
|
42
|
+
super(**)
|
43
43
|
|
44
44
|
@options[:container_classes] ||= 'govuk-width-container'
|
45
45
|
@options[:homepage_url] ||= '/'
|
@@ -24,8 +24,8 @@ module CCS
|
|
24
24
|
# @option options [String] :classes additional CSS classes for the hint HTML
|
25
25
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
26
26
|
|
27
|
-
def initialize(text: nil, **
|
28
|
-
super(**
|
27
|
+
def initialize(text: nil, **)
|
28
|
+
super(**)
|
29
29
|
|
30
30
|
@text = text
|
31
31
|
end
|
@@ -25,8 +25,8 @@ module CCS
|
|
25
25
|
# @option options [String] :classes additional CSS classes for the inset text HTML
|
26
26
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
27
27
|
|
28
|
-
def initialize(text: nil, **
|
29
|
-
super(**
|
28
|
+
def initialize(text: nil, **)
|
29
|
+
super(**)
|
30
30
|
|
31
31
|
@text = text
|
32
32
|
end
|
@@ -31,8 +31,8 @@ module CCS
|
|
31
31
|
# @option options [Boolean] :is_page_heading (false) if the label is also the heading it will rendered in a h1
|
32
32
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
33
33
|
|
34
|
-
def initialize(attribute:, text: nil, form: nil, **
|
35
|
-
super(**
|
34
|
+
def initialize(attribute:, text: nil, form: nil, **)
|
35
|
+
super(**)
|
36
36
|
|
37
37
|
@attribute = attribute
|
38
38
|
@text = text
|
@@ -32,8 +32,8 @@ module CCS
|
|
32
32
|
# @option options [String] :heading_level (2) the heading level for the title text
|
33
33
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
34
34
|
|
35
|
-
def initialize(text: nil, success_banner: nil, **
|
36
|
-
super(**
|
35
|
+
def initialize(text: nil, success_banner: nil, **)
|
36
|
+
super(**)
|
37
37
|
|
38
38
|
@text = text
|
39
39
|
@success_banner = success_banner || false
|
@@ -14,8 +14,8 @@ module CCS
|
|
14
14
|
#
|
15
15
|
# @option (see Increment#initialize)
|
16
16
|
|
17
|
-
def initialize(text: nil, **
|
18
|
-
super(type: :next, text: text, default_text: 'Next', **
|
17
|
+
def initialize(text: nil, **)
|
18
|
+
super(type: :next, text: text, default_text: 'Next', **)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Generates the HTML for the next link in the pagination
|
@@ -14,8 +14,8 @@ module CCS
|
|
14
14
|
#
|
15
15
|
# @option (see Increment#initialize)
|
16
16
|
|
17
|
-
def initialize(text: nil, **
|
18
|
-
super(type: :prev, text: text, default_text: 'Previous', **
|
17
|
+
def initialize(text: nil, **)
|
18
|
+
super(type: :prev, text: text, default_text: 'Previous', **)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Generates the HTML for the previous link in the pagination
|
@@ -40,8 +40,8 @@ module CCS
|
|
40
40
|
# @option options [ActionView::Helpers::FormBuilder] :form optional form builder used to create the button
|
41
41
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
42
42
|
|
43
|
-
def initialize(type:, default_text:, block_is_level:, text: nil, label_text: nil, **
|
44
|
-
super(**
|
43
|
+
def initialize(type:, default_text:, block_is_level:, text: nil, label_text: nil, **)
|
44
|
+
super(**)
|
45
45
|
|
46
46
|
@options[:attributes][:class] = "govuk-link govuk-pagination__link #{'pagination--button_as_link' if @options[:form]}".rstrip
|
47
47
|
@options[:attributes][:rel] = type.to_s
|
@@ -27,8 +27,8 @@ module CCS
|
|
27
27
|
# @option options [Boolean] :ellipsis If the value is +true+ then an ellipsis will be rendered
|
28
28
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
29
29
|
|
30
|
-
def initialize(number:, current: false, **
|
31
|
-
super(**
|
30
|
+
def initialize(number:, current: false, **)
|
31
|
+
super(**)
|
32
32
|
|
33
33
|
@number = number
|
34
34
|
|
@@ -40,8 +40,8 @@ module CCS
|
|
40
40
|
# @option options [ActionView::Helpers::FormBuilder] :form form builder used to create pagination buttons
|
41
41
|
# @option options [Hash] :attributes any additional attributes that will added as part of the HTML
|
42
42
|
|
43
|
-
def initialize(pagination_previous: nil, pagination_items: nil, pagination_next: nil, **
|
44
|
-
super(**
|
43
|
+
def initialize(pagination_previous: nil, pagination_items: nil, pagination_next: nil, **)
|
44
|
+
super(**)
|
45
45
|
|
46
46
|
block_is_level = pagination_items.blank? && (pagination_previous.present? || pagination_next.present?)
|
47
47
|
|
@@ -29,8 +29,8 @@ module CCS
|
|
29
29
|
# @option options [Integer,String] :heading_level (default: 1) heading level for the panel title text
|
30
30
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
31
31
|
|
32
|
-
def initialize(title_text:, panel_text: nil, **
|
33
|
-
super(**
|
32
|
+
def initialize(title_text:, panel_text: nil, **)
|
33
|
+
super(**)
|
34
34
|
|
35
35
|
@title_text = title_text
|
36
36
|
@panel_text = panel_text
|
@@ -33,8 +33,8 @@ module CCS
|
|
33
33
|
# @option options [String] :classes additional CSS classes for the phase banner HTML
|
34
34
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
35
35
|
|
36
|
-
def initialize(tag_options:, text: nil, **
|
37
|
-
super(**
|
36
|
+
def initialize(tag_options:, text: nil, **)
|
37
|
+
super(**)
|
38
38
|
|
39
39
|
tag_options[:classes] = "govuk-phase-banner__content__tag #{tag_options[:classes]}".rstrip
|
40
40
|
tag_options[:context] = @context
|
@@ -34,8 +34,8 @@ module CCS
|
|
34
34
|
# @option options [String] :classes additional CSS classes for the service navigation HTML
|
35
35
|
# @option options [Hash] :attributes additional attributes that will added as part of the service navigation HTML
|
36
36
|
|
37
|
-
def initialize(navigation: nil, menu_button: nil, service: nil, **
|
38
|
-
super(**
|
37
|
+
def initialize(navigation: nil, menu_button: nil, service: nil, **)
|
38
|
+
super(**)
|
39
39
|
|
40
40
|
(@options[:attributes][:aria] ||= {})[:label] ||= 'Service information' if service
|
41
41
|
|
@@ -27,8 +27,8 @@ module CCS
|
|
27
27
|
# @option options [String] :classes additional CSS classes for the skip link HTML
|
28
28
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
29
29
|
|
30
|
-
def initialize(text:, href: nil, **
|
31
|
-
super(**
|
30
|
+
def initialize(text:, href: nil, **)
|
31
|
+
super(**)
|
32
32
|
|
33
33
|
@text = text
|
34
34
|
@href = href || '#content'
|
@@ -26,8 +26,8 @@ module CCS
|
|
26
26
|
# @option options [String] :classes additional CSS classes for the step by step navigation HTML
|
27
27
|
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
28
28
|
|
29
|
-
def initialize(step_by_step_navigation_sections:, **
|
30
|
-
super(**
|
29
|
+
def initialize(step_by_step_navigation_sections:, **)
|
30
|
+
super(**)
|
31
31
|
|
32
32
|
DEFAULT_SHOW_HIDE_TEXT.each { |key, value| @options[:attributes][:data][key] ||= value }
|
33
33
|
|