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 shared templates #70
Conversation
This commit does two main things: - Add Jinja templates for all the design patterns in the toolkit, which can be used by any application that requires them - Refactors the toolkit to generate the example markup from the Jinja templates and generate an example of the data passed to the template This owes some debt to the work that @edds and @davidsingleton did with GOV.UK components (http://govuk-component-guide.herokuapp.com/) This commit also does some renaming of the patterns to reflect exactly what they do. eg search-results (plural) is a template for rendering a list of search results, whereas page-heading (singular) is a template for rendering a single page heading. This commit only renames the examples and documentation, not the actual toolkit files.
Where possible, naming of templates should be consistent with: - examples - stylesheets - javascript files
- This pattern was created (but not merged) prior to this piece of work
1dc1096
to
b187a43
Compare
@@ -87,7 +94,41 @@ def render_page(self, input_file): | |||
partial['pageTitle'] + | |||
" - Digital Marketplace frontend toolkit" | |||
) | |||
if "examples" in partial: | |||
if ( |
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.
Could we remove the brackets from this and line 105 to match the style adopted for the rest of this file?
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.
Brackets gone as of 44d922e
Other than the comments above I've just got the following points: I think the The README should be updated to explain how the templates are part of the toolkit. Probably some updates to the Example markup section and maybe a new section near Sass compilation to explain where you need to work on HTML and where the template data is kept. |
- It's used for that attribute in the HTML - It appears as 'name' in the HTTP parameters too
Managed not to say, this is brilliant work. Looking forward to pulling it down into the apps. 👍 |
This is 👌 ✖️ 💯 |
This documentation…
…is now generated from this Jinja template
And the templates can be used in other apps, like so:
(uses Jinja's
with
extension)The aim of this pull request is to allow sharing of templates between our apps
It does this by:
This owes some debt to the work that @edds and @dsingleton did with GOV.UK components.
This commit also does some renaming of the patterns to reflect exactly what they do. eg
search-results
(plural) is a template for rendering a list of search results, whereaspage-heading
(singular) is a template for rendering a single page heading. This commit only renames the examples and documentation, not the actual toolkit files (so it won't be a breaking change at this stage).