Skip to content

Commit

Permalink
Revert "Set up pattern library (#10808)" (#10898)
Browse files Browse the repository at this point in the history
This reverts commit 986cd63.
  • Loading branch information
mmmavis authored Jul 20, 2023
1 parent 986cd63 commit 0ac71c6
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 260 deletions.
1 change: 0 additions & 1 deletion dev-requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
-c requirements.txt
django-pattern-library
black
coveralls
django-debug-toolbar
Expand Down
11 changes: 1 addition & 10 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,8 @@ django==3.2.20
# via
# -c requirements.txt
# django-debug-toolbar
# django-pattern-library
django-debug-toolbar==4.1.0
# via -r dev-requirements.in
django-pattern-library==1.0.0
# via -r dev-requirements.in
djhtml==1.5.2
# via -r dev-requirements.in
djlint==1.19.16
Expand Down Expand Up @@ -78,8 +75,6 @@ idna==3.3
# -c requirements.txt
# requests
# urllib3
importlib-metadata==6.7.0
# via markdown
iniconfig==2.0.0
# via pytest
isort==5.12.0
Expand Down Expand Up @@ -144,9 +139,7 @@ pytz==2021.3
# -c requirements.txt
# django
pyyaml==6.0
# via
# django-pattern-library
# djlint
# via djlint
regex==2022.10.31
# via djlint
requests==2.31.0
Expand Down Expand Up @@ -198,5 +191,3 @@ urllib3-secure-extra==0.1.0
# via
# -c requirements.txt
# urllib3
zipp==3.15.0
# via importlib-metadata
Empty file.

This file was deleted.

This file was deleted.

41 changes: 0 additions & 41 deletions network-api/networkapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
XSS_PROTECTION=bool,
SCOUT_KEY=(str, ""),
WAGTAILADMIN_BASE_URL=(str, ""),
PATTERN_LIBRARY_ENABLED=(bool, False),
)

# Read in the environment
Expand Down Expand Up @@ -186,10 +185,6 @@
# Detect if Django is running normally, or in test mode through "manage.py test"
TESTING = "test" in sys.argv or "pytest" in sys.argv

# Django Pattern Library
# Do not enable for production!
PATTERN_LIBRARY_ENABLED = env("PATTERN_LIBRARY_ENABLED")

INSTALLED_APPS = list(
filter(
None,
Expand Down Expand Up @@ -262,8 +257,6 @@
"networkapi.wagtailpages",
"networkapi.mozfest",
"networkapi.donate",
"pattern_library" if PATTERN_LIBRARY_ENABLED else None,
"networkapi.project_styleguide",
],
)
)
Expand Down Expand Up @@ -367,7 +360,6 @@
"settings_value": "networkapi.utility.templatetags.settings_value",
"wagtailcustom_tags": "networkapi.wagtailcustomization.templatetags.wagtailcustom_tags",
},
"builtins": ["pattern_library.loader_tags"],
},
},
]
Expand Down Expand Up @@ -730,36 +722,3 @@
"127.0.0.1",
"10.0.2.2",
]

# Django Pattern Library
# https://torchbox.github.io/django-pattern-library/
#
# Pattern library isn’t intended for production usage, and hasn’t received
# extensive security scrutiny. Don't enable it on production.
#
# PATTERN_LIBRARY_ENABLED is set to True in docker-compose.yml for local development.
# For pattern library to work with CSP, you also need to add the following to your .env file:
# PATTERN_LIBRARY_ENABLED=1
# X_FRAME_OPTIONS=SAMEORIGIN
# CSP_FRAME_ANCESTORS="'self'"
PATTERN_LIBRARY_ENABLED = env("PATTERN_LIBRARY_ENABLED", default=False)
PATTERN_LIBRARY = {
# Groups of templates for the pattern library navigation. The keys
# are the group titles and the values are lists of template name prefixes that will
# be searched to populate the groups.
"SECTIONS": (
# Add additional sections here. This will appear as the left-hand nav in /pattern-library/
# e.g. ("Component name", ["path_to/component_name"]),
("Pages", ["pages"]),
("Fragments", ["fragments"]),
("Wagtailpages", ["wagtailpages"]),
),
# Configure which files to detect as templates.
"TEMPLATE_SUFFIX": ".html",
# Set which template components should be rendered inside of,
# so they may use page-level component dependencies like CSS.
"PATTERN_BASE_TEMPLATE_NAME": "pattern_library_base.html",
# Any template in BASE_TEMPLATE_NAMES or any template that extends a template in
# BASE_TEMPLATE_NAMES is a "page" and will be rendered as-is without being wrapped.
"BASE_TEMPLATE_NAMES": ["pages/base.html"],
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{% load static i18n wagtailimages_tags homepage_tags %}
{# Pattern library has problems with this tag, so we exclude it from pattern library rendering. #}
{% if not is_pattern_library %}
{% get_page_authors page as authors %}
{% endif %}
{% get_page_authors page as authors %}



Expand Down
36 changes: 0 additions & 36 deletions network-api/networkapi/templates/fragments/custom_hero_guts.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{% load i18n homepage_tags %}

{# Pattern library has problems with this tag, so we exclude it from pattern library rendering. #}
{% if not is_pattern_library %}
{% get_page_authors page as authors %}
{% endif %}
{% get_page_authors page as authors %}

<div
class="publication-hero-container tw-relative tw-bg-gradient-to-b tw-from-gray-60 tw-to-gray-80 {% if size == "small" %} small tw-pt-56 tw-pb-72 {% else %} tw-pt-72 tw-pb-96 {% endif %}"
Expand Down
36 changes: 0 additions & 36 deletions network-api/networkapi/templates/fragments/publication_hero.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@
xlarge: "1200px",
"2xl": "1400px",
{% endcomment %}
{% if not is_pattern_library %}
{% image image_object width-576 as img_576 %}
{% image image_object width-1152 as img_576_2x %}
{% image image_object width-768 as img_768 %}
{% image image_object width-1536 as img_768_2x %}
{% image image_object width-992 as img_992 %}
{% image image_object width-1984 as img_992_2x %}
{% image image_object width-1200 as img_1200 %}
{% image image_object width-2400 as img_1200_2x %}
{% image image_object width-1400 as img_1400 %}
{% image image_object width-2800 as img_1400_2x %}
{% image image_object original as img_original %}
{% endif %}
{% image image_object width-576 as img_576 %}
{% image image_object width-1152 as img_576_2x %}
{% image image_object width-768 as img_768 %}
{% image image_object width-1536 as img_768_2x %}
{% image image_object width-992 as img_992 %}
{% image image_object width-1984 as img_992_2x %}
{% image image_object width-1200 as img_1200 %}
{% image image_object width-2400 as img_1200_2x %}
{% image image_object width-1400 as img_1400 %}
{% image image_object width-2800 as img_1400_2x %}
{% image image_object original as img_original %}
<source
media="(max-width: 576px)"
srcset="{{ img_576.url }}, {{ img_576_2x.url }} 2x"
Expand Down

This file was deleted.

13 changes: 0 additions & 13 deletions network-api/networkapi/templates/pages/article_page.yaml

This file was deleted.

47 changes: 0 additions & 47 deletions network-api/networkapi/templates/pattern_library_base.html

This file was deleted.

7 changes: 0 additions & 7 deletions network-api/networkapi/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.apps import apps
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
Expand Down Expand Up @@ -156,12 +155,6 @@ def csrf_response(request):
if settings.DEBUG_TOOLBAR_ENABLED:
urlpatterns += (path("__debug__/", include("debug_toolbar.urls")),)

# Styleguide
if settings.PATTERN_LIBRARY_ENABLED and apps.is_installed("pattern_library"):
urlpatterns += [
path("pattern-library/", include("pattern_library.urls")),
]

urlpatterns += [path("sitemap.xml", sitemap_index)]

# Use a custom 404 handler so that we can serve distinct 404
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ ignore="H017"
"network-api/networkapi/templates/partials/banner.html" = "H006,H025,T003"
"network-api/networkapi/templates/partials/footer.html" = "H006,H008,T002,T003"
"network-api/networkapi/templates/partials/primary_nav.html" = "D018,H014,H025,T002,T003"
"network-api/networkapi/templates/pattern_library_base.html" = "H030,H031,T003"
"network-api/networkapi/templates/reviewapp-help.html" = "D018,T003"
"network-api/networkapi/wagtailcustomization/templates/wagtailadmin/404.html" = "D018,H014,T003"
"network-api/networkapi/wagtailcustomization/templates/wagtailadmin/account/account.html" = "T003"
Expand Down

0 comments on commit 0ac71c6

Please sign in to comment.