-
Notifications
You must be signed in to change notification settings - Fork 21
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
Don't render any conditional content when block is empty #283
Merged
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
Do not display a div if the content is blank
peteryates
force-pushed
the
empty-wrap-conditional-content
branch
from
May 28, 2021 08:52
bacea62
to
0476f09
Compare
jsugarman
reviewed
May 28, 2021
@@ -181,6 +181,20 @@ | |||
end | |||
end | |||
|
|||
context 'when an empty block is given' do | |||
subject { builder.send(*args) { "" } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
jsugarman
reviewed
May 28, 2021
lib/govuk_design_system_formbuilder/elements/radios/fieldset_radio_button.rb
Outdated
Show resolved
Hide resolved
When either no block or an empty block (i.e., one that fails Rails' #presence check) is provided in the block passed to a radio button or check box no conditioal content shouldn be rendered and the data-attribute that's used to toggle it should be omitted. This tweak moves the logic to earlier in the object's initialisation so that both the @conditional_content and @conditional_id will not be set when the block is blank. Fixes #281, 282
peteryates
force-pushed
the
empty-wrap-conditional-content
branch
from
May 28, 2021 09:10
0476f09
to
810ddbd
Compare
jsugarman
approved these changes
May 28, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Many thanks
Thanks, this looks great. I'll close #281 |
cpjmcquillan
approved these changes
May 28, 2021
peteryates
added a commit
that referenced
this pull request
May 29, 2021
These two classes act in a very-similar manner, much of the functionality is duplicate. As all fieldset items are conditional, we can safely remove the Traits::Conditional and just treat everything as a FieldsetItem. This is the same approach taken by the text fields and Traits::Input. Refs #283
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When either no block or an empty block (i.e., one that fails Rails'
#presence
check) is provided in the block passed to a radio button or check box no conditional content shouldn't be rendered and the data-attribute that's used to toggle it should be omitted.This tweak moves the logic to earlier in the object's initialisation so that both the
@conditional_content
and@conditional_id
will not be set when the block is blank.Closes #281, #282