diff --git a/guide/content/components/summary-list.slim b/guide/content/components/summary-list.slim index f8f59e0a..4f940e51 100644 --- a/guide/content/components/summary-list.slim +++ b/guide/content/components/summary-list.slim @@ -38,6 +38,13 @@ p using `actions: false`. Doing this makes the values column wider consuming the remaining space. +== render('/partials/example.*', + caption: "Summary lists with missing information", + code: summary_list_with_missing_information) do + + markdown: + If a row has missing information, include a link to add the information within the value column instead of as an action. + == render('/partials/example.*', caption: "Building a summary list directly from data", code: summary_list_from_rows, diff --git a/guide/lib/examples/summary_list_helpers.rb b/guide/lib/examples/summary_list_helpers.rb index 3e3b0392..b1841521 100644 --- a/guide/lib/examples/summary_list_helpers.rb +++ b/guide/lib/examples/summary_list_helpers.rb @@ -43,6 +43,25 @@ def summary_list_without_actions SUMMARY_LIST_WITHOUT_ACTIONS end + def summary_list_with_missing_information + <<~SUMMARY_LIST_WITH_MISSING_INFORMATION + = govuk_summary_list do |summary_list| + - summary_list.with_row do |row| + - row.with_key { 'Name' } + - row.with_value { 'Sherlock Holmes' } + - row.with_action(text: "Change", href: '#', visually_hidden_text: 'name') + + - summary_list.with_row do |row| + - row.with_key(text: 'Address') + - row.with_value { govuk_link_to("Enter address", "#") } + + - summary_list.with_row do |row| + - row.with_key(text: 'Phone number') + - row.with_value(text: '020 123 1234') + - row.with_action(text: "Change", href: '#', visually_hidden_text: 'phone number') + SUMMARY_LIST_WITH_MISSING_INFORMATION + end + def summary_list_from_rows <<~SUMMARY_LIST_FROM_ROWS = govuk_summary_list(rows: rows)