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
@@ -3,41 +3,43 @@
|
|
3
3
|
require_relative '../../components/govuk/back_link'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the error message component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/error-message GDS - Components - Error message}
|
11
|
-
|
12
|
-
module ErrorMessage
|
13
|
-
# Generates the HTML for the GOV.UK Error message component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::ErrorMessage#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Error Message
|
16
9
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
# @return (see CCS::Components::GovUK::ErrorMessage#render)
|
10
|
+
# This helper is used for generating the error message component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/error-message GDS - Components - Error message}
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
module ErrorMessage
|
14
|
+
# Generates the HTML for the GOV.UK Error message component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::ErrorMessage#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::ErrorMessage#initialize)
|
19
|
+
#
|
20
|
+
# @return (see CCS::Components::GovUK::ErrorMessage#render)
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
def govuk_error_message(error_message, attribute, **options)
|
23
|
+
Components::GovUK::ErrorMessage.new(context: self, message: error_message, attribute: attribute, **options).render
|
24
|
+
end
|
25
|
+
|
26
|
+
# Generates the HTML for the GOV.UK Error message component using the error messages in an ActiveModel
|
27
|
+
#
|
28
|
+
# @param model [ActiveModel] model that will be used to find the error message
|
29
|
+
# @param attribute [String, Symbol] the attribute that has an error
|
30
|
+
# @param options [Hash] options that will be used in customising the HTML
|
31
|
+
#
|
32
|
+
# @option (see CCS::Components::GovUK::ErrorMessage#initialize)
|
33
|
+
#
|
34
|
+
# @return [NilClass, ActiveSupport::SafeBuffer] if the error message is not on the model it will return nil,
|
35
|
+
# otherwise it returns the error message HTML
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
def govuk_error_message_with_model(model, attribute, **options)
|
38
|
+
error_message = model.errors[attribute].first
|
39
|
+
return unless error_message
|
39
40
|
|
40
|
-
|
41
|
+
Components::GovUK::ErrorMessage.new(context: self, message: error_message, attribute: attribute, **options).render
|
42
|
+
end
|
41
43
|
end
|
42
44
|
end
|
43
45
|
end
|
@@ -3,43 +3,45 @@
|
|
3
3
|
require_relative '../../components/govuk/error_summary'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the error summary component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/error-summary GDS - Components - Error summary}
|
11
|
-
|
12
|
-
module ErrorSummary
|
13
|
-
# Generates the HTML for the GOV.UK Error summary component
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Error Summary
|
14
9
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
10
|
+
# This helper is used for generating the error summary component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/error-summary GDS - Components - Error summary}
|
12
|
+
|
13
|
+
module ErrorSummary
|
14
|
+
# Generates the HTML for the GOV.UK Error summary component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::ErrorSummary#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::ErrorSummary#initialize)
|
19
|
+
#
|
20
|
+
# @return (see CCS::Components::GovUK::ErrorSummary#render)
|
21
|
+
|
22
|
+
def govuk_error_summary(title, error_summary_items, description = nil, **options)
|
23
|
+
Components::GovUK::ErrorSummary.new(context: self, title: title, error_summary_items: error_summary_items, description: description, **options).render
|
24
|
+
end
|
25
|
+
|
26
|
+
# Generates the HTML for the GOV.UK Error summary component using the error messages in an ActiveModel
|
27
|
+
#
|
28
|
+
# @param model [ActiveModel] model that will be used to find the error messages to list
|
29
|
+
# @param title [String] text to use for the heading of the error summary block
|
30
|
+
# @param description [String] (nil) optional text to use for the description of the errors
|
31
|
+
# @param options [Hash] options that will be used in customising the HTML
|
32
|
+
#
|
33
|
+
# @option (see CCS::Components::GovUK::ErrorSummary#initialize)
|
34
|
+
#
|
35
|
+
# @return [NilClass, ActiveSupport::SafeBuffer] if error messages are not on the model it will return nil,
|
36
|
+
# otherwise it returns the error summary HTML.
|
37
|
+
|
38
|
+
def govuk_error_summary_with_model(model, title, description = nil, **options)
|
39
|
+
return if model.errors.blank?
|
40
|
+
|
41
|
+
error_summary_items = model.errors.map { |error| { text: error.message, href: "##{error.attribute}-error" } }
|
42
|
+
|
43
|
+
Components::GovUK::ErrorSummary.new(context: self, title: title, error_summary_items: error_summary_items, description: description, **options).render
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
45
47
|
end
|
@@ -3,25 +3,27 @@
|
|
3
3
|
require_relative '../../components/govuk/fieldset'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the fieldset component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/fieldset GDS - Components - Fieldset}
|
11
|
-
|
12
|
-
module Fieldset
|
13
|
-
# Generates the HTML for the GOV.UK Fieldset component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::Fieldset#initialize)
|
16
|
-
#
|
17
|
-
# @option (see CCS::Components::GovUK::Fieldset#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Fieldset
|
18
9
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
10
|
+
# This helper is used for generating the fieldset component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/fieldset GDS - Components - Fieldset}
|
12
|
+
|
13
|
+
module Fieldset
|
14
|
+
# Generates the HTML for the GOV.UK Fieldset component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::Fieldset#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::Fieldset#initialize)
|
19
|
+
#
|
20
|
+
# @yield (see CCS::Components::GovUK::Fieldset#render)
|
21
|
+
#
|
22
|
+
# @return (see CCS::Components::GovUK::Fieldset#render)
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
def govuk_fieldset(**options, &block)
|
25
|
+
Components::GovUK::Fieldset.new(context: self, **options).render(&block)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
@@ -3,23 +3,25 @@
|
|
3
3
|
require_relative '../../components/govuk/field/input/file_upload'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the file upload component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/file-upload GDS - Components - File Upload}
|
11
|
-
|
12
|
-
module FileUpload
|
13
|
-
# Generates the HTML for the GOV.UK File Upload component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::Input::FileUpload#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK File Upload
|
16
9
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
10
|
+
# This helper is used for generating the file upload component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/file-upload GDS - Components - File Upload}
|
12
|
+
|
13
|
+
module FileUpload
|
14
|
+
# Generates the HTML for the GOV.UK File Upload component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::Input::FileUpload#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::Input::FileUpload#initialize)
|
19
|
+
#
|
20
|
+
# @return (see CCS::Components::GovUK::Input::FileUpload#render)
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def govuk_file_upload(attribute, **options)
|
23
|
+
Components::GovUK::Field::Input::FileUpload.new(context: self, attribute: attribute, **options).render
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -3,23 +3,25 @@
|
|
3
3
|
require_relative '../../components/govuk/footer'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the footer component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/footer GDS - Components - Footer}
|
11
|
-
|
12
|
-
module Footer
|
13
|
-
# Generates the HTML for the GOV.UK Footer component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::Footer#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Footer
|
16
9
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
10
|
+
# This helper is used for generating the footer component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/footer GDS - Components - Footer}
|
12
|
+
|
13
|
+
module Footer
|
14
|
+
# Generates the HTML for the GOV.UK Footer component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::Footer#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::Footer#initialize)
|
19
|
+
#
|
20
|
+
# @return (see CCS::Components::GovUK::Footer#render)
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def govuk_footer(**options)
|
23
|
+
Components::GovUK::Footer.new(context: self, **options).render
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -3,34 +3,36 @@
|
|
3
3
|
require_relative '../../components/govuk/form_group'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the form group component from the Government Design Systems
|
10
|
-
|
11
|
-
module FormGroup
|
12
|
-
# Generates the HTML for the GOV.UK Warning text component
|
13
|
-
#
|
14
|
-
# @param (see CCS::Components::GovUK::FormGroup#initialize)
|
15
|
-
#
|
16
|
-
# @option options [String] :classes additional CSS classes for the form group HTML
|
17
|
-
# @option options [ActiveModel] :model (nil) model that will be used to find an error message
|
18
|
-
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK FormGroup
|
19
9
|
#
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
10
|
+
# This helper is used for generating the form group component from the Government Design Systems
|
11
|
+
|
12
|
+
module FormGroup
|
13
|
+
# Generates the HTML for the GOV.UK Warning text component
|
14
|
+
#
|
15
|
+
# @param (see CCS::Components::GovUK::FormGroup#initialize)
|
16
|
+
#
|
17
|
+
# @option options [String] :classes additional CSS classes for the form group HTML
|
18
|
+
# @option options [ActiveModel] :model (nil) model that will be used to find an error message
|
19
|
+
# @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
|
20
|
+
#
|
21
|
+
# @yield (see CCS::Components::GovUK::FormGroup#render)
|
22
|
+
#
|
23
|
+
# @yieldparam (see CCS::Components::GovUK::FormGroup#render)
|
24
|
+
#
|
25
|
+
# @return (see CCS::Components::GovUK::FormGroup#render)
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
def govuk_form_group(attribute, **options, &block)
|
28
|
+
error_message = if options[:model]
|
29
|
+
model.errors[attribute].first
|
30
|
+
else
|
31
|
+
options[:error_message]
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
+
Components::GovUK::FormGroup.new(context: self, attribute: attribute, error_message: error_message, **options).render(&block)
|
35
|
+
end
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
@@ -3,23 +3,25 @@
|
|
3
3
|
require_relative '../../components/govuk/header'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the header component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/header GDS - Components - Header}
|
11
|
-
|
12
|
-
module Header
|
13
|
-
# Generates the HTML for the GOV.UK Header component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::Header#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Header
|
16
9
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
10
|
+
# This helper is used for generating the header component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/header GDS - Components - Header}
|
12
|
+
|
13
|
+
module Header
|
14
|
+
# Generates the HTML for the GOV.UK Header component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::Header#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::Header#initialize)
|
19
|
+
#
|
20
|
+
# @return (see CCS::Components::GovUK::Header#render)
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def govuk_header(**options)
|
23
|
+
Components::GovUK::Header.new(context: self, **options).render
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -3,24 +3,26 @@
|
|
3
3
|
require_relative '../../components/govuk/hint'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the hint text component from the Government Design Systems
|
10
|
-
|
11
|
-
module Hint
|
12
|
-
# Generates the HTML for the GOV.UK Hint component
|
13
|
-
#
|
14
|
-
# @param (see CCS::Components::GovUK::Hint#initialize)
|
15
|
-
#
|
16
|
-
# @option (see CCS::Components::GovUK::Hint#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Hint
|
17
9
|
#
|
18
|
-
#
|
19
|
-
|
20
|
-
|
10
|
+
# This helper is used for generating the hint text component from the Government Design Systems
|
11
|
+
|
12
|
+
module Hint
|
13
|
+
# Generates the HTML for the GOV.UK Hint component
|
14
|
+
#
|
15
|
+
# @param (see CCS::Components::GovUK::Hint#initialize)
|
16
|
+
#
|
17
|
+
# @option (see CCS::Components::GovUK::Hint#initialize)
|
18
|
+
#
|
19
|
+
# @yield (see CCS::Components::GovUK::Hint#render)
|
20
|
+
#
|
21
|
+
# @return (see CCS::Components::GovUK::Hint#render)
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
def govuk_hint(text = nil, **options, &block)
|
24
|
+
Components::GovUK::Hint.new(context: self, text: text, **options).render(&block)
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -3,23 +3,25 @@
|
|
3
3
|
require_relative '../../components/govuk/field/input/text_input'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the input component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/text-input GDS - Components - Text Input}
|
11
|
-
|
12
|
-
module Input
|
13
|
-
# Generates the HTML for the GOV.UK Text Input component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::Input::TextInput#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Input
|
16
9
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
10
|
+
# This helper is used for generating the input component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/text-input GDS - Components - Text Input}
|
12
|
+
|
13
|
+
module Input
|
14
|
+
# Generates the HTML for the GOV.UK Text Input component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::Input::TextInput#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::Input::TextInput#initialize)
|
19
|
+
#
|
20
|
+
# @return (see CCS::Components::GovUK::Input::TextInput#render)
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def govuk_input(attribute, **options)
|
23
|
+
Components::GovUK::Field::Input::TextInput.new(context: self, attribute: attribute, **options).render
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -3,25 +3,27 @@
|
|
3
3
|
require_relative '../../components/govuk/inset_text'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the inset text component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/inset-text GDS - Components - Inset text}
|
11
|
-
|
12
|
-
module InsetText
|
13
|
-
# Generates the HTML for the GOV.UK Inset text component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::InsetText#initialize)
|
16
|
-
#
|
17
|
-
# @option (see CCS::Components::GovUK::InsetText#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Inset Text
|
18
9
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
10
|
+
# This helper is used for generating the inset text component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/inset-text GDS - Components - Inset text}
|
12
|
+
|
13
|
+
module InsetText
|
14
|
+
# Generates the HTML for the GOV.UK Inset text component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::InsetText#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::InsetText#initialize)
|
19
|
+
#
|
20
|
+
# @yield (see CCS::Components::GovUK::InsetText#render)
|
21
|
+
#
|
22
|
+
# @return (see CCS::Components::GovUK::InsetText#render)
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
def govuk_inset_text(text = nil, **options, &block)
|
25
|
+
Components::GovUK::InsetText.new(context: self, text: text, **options).render(&block)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
@@ -3,24 +3,26 @@
|
|
3
3
|
require_relative '../../components/govuk/label'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the label component from the Government Design Systems
|
10
|
-
|
11
|
-
module Label
|
12
|
-
# Generates the HTML for the GOV.UK label component
|
13
|
-
#
|
14
|
-
# @param (see CCS::Components::GovUK::Label#initialize)
|
15
|
-
#
|
16
|
-
# @option (see CCS::Components::GovUK::Label#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK label
|
17
9
|
#
|
18
|
-
#
|
19
|
-
|
20
|
-
|
10
|
+
# This helper is used for generating the label component from the Government Design Systems
|
11
|
+
|
12
|
+
module Label
|
13
|
+
# Generates the HTML for the GOV.UK label component
|
14
|
+
#
|
15
|
+
# @param (see CCS::Components::GovUK::Label#initialize)
|
16
|
+
#
|
17
|
+
# @option (see CCS::Components::GovUK::Label#initialize)
|
18
|
+
#
|
19
|
+
# @yield (see CCS::Components::GovUK::Label#render)
|
20
|
+
#
|
21
|
+
# @return (see CCS::Components::GovUK::Label#render)
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
def govuk_label(attribute, text = nil, **options, &block)
|
24
|
+
Components::GovUK::Label.new(context: self, attribute: attribute, text: text, **options).render(&block)
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
end
|
@@ -3,25 +3,27 @@
|
|
3
3
|
require_relative '../../components/govuk/notification_banner'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the notification banner component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/notification-banner GDS - Components - Notification banner}
|
11
|
-
|
12
|
-
module NotificationBanner
|
13
|
-
# Generates the HTML for the GOV.UK Notification banner component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::NotificationBanner#initialize)
|
16
|
-
#
|
17
|
-
# @option (see CCS::Components::GovUK::NotificationBanner#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Notification Banner
|
18
9
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
10
|
+
# This helper is used for generating the notification banner component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/notification-banner GDS - Components - Notification banner}
|
12
|
+
|
13
|
+
module NotificationBanner
|
14
|
+
# Generates the HTML for the GOV.UK Notification banner component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::NotificationBanner#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::NotificationBanner#initialize)
|
19
|
+
#
|
20
|
+
# @yield (see CCS::Components::GovUK::NotificationBanner#render)
|
21
|
+
#
|
22
|
+
# @return (see CCS::Components::GovUK::NotificationBanner#render)
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
def govuk_notification_banner(text = nil, success_banner = nil, **options, &block)
|
25
|
+
Components::GovUK::NotificationBanner.new(context: self, text: text, success_banner: success_banner, **options).render(&block)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
@@ -3,23 +3,25 @@
|
|
3
3
|
require_relative '../../components/govuk/pagination'
|
4
4
|
|
5
5
|
module CCS
|
6
|
-
module FrontendHelpers
|
7
|
-
|
8
|
-
|
9
|
-
# This helper is used for generating the pagination component from the
|
10
|
-
# {https://design-system.service.gov.uk/components/pagination GDS - Components - Pagination}
|
11
|
-
|
12
|
-
module Pagination
|
13
|
-
# Generates the HTML for the GOV.UK Pagination component
|
14
|
-
#
|
15
|
-
# @param (see CCS::Components::GovUK::Pagination#initialize)
|
6
|
+
module FrontendHelpers
|
7
|
+
module GovUKFrontend
|
8
|
+
# = GOV.UK Pagination
|
16
9
|
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
10
|
+
# This helper is used for generating the pagination component from the
|
11
|
+
# {https://design-system.service.gov.uk/components/pagination GDS - Components - Pagination}
|
12
|
+
|
13
|
+
module Pagination
|
14
|
+
# Generates the HTML for the GOV.UK Pagination component
|
15
|
+
#
|
16
|
+
# @param (see CCS::Components::GovUK::Pagination#initialize)
|
17
|
+
#
|
18
|
+
# @option (see CCS::Components::GovUK::Pagination#initialize)
|
19
|
+
#
|
20
|
+
# @return (see CCS::Components::GovUK::Pagination#render)
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def govuk_pagination(**options)
|
23
|
+
Components::GovUK::Pagination.new(context: self, **options).render
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|