Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
govuk_design_system_formbuilder
Advanced tools
This library provides an easy-to-use form builder for the GOV.UK Design System.
It is intended to make creating forms quick, easy and familiar for Ruby on Rails developers.
The gem comes with a full guide that covers most aspects of day-to-day use, along with code and output examples. The examples in the guide are generated from the builder itself so it will always be up to date.
You can install the form builder gem by running the gem install govuk_design_system_formbuilder
or by adding the following line to your Gemfile
:
gem 'govuk_design_system_formbuilder'
To make full use of this tool, you will need a Rails application with the latest GOV.UK Frontend assets installed and configured.
To get up and running quickly and easily try kickstarting your project with a pre-configured template:
To use the form builder in an ad hoc basis you can specify it as an argument to form_for
or form_with
. These examples are written in Slim but other templating languages like ERB and Haml work just as well.
= form_for @some_object, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f|
...
To set it globally, just add this line to your ApplicationController
:
class ApplicationController < ActionController::Base
default_form_builder GOVUKDesignSystemFormBuilder::FormBuilder
end
Now we can get started!
= form_for @person do |f|
= f.govuk_text_field :full_name, label: { text: "Your full name" }
= f.govuk_number_field :age, label: { text: "Age" }
= f.govuk_collection_select :department_id,
@departments,
:id,
:name,
:description,
label: { text: "Which department do you work for?" },
hint: { text: "If you don’t know ask your manager" }
= f.govuk_submit 'Away we go!'
The form builder is tested with RSpec. To run all the tests first ensure that the development and testing prerequisite gems are installed. At the root of a freshly-cloned repo run:
bundle
Now, if everything was successful, run RSpec:
bundle exec rspec
Bug reports and feature requests are most welcome, please raise an issue or submit a pull request.
Currently we’re using GOVUK Lint to ensure code meets the GOV.UK guidelines. Please ensure that any PRs also adhere to this standard.
To help keep the logs clean and tidy, please configure git to use your full name:
git config --global user.name "Julius Hibbert"
Approximately 100 services use this library, here are a few from the DfE, MoJ, and BEIS.
This project was inspired by Ministry of Justice’s GovukElementsFormBuilder, but is leaner, more modular and written in a more idiomatic style.
FAQs
Unknown package
We found that govuk_design_system_formbuilder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.