NHS摇摆舞前端风格
wagtail-nhs-style的Python项目详细描述
摇摆尾巴NHS风格
标准组件的摇摇晃晃的实现。
安装
安装pypi包
pip install wagtail-nhs-style
添加到摇尾设置中的INSTALLED_APPS
中
INSTALLED_APPS=[...'wagtailnhsstyle',...]
在流域中使用块
fromwagtail.admin.edit_handlersimportFieldPanel,StreamFieldPanelfromwagtail.core.modelsimportPagefromwagtail.core.fieldsimportStreamFieldfromwagtailnhsstyle.blocksimportActionLinkBlock,CalloutBlockclassHomePage(Page):body=StreamField([# Include any of the blocks you want to use.('action_link',ActionLinkBlock()),('callout',CalloutBlock()),])content_panels=Page.content_panels+[StreamFieldPanel('body'),]
使用模板标记
{%loadnhsstyle_tags%}<html>...<body>{%breadcrumbs%}</body></html>
使用模板包括
{%include'wagtailnhsstyle/header.html'withshow_search=True%}
有关可以使用的组件列表,请参见component documentation。
在基本模板中包含css
<linkrel="stylesheet"type="text/css"href="{% static 'wagtailnhsstyle/css/nhsuk-wagtail.min.css' %}">
将javascript包含在基本模板中
<scripttype="text/javascript"src="{% static 'wagtailnhsstyle/js/nhsuk-0.8.0.min.js' %}"defer></script>
进一步阅读
查看更多documentation