-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Install django-pattern-librray * Enabled pattern-library, and tweaked template path so it works. Added monkey patch for some custom tags. Though individual templates still show errors in pattern library. This only affects pattern-library functionalities but not the normal website. * Added new base template for Pattern library * Added pattern library base template for rendering fragments. * Add some yaml for pattern library. Also tweaked settings to tidy up pattern library nav. * Linting * Updated inline code comment for Django Pattern Library. --------- Co-authored-by: Jhonatan Lopes <jhonatan.dapontelopes@gmail.com> Co-authored-by: Mavis Ou <mmmavis@users.noreply.github.com>
- Loading branch information
1 parent
6ab2780
commit 986cd63
Showing
17 changed files
with
260 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
-c requirements.txt | ||
django-pattern-library | ||
black | ||
coveralls | ||
django-debug-toolbar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
14 changes: 14 additions & 0 deletions
14
network-api/networkapi/project_styleguide/templatetags/localization.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from pattern_library.monkey_utils import override_tag | ||
|
||
from networkapi.wagtailpages.templatetags.localization import register | ||
|
||
# Override the localization tags with a fake implementation to return dummy URLs. | ||
# The fake implementation will only be used when viewing the pattern library. | ||
# See https://torchbox.github.io/django-pattern-library/guides/overriding-template-tags/ | ||
# | ||
# These tags are used in a large number of pages, and their output does | ||
# not affect appearance. Overriding them centrally here is a convenient way | ||
# to avoid having to override the tags in each individual YAML file. | ||
override_tag(register, name="get_unlocalized_url", default_html="/dummy") | ||
override_tag(register, name="relocalized_url", default_html="/en/dummy") | ||
override_tag(register, name="localizedroutablepageurl", default_html="/en/routed-dummy") |
8 changes: 8 additions & 0 deletions
8
network-api/networkapi/project_styleguide/templatetags/wagtailmetadatatags.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from pattern_library.monkey_utils import override_tag | ||
from wagtailmetadata.templatetags.wagtailmetadata_tags import register | ||
|
||
override_tag( | ||
register, | ||
name="meta_tags", | ||
default_html='<title>Example title</title><meta name="description" content="Example description">', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
network-api/networkapi/templates/fragments/custom_hero_guts.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
network-api/networkapi/templates/fragments/custom_hero_guts.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
context: | ||
page: | ||
title: Example page title | ||
subtitle: Example page subtitle | ||
secondary_subtitle: Example page secondary subtitle | ||
hero_image: | ||
raw: | ||
url: 'https://via.placeholder.com/1920x1080' | ||
alt: Example alt text | ||
authors: | ||
count: 2 | ||
all: | ||
- author: | ||
name: Cynthia Williams | ||
- author: | ||
name: Justin Sanders | ||
is_publication_article: true | ||
self: | ||
breadcrumb_list: | ||
- entry: | ||
localized: | ||
title: Example one | ||
url: '#' | ||
- entry: | ||
localized: | ||
title: Example two | ||
url: '#' | ||
download_file: | ||
url: '#' | ||
file_size: 104 | ||
authors: | ||
raw: | ||
- name: Cynthia Williams | ||
slug: cythiawilliams | ||
- name: Justin Sanders | ||
slug: justinsanders |
5 changes: 4 additions & 1 deletion
5
network-api/networkapi/templates/fragments/publication_hero.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
network-api/networkapi/templates/fragments/publication_hero.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
context: | ||
page: | ||
title: Example page title | ||
subtitle: Example page subtitle | ||
secondary_subtitle: Example page secondary subtitle | ||
hero_image: | ||
raw: | ||
url: 'https://via.placeholder.com/1920x1080' | ||
alt: Example alt text | ||
authors: | ||
count: 2 | ||
all: | ||
- author: | ||
name: Cynthia Williams | ||
- author: | ||
name: Justin Sanders | ||
is_publication_article: true | ||
self: | ||
breadcrumb_list: | ||
- entry: | ||
localized: | ||
title: Example one | ||
url: '#' | ||
- entry: | ||
localized: | ||
title: Example two | ||
url: '#' | ||
download_file: | ||
url: '#' | ||
file_size: 104 | ||
authors: | ||
raw: | ||
- name: Cynthia Williams | ||
slug: cythiawilliams | ||
- name: Justin Sanders | ||
slug: justinsanders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
network-api/networkapi/templates/fragments/responsive_screen_wide_image.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
context: | ||
img_576: | ||
url: 'https://via.placeholder.com/576x324' | ||
img_576_2x: | ||
url: 'https://via.placeholder.com/1152x648' | ||
img_768: | ||
url: 'https://via.placeholder.com/768x432' | ||
img_768_2x: | ||
url: 'https://via.placeholder.com/1536x864' | ||
img_992: | ||
url: 'https://via.placeholder.com/992x558' | ||
img_992_2x: | ||
url: 'https://via.placeholder.com/1984x1116' | ||
img_1200: | ||
url: 'https://via.placeholder.com/1200x675' | ||
img_1200_2x: | ||
url: 'https://via.placeholder.com/2400x1350' | ||
img_1400: | ||
url: 'https://via.placeholder.com/1400x788' | ||
img_1400_2x: | ||
url: 'https://via.placeholder.com/2800x1575' | ||
img_original: | ||
url: 'https://via.placeholder.com/1920x1080' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
context: | ||
page: | ||
hero_layout: static | ||
article_file: # | ||
is_publication_article: True | ||
authors: | ||
count: 2 | ||
all: | ||
- author: | ||
name: Cynthia Williams | ||
- author: | ||
name: Justin Sanders | ||
show_side_share_buttons: True |
47 changes: 47 additions & 0 deletions
47
network-api/networkapi/templates/pattern_library_base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{% load wagtailmetadata_tags i18n localization settings_value wagtailuserbar static mofo_common %} | ||
|
||
{% get_current_language as lang_code %} | ||
|
||
<!DOCTYPE html> | ||
<html lang="{{ lang_code }}" class="{% block html_class %}{% endblock %}"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title> | ||
{% block page_title %} | ||
{% environment_prefix %} | ||
{% trans "Mozilla Foundation" %} - {% if page.specifics.seo_title %}{{ page.specifics.seo_title }}{% else %}{{ page.title }}{% endif %} | ||
{% endblock %} | ||
</title> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
{% block stylesheets %} | ||
<link rel="stylesheet" href="{% static "_css/main.compiled.css" %}"> | ||
{% if debug %}<link rel="stylesheet" href="{% static "_css/tailwind.compiled.css" %}">{% endif %} | ||
|
||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,300,700,300i,800,900,400i"> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Zilla+Slab:300,400,500,600,700,300i,400i,600i"> | ||
{% endblock %} | ||
</head> | ||
<body class="{% block bodyclass %}{% endblock %}" id="view-{% block body_id %}{% endblock %}"> | ||
{% block body_wrapped %} | ||
<div class="wrapper"> | ||
{% block content_wrapped %} | ||
<main role="main"> | ||
{% block content %} | ||
{# This is only used when viewing pattern library via /pattern-library. #} | ||
{{ pattern_library_rendered_pattern }} | ||
{% endblock %} | ||
</main> | ||
{% endblock content_wrapped %} | ||
</div> | ||
{% endblock %} | ||
|
||
{% block script_bundle %} | ||
<script src="{% url "javascript-catalog" %}"></script> | ||
<script src="{% static "_js/main.compiled.js" %}"></script> | ||
{% endblock %} | ||
|
||
{% block extra_scripts %}{% endblock %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
network-api/networkapi/wagtailpages/templates/wagtailpages/blocks/rich_text_block.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
context: | ||
value: Else health character policy television now. Style could affect eye. Bank me morning scientist provide value. Leave physical stock role summer. Off represent first worry explain chance. Defense address carry opportunity I machine according. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters