Skip to content

Releases: x-govuk/govuk-form-builder

Version 2.7.0

22 Jun 16:50
33f9f5b
Compare
Choose a tag to compare
  • Change #govuk_submit so it renders a <button> element instead of an <input type="submit">. This is in response to #295 which highlights a longstanding bug with the design system where the top few pixels of the input element don't respond properly to clicks. The <button> element should be functionally the same and any tests written using Capybara's click_button style helpers should work, but it's probably going to break a few tests where assertions are made on the value attribute, now they need to compare against the element's contents.

    Additionally, as <button> elements support any HTML inside them, we support passing a proc:

     = govuk_submit(-> { tag.strong("Click me!" })
    

    Thanks to @frankieroberto for reporting this #296

  • Switch any remaining specs that use nested #have_tag over to #with_tag syntax #294

Version 2.6.0

14 Jun 09:54
77b4c91
Compare
Choose a tag to compare
  • Make the publish workflow target the oldest supported version of Rails #289
  • Add some enhancements to the error summary:
    • Allow the error summary to accept blocks of arbitrary HTML. These are placed between the title and the error messages list and can be used to provide some additional context #291
    • Allow the order that errors are displayed in to be customised. The custom order can be provided via the order: argument or a default method can be assigned on models that the builder will look for (allowing the ordering to be set in one place and applied to all forms associated with the object). #290
  • Add a helpers module that can be included with include GOVUKDesignSystemFormBuilder::BuilderHelper. It currently has two methods that expose some form builder functionality to 'the outside'. Theres a sample PR here that shows how to get started. #268
    • govuk_field_id - so you can override the id on custom form elements in a way that the builder's error summary can link to them
    • govuk_error_summary - allows the error summary to be rendered outside of the form

Version 2.5.3

03 Jun 19:48
4cb90c4
Compare
Choose a tag to compare
  • Fix a rendering bug introduced in 2.5.2 (#284). It appears to only happen when used from ERB and not in plain Ruby, so wasn't caught by the specs or seen in the guide. #288

Version 2.5.2

02 Jun 08:05
aae5281
Compare
Choose a tag to compare
  • Stop rendering conditional blocks when there's no block content. Thanks to @jsugarman and @jrmhaig for reporting and helping with this 🙌🏽 #283
  • Remove some duplication between FieldsetCheckBox and FieldsetRadioButton and their associated specs #284
  • Support GOV.UK Frontend version 3.12.0 #280

Version 2.5.1

13 May 19:42
7986c7f
Compare
Choose a tag to compare
  • Fix a bug caused by our use of deeper merge. When deeply-merging attributes, all attributes were treated equally and duplicate values removed (to prevent doubling up classes). This had the unwanted side-effect of removing words that occur more than once within the attribute; on textual attributes (like value, title, etc) repeated words were removed. The fix implements a fix by providing a list of attributes that are skipped when merging. Thanks to @cpjmcquillan for diagnosing and fixing this. #279
  • Add a security policy and integrate SemGrep #275, #277

Version 2.5.0

13 Apr 14:51
414c25e
Compare
Choose a tag to compare
  • Add new #govuk_select helper. It is to #select what #govuk_collection_select is to #collection_select. Allows more flexibility with option and optgroup elements, including the ability to add custom attributes. More info in the guide. Thanks to @AbigailMcP for suggesting this. #260
  • Improve HTML attribute merging, now deeply nested attributes that are space separated lists are properly-merged #256
  • Make the format date values can be set in more lenient. Release 2.4.0 introduced a change that made unexpected date formats cause a crash, now a warning will be logged but it will no longer crash #261
  • Bump Ruby and Rails to latest versions #262
  • Add a missing width from the text field guide entry, thanks @david-mears-dfe for this #263
  • Allow the gem's warnings to be suppressed library-wide #264

Version 2.4.0

01 Apr 09:01
68d4ee5
Compare
Choose a tag to compare
  • Allow date inputs to retrieve values from a multiparam attribute hash as well as date objects #255

Version 2.3.0

30 Mar 15:46
fd74b18
Compare
Choose a tag to compare
  • allow custom HTML attributes to be set across more form helpers. Thanks to @callumacrae for getting the ball rolling on this one #251
  • various code cleanup and refactoring #248
  • various guide updates #253, #254

Upgrade notes

The approach for setting custom HTML attributes has been standardised and now they are set via keyword arguments. Previously, the #govuk_collection_select helper allowed a html_options keyword argument (Rails-style), but this behaviour is no longer supported and will log a deprecation warning.

To upgrade, remove the html_options kwarg and move the custom attributes to the method call:

- = govuk_collection_select :favourite_colour, @colours, :id, :name, html_options: { autofocus: false }
+ = govuk_collection_select :favourite_colour, @colours, :id, :name, autofocus: false

Version 2.2.0

09 Mar 12:23
f2cb41f
Compare
Choose a tag to compare
  • Support Ruby 3.0.0 #232
  • Drop support for Rails 5.2.4 - Rails 3.0.0 doesn't support Rails 5.2.4 so the build matrix fails. It's very likely that the form builder will continue to work with Rails 5.2.x for the foreseeable future but it will no longer be automatically tested or officially supported #232
  • Allow the submit button's formnovalidate value to be configured #242
  • Various spec and guidance updates, thanks @david-mears-dfe for adding a new example to the radio buttons page #244, #245, #247
  • Upgrade to GOV.UK Rubocop 4.0.0.pre.1 #246

Version 2.1.9

17 Feb 10:57
571426e
Compare
Choose a tag to compare
  • This release brings some improvements to the collection form helpers:
    • Add include_blank support to #govuk_collection_check_boxes. This brings the checkboxes variant of the collection helper in line with the radio buttons one. Thanks to @njseeto for reporting #238
    • Bring the default include_blank arguments in line with Rails' defaults by setting them to true by default. Previously the value was false in #govuk_collection_radio_buttons 91db189
    • Add a configuration options so the default values for include_blank can be set for the check box and radio button helpers individually. To change the behaviour to how it was prior to 2.1.9 use this configuration:
GOVUKDesignSystemFormBuilder.configure do |conf|
  conf.default_collection_check_boxes_include_hidden = true
  conf.default_collection_radio_buttons_include_hidden = false
end