Skip to main content

NHS Frontend Styles for Wagtail

Project description

Wagtail NHS Style

A wagtail implementation of the NHS frontend v0.8.0 standard components.

Installation

Install the pypi package

pip install wagtail-nhs-style

Add to your INSTALLED_APPS in wagtail settings

INSTALLED_APPS = [
  ...

  'wagtailnhsstyle',

  ...
]

Use blocks in your streamfields

from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.core.models import Page
from wagtail.core.fields import StreamField

from wagtailnhsstyle.blocks import ActionLinkBlock, CalloutBlock

class HomePage(Page):
  body = StreamField([
      # Include any of the blocks you want to use.
      ('action_link', ActionLinkBlock()),
      ('callout', CalloutBlock()),
  ])

  content_panels = Page.content_panels + [
      StreamFieldPanel('body'),
  ]

Use templatetags

{% load nhsstyle_tags %}

<html>
...
<body>
  {% breadcrumbs %}
</body>
</html>

Use template includes

{% include 'wagtailnhsstyle/header.html' with show_search=True %}

See the component documentation for a list of components you can use.

Include the CSS in your base template

  <link rel="stylesheet" type="text/css" href="{% static 'wagtailnhsstyle/css/nhsuk-wagtail.min.css' %}">

Include the Javascript in your base template

  <script type="text/javascript" src="{% static 'wagtailnhsstyle/js/nhsuk-0.8.0.min.js' %}" defer></script>

Further reading

See more documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wagtail-nhs-style, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size wagtail_nhs_style-0.0.3-py3-none-any.whl (53.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size wagtail-nhs-style-0.0.3.tar.gz (46.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page