-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1173 from Metro-Records/hcg/wagtail
Install Wagtail and transition About page to CMS
- Loading branch information
Showing
39 changed files
with
2,024 additions
and
384 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
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 |
---|---|---|
|
@@ -28,3 +28,4 @@ lametro/secrets.py | |
.env | ||
|
||
.venv | ||
media/ |
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
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
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
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
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
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
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,66 @@ | ||
from wagtail import blocks | ||
from wagtail.images.blocks import ImageChooserBlock | ||
from wagtail.contrib.typed_table_block.blocks import TypedTableBlock | ||
|
||
|
||
class NavigationBlock(blocks.StaticBlock): | ||
class Meta: | ||
template = "lametro/blocks/navigation.html" | ||
icon = "bars" | ||
|
||
def get_context(self, *args, **kwargs): | ||
context = super().get_context(*args, **kwargs) | ||
|
||
if parent_context := kwargs.get("parent_context"): | ||
context["navigation_items"] = { | ||
section.value["heading"] or "Unnamed Section": section.value["anchor"] | ||
for section in parent_context["page"].body | ||
if section.value["anchor"] | ||
} | ||
|
||
return context | ||
|
||
|
||
class Breakpoints(blocks.StructBlock): | ||
class Meta: | ||
help_text = "Max number of columns to display on different devices" | ||
|
||
sm = blocks.IntegerBlock(default=1, help_text="Mobile phone") | ||
md = blocks.IntegerBlock(default=2, help_text="Tablet") | ||
lg = blocks.IntegerBlock(default=4, help_text="Desktop") | ||
|
||
|
||
class ResponsiveContent(blocks.StructBlock): | ||
breakpoints = Breakpoints() | ||
content = blocks.StreamBlock( | ||
[ | ||
( | ||
"table", | ||
TypedTableBlock( | ||
[ | ||
("rich_text", blocks.RichTextBlock()), | ||
] | ||
), | ||
) | ||
] | ||
) | ||
|
||
|
||
class ContentBlock(blocks.StreamBlock): | ||
text = blocks.RichTextBlock() | ||
image = ImageChooserBlock() | ||
table = TypedTableBlock( | ||
[ | ||
("rich_text", blocks.RichTextBlock()), | ||
] | ||
) | ||
navigation = NavigationBlock() | ||
responsive_element = ResponsiveContent() | ||
|
||
|
||
class ArticleBlock(blocks.StructBlock): | ||
heading = blocks.CharBlock(required=False) | ||
content = ContentBlock() | ||
anchor = blocks.CharBlock( | ||
required=False, help_text="Add anchor to enable direct links to this section" | ||
) |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+9.96 KB
lametro/fixtures/initial_images/images/datamade_logo_sm.max-165x165.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
lametro/fixtures/initial_images/images/datamade_logo_sm.max-800x600.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
lametro/fixtures/initial_images/images/datamade_logo_sm.width-500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
lametro/fixtures/initial_images/images/datamade_logo_sm.width-800.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
lametro/fixtures/initial_images/images/datamade_logo_sm_fDWMRNo.max-800x600.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
lametro/fixtures/initial_images/images/datamade_logo_sm_fDWMRNo.width-500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.3 KB
lametro/fixtures/initial_images/original_images/datamade_logo_sm_fDWMRNo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,50 @@ | ||
from pathlib import Path | ||
import subprocess | ||
|
||
from django.apps import apps | ||
from django.core.management.base import BaseCommand | ||
from django.core.management import call_command | ||
|
||
|
||
class Command(BaseCommand): | ||
""" | ||
Dump core Wagtail content and any custom pages and/or Django models | ||
where the include_in_dump attribute is True. Also copy images uploaded | ||
locally to the fixtures directory, so that they can be loaded to default | ||
storage (usually S3) during deployment. | ||
""" | ||
|
||
def handle(self, **options): | ||
app_models = apps.get_app_config("lametro").get_models() | ||
|
||
excluded_app_models = [ | ||
f"lametro.{m.__name__}" | ||
for m in app_models | ||
if not getattr(m, "include_in_dump", False) | ||
] | ||
|
||
call_command( | ||
"dumpdata", | ||
natural_foreign=True, | ||
indent=4, | ||
output=Path("lametro/fixtures/cms_content.json"), | ||
exclude=[ | ||
"contenttypes", | ||
"auth.permission", | ||
"wagtailcore.groupcollectionpermission", | ||
"wagtailcore.grouppagepermission", | ||
"wagtailsearch.indexentry", | ||
"sessions", | ||
] | ||
+ excluded_app_models, | ||
) | ||
|
||
subprocess.run( | ||
[ | ||
"cp", | ||
"-R", | ||
"media/.", | ||
"lametro/fixtures/initial_images/", | ||
], | ||
check=True, | ||
) |
Oops, something went wrong.