Skip to content

Releases: x-govuk/govuk-form-builder

Version 2.7.4

10 Sep 13:39
799bbfe
Compare
Choose a tag to compare
  • Improve the behaviour of bold_labels in radio button collections. Since the beginning the behaviour has been to flip the default to bold labels when the :description is present, as it adds hints per option and they can blend into the labels. This approach didn't allow bold labels to be turned off when not wanted, so here we're changing the default from false to nil. When nil, the old behaviour continues but when set to either true or false the setting will take precedence. Thanks @fofr for identifying and raising this. #316
  • Upgrade to version 3.13.1 of the design system #314

Version 2.7.3

01 Sep 14:51
8e8101f
Compare
Choose a tag to compare
  • Allow error summary to take a presenter argument for further customisation of the error summary list. The default presenter implements the current behaviour (it displays the first error for each attribute) but gives developers full control over the output. There's a new section in the guide covering its use. Many thanks to @jsugarman for this #311
  • Refactor some of the label/legend content building, move from #compact#first to #find(&:presence) #308

Version 2.7.2

01 Jul 15:51
ce83bea
Compare
Choose a tag to compare
  • Fix a bug where the nesting of multiple checkbox and radio fieldsets could lead to blocks being rendered more than once. Many thanks to @jsugarman for identifying, diagnosing and fixing this one 🙌🏽 #301

Version 2.7.1

25 Jun 08:10
d580815
Compare
Choose a tag to compare
  • Support version 3.13.0 of the GOV.UK Design System #298:
    • Add a #govuk_check_box_divider helper that works in exactly the same way as the radio button divider. It can be used to add a separator, "or" by default, to a list of checkboxes within a #govuk_check_boxes_fieldset. Like the radio variant, the default text can be overridden via a config flag
    • Add a exclusive keyword argument to #govuk_check_box. Exclusive checkboxes will automatically uncheck their siblings when checked, and automatically become unchecked when any of their siblings become checked
    • Add a new section to the guide covering the above features
  • Make input element #builder_method private, it doesn't need to be exposed. This was applied to all Element::Input classes #297

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