Skip to content

Commit

Permalink
Add example of summary list with missing info
Browse files Browse the repository at this point in the history
This shows how to code the pattern for [showing missing information within the summary list](https://design-system.service.gov.uk/components/summary-list/#showing-missing-information).
  • Loading branch information
frankieroberto authored and peteryates committed Aug 29, 2023
1 parent cc04d76 commit c0bf3ae
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions guide/content/components/summary-list.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions guide/lib/examples/summary_list_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c0bf3ae

Please sign in to comment.