Add legacy and new status tags to the pattern library

pull/8581/head
Steve Steinwand 2022-06-09 14:07:45 -06:00 zatwierdzone przez LB (Ben Johnston)
rodzic 172b133568
commit daa47baddd
7 zmienionych plików z 97 dodań i 1 usunięć

Wyświetl plik

@ -50,6 +50,7 @@ Changelog
* Deprecate the usage and documentation of the `wagtail.contrib.modeladmin.menus.SubMenu` class, provide a warning if used directing developers to use `wagtail.admin.menu.Menu` instead (Matt Westcott)
* Remove legacy (non-next) breadcrumbs no longer used, remove `ModelAdmin` usage of breadcrumbs completely (Paarth Agarwal)
* Replace human-readable-date hover pattern with accessible tooltip variant across all of admin (Bernd de Ridder)
* Add legacy and new status tags to the pattern library (Steven Steinwand)
* Fix: Typo in `ResumeWorkflowActionFormatter` message (Stefan Hammer)
* Fix: Throw a meaningful error when saving an image to an unrecognised image format (Christian Franke)
* Fix: Remove extra padding for headers with breadcrumbs on mobile viewport (Steven Steinwand)

Wyświetl plik

@ -57,6 +57,7 @@ When using a queryset to render a list of images, you can now use the `prefetch_
* Deprecate the usage and documentation of the `wagtail.contrib.modeladmin.menus.SubMenu` class, provide a warning if used directing developers to use `wagtail.admin.menu.Menu` instead (Matt Westcott)
* Remove legacy (non-next) breadcrumbs no longer used, remove `ModelAdmin` usage of breadcrumbs completely (Paarth Agarwal)
* Replace human-readable-date hover pattern with accessible tooltip variant across all of admin (Bernd de Ridder)
* Add legacy and new status tags to the pattern library (Steven Steinwand)
### Bug fixes

Wyświetl plik

@ -1,4 +1,9 @@
{% load i18n %}
{% comment "text/markdown" %}
Variables this template accepts:
`page` - A wagtail page object
{% endcomment %}
{% if page.live %}
{% with page_url=page.url %}
{% if page_url is not None %}

Wyświetl plik

@ -0,0 +1,34 @@
import React from 'react';
import { Pattern, generateDocs } from 'storybook-django/src/react';
import template from './page_status_tag.html';
const { docs, argTypes } = generateDocs(template);
export default {
parameters: { docs },
argTypes: {
...argTypes,
url: {
options: [null, 'https://wagtail.io'],
},
},
};
const Template = (args) => (
<Pattern filename={__filename} context={{ page: args }} />
);
export const Live = Template.bind({});
Live.args = {
live: true,
status_string: 'live',
url: null,
};
export const Draft = Template.bind({});
Draft.args = {
live: false,
status_string: 'draft',
};

Wyświetl plik

@ -4,7 +4,6 @@
Variables accepted by this template:
- `page` - A wagtail page object
- `classes` - String of extra css classes to pass to this component
{% endcomment %}
{% if page.live and page.url is not None %}

Wyświetl plik

@ -0,0 +1,51 @@
import React from 'react';
import { Pattern, generateDocs } from 'storybook-django/src/react';
import template from './page_status_tag_new.html';
const { docs, argTypes } = generateDocs(template);
export default {
parameters: { docs },
argTypes: { ...argTypes },
};
const PublicTemplate = (args) => (
<Pattern
filename={__filename}
tags={{
test_page_is_public: {
'page as is_public': {
raw: false,
},
},
}}
context={{ page: args }}
/>
);
export const Public = PublicTemplate.bind({});
Public.args = {
live: true,
url: '#',
};
const PrivateTemplate = (args) => (
<Pattern
filename={__filename}
tags={{
test_page_is_public: {
'page as is_public': {
raw: true,
},
},
}}
context={{ page: args }}
/>
);
export const Private = PrivateTemplate.bind({});
Private.args = {
live: true,
url: '#',
};

Wyświetl plik

@ -0,0 +1,5 @@
from pattern_library.monkey_utils import override_tag
from wagtail.admin.templatetags.wagtailadmin_tags import register
override_tag(register, name="test_page_is_public")