-
Notifications
You must be signed in to change notification settings - Fork 237
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
Add example of passing data in Nunjucks macros #563
Conversation
a5b8f23
to
24f3d18
Compare
24f3d18
to
4f28f5d
Compare
<p>Example using the 'checked' function in a radio component macro:</p> | ||
|
||
<pre class="app-code"><code>{% raw %} | ||
{{ govukRadios({ |
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.
Can we remove all the indent here? It adds unnecessary indent to the code example, because of the <pre>
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.
sure, updated
4f28f5d
to
f3c256f
Compare
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.
Thanks for doing this @igloosi.
I suggest we make it clearer what page this code refers to (left a comment to this end).
When I place the macro in vehicle-features.html
, it gets passed to "Check your answers" as an array of letters it looks like (see screen grab). I might be missing a step, would be good to document what's going wrong 🤔
Using the data in Nunjucks macros | ||
</h3> | ||
|
||
<p>Example using the 'checked' function in a radio component macro:</p> |
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.
Suggest adding something like:
"The HTML example of this page is available on Vehicle features."
This would help to signpost to the relevant page and call out the Nunjucks/HTML distinction.
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.
we already tell people how to use checked
in html on this page, so I don't think we need to do this too
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.
in a radio component macro
should be
in a checkbox macro
(do we need 'component'?)
this work doesn't update the example. |
Using a macro shouldn't break the behaviour here, something is odd |
yes, using radio macro in the features part instead of checkboxes. which i've updated now |
f3c256f
to
2db7e99
Compare
Using the data in Nunjucks macros | ||
</h3> | ||
|
||
<p>Example using the 'checked' function in a radio component macro:</p> |
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.
in a radio component macro
should be
in a checkbox macro
(do we need 'component'?)
2db7e99
to
bf5e545
Compare
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.
Thanks!
Passing of stored data to Nunjucks macros is something we've seen being asked about.
This just adds the example code to the guidance, not replace the actual working example.
Addresses: #554 and #564