-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 1.1.0 #76
Merged
Merged
Version 1.1.0 #76
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The with_localisations method allows us to temporarily set the locale backend and always cleans up after itself. Refs #68
This will pull the correct localisation string from the backend and display it unless it has been overridden by manually supplying text Refs #68
This can now be optionally set and will be used for the retrieval of localisations from the I18n backend Refs #68
Compacting the array and joining the remains can return a hash if it matches the structure of the backend. For example, "helpers.person.." will return the other translations for the object. Instead, return nil unless all parts are present Refs #68
CollectionItem will hold functionality that's specific to items belonging to a collection. Initially, this covers the retrieval of the value depending on what's passed into the :text_method, :value_method or :hint_method params. These arguments now accept and properly deal with procs Refs #68
Instead of using `#send` inline to retrieve the value from `@item`, make use of `#retrieve` which works with procs. Refs #68
The :value_method, :text_method and :hint_method params passed to radio collections and the :hint_method params passed to checkbox collections now accept procs which can be used to customise the value retrieved from the item. This could be used for simple transformations like upcasing the text or more-complex operations like localising the value, as per the provided specs Refs #68
Some builds are failing before the lint/tests are run (when installing and compiling gems). Try temporarily disabling the cache
Add gem config so defaults can be specified per project
Fieldset was a throwback to the MoJ GOV.UK Elements Form Builder, but now we refer to the fieldset's legend everywhere rather than the fieldset itself.
The configuration block now supports the following keys for customising how the builder's localisation functionality works: * localisation_schema_fallback * localisation_schema_legend * localisation_schema_hint * localisation_schema_label The localisation_schema_fallback setting is the only one set by default, and it will be used for legends, hints and labels if they are not individually configured by their key respectively. Configuration must be provided as an array; it will be suffixed by the object name and attribute name. The special value `__context__` will be substituted for the contexual object; either label, hint or legend. It can be placed anywhere in the schema. Refs #80
Add support for customising the localisation schema (provided in #68) as part of the application config. The configuration allows for the value localisation_schema_fallback to be set, which provides a default 'base' schema; and localisation_schema_label, localisation_schema_hint, and localisation_schema_legend to be set which configures labels, hints and legends respectively. One slightly-breaking change (from the initial version of localisation functionality) is that now we're referring to fieldset legends by legend rather than fieldset. This is more inkeeping with the language used everywhere else in the project and definitely feels cleaner.
This makes loading easier as we no longer need to prioritise within a single directory, plus traits seems like a more-logical place for the shared behaviour.
Traits are loaded first, then the core files, then elements and finally containers. Refs #78
…loading Improve the gem's setup by removing loads of duplication from the lib/govuk_design_system_formbuilder.rb
1.1.0 Beta 3 is out. This completes the work intended for version 1.1.0. I've tested this locally and Apply's test suite passes with the latest beta. If there are no reports of problems expect an iminenent release. cc @tvararu, @leeky, @dankmitchell - feedback welcome |
Apply Nanoc's rubypants filter throughout the guide. Rubypants, by default, doesn't affect pre or code tags so the samples won't be affected.
Instead only include it where it's required; label, hint and fieldset
…it-in-base Don't include localisation trait in base class
A change to the way Ruby will deal with regular and keyword arguments in Ruby 3[0] currently outputs warnings to the log. These are all due to the way we've used `#push` to apend the keyword args hash to the args array. This change replaces the push approach by just supplying the keyword args in the normal manner. To ensure this gem isn't outputting rogue log messages without having to deal with the noise from Rails' offending modules, use ag (or rg, grep etc) to filter them: be rspec 2>&1 | ag -v 'i18n|active_model|action_view|json' [0] https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
Bump Ruby and Rails versions and squash the warnings generated by Ruby 2.7.0's new keyword argument behaviour
The configuration docs preceded custom localisation so needed bringing in line with the new functionality. Not perfect, but a start.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documenation
Improving the technical documentation or guide
don't merge yet
In-progress functionality that's not quite ready to be merged
enhancement
New feature or request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the development branch for Version 1.1.0
The headline features are:
lib/govuk_design_system_formbuilder.rb
Improve file loading #78Track the overall progress here.