Version 4.0.0
-
Upgrade to ViewComponent 3.0.0
-
Upgrade to govuk-frontend 4.6.0
-
Improve the table component
-
Add support for table header scopes #382
Table header scopes are used to identify cells that are covered by a header cell.
They can be manually added using thescope
parameter but will default tocol
for
table headings in the<thead>
and torow
for table headings in the<tbody>
. -
Add support for table footers #387
Table footers allow us to summarise a table's contents. Often they are used to
show numeric totals. -
Add support for
<colgroup>
and<col>
elements #393Column groups define groups of columns within a table. They are useful when single
categories of data need to span multiple columns
There are examples on the new functionality on the table page of the guide
-
-
Move the space between the visible and visually hidden text in summary list actions inside the visually hidden span. #408
The markup will change in the following manner:
<a class="govuk-link" href="#"> - Change <span class="govuk-visually-hidden">age</span> + Change<span class="govuk-visually-hidden"> age</span> </a>
-
Add Summary Cards #351
Summary cards provide visual separation when displaying more than one summary list
on a page. They can also contain links to actions that affect the card as a whole.There are examples on the new functionality on the summary list page of the guide
-
Make Summary Group
action
argument override the default #413Previously the action column would be shown if there are actions present regardless of what's set in the
actions
argument. This meant that it was impossible to suppress the actions column. Now it works in a more sensible fashion and the overridden value is used when set. Thank you @vassyz for contributing this one. -
Upgrade to the latest versions of Ruby and Rails.
- The supported Ruby versions are: 3.0.5, 3.1.3 and 3.2.1
- The supported Rails versions are: 7.0.4 and 6.1.7
Upgrade guide
New view component slot syntax
The latest version of ViewComponent changed the syntax for calling slot setter methods.
In versions prior to version 3.0.0, you could call a slot by its name. So for a PostComponent
that
renders_many :comments
, we could add comments by calling comment
:
<%= render(PostComment.new(**post_args)) do |post| %>
<% post.comment(**comment_1_args) %>
<% post.comment(**comment_2_args) %>
<% post.comment(**comment_3_args) %>
<% end %>
Since version 3.0.0 we need to prefix the slot call with with_
, so in the above example we'd need to
do this:
<%= render(PostComment.new(**post_args)) do |post| %>
<% post.with_comment(**comment_1_args) %>
<% post.with_comment(**comment_2_args) %>
<% post.with_comment(**comment_3_args) %>
<% end %>
Automatic table scopes
Table header cells will automatically have a scope attribute, col
for cells in the <thead>
and row
for cells in the <tbody>
. The new behaviour can be disabled using the config.enable_auto_table_scopes
setting.