Version 4.0.0
Closed this issue · 2 comments
Version 4.0.0
-
Upgrade to ViewComponent 3.0.0rc6
-
Upgrade to govuk-frontend 4.5.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 Card
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.
Final things to do
- complete the migration of to ViewComponent 3.0.0. Currently it's at
rc1rc2rc3rc4rc5rc6 but the release should be immanent - write some release notes and an upgrade guide
- bump to latest versions of ruby/rails #400
- upgrade to govuk-frontend 4.5.0
There are some things that didn't make the cut for v4. They may reappear later:
- Drop the
classes:
keyword. I wanted to get rid of it so we can treat all HTML attributes equally and consistently but so many people use classes it would be a chore to go through and change everything #398 - Add
new_tab:
param togovuk_link_to
. This would add the required attributes to make a tab open in a new window and added the '(opens in new tab)' text. It was pulled (#399) because adding via a keyword arg interferes with Rails' argument structure in a way that means other params (options
,html_options
) need to be wrapped in curly braces so Ruby treats them as a hash rather than a kwarg #363
I still want to introduce this functionality and plan on creating a separate module of link helpers that take a modern approach ofgovuk_link_to("link text", "link_href", new_tab: true, no_underline: true)
. This will probably land in 4.1 and be default but the old behaviour will be available via a config option.
Waiting on View Component 3.0.0 to be released before shipping v4 of GOV.UK Components. Looks like it's nearly there 🚀