Skip to content

Commit

Permalink
WIP implementation of WagtailCharts on Browse page
Browse files Browse the repository at this point in the history
  • Loading branch information
csebianlander committed Sep 21, 2022
1 parent 3f74aa8 commit 13ce245
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions cfgov/cfgov/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"filing_instruction_guide",
"health_check",
"health_check.db",
"wagtailcharts",
# Satellites
"complaint_search",
"countylimits",
Expand Down
19 changes: 19 additions & 0 deletions cfgov/jinja2/v1/_includes/organisms/wagtail-charts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% load wagtailcore_tags wagtailcharts_tags %}

{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-6">
<h1>{{self.title}}</h1>
<div class="excerpt">{{self.excerpt|richtext}}</div>
</div>
</div>
{% for block in self.body %}
{% include_block block %}
{% endfor %}
</div>
{% endblock %}

{% block extra_js %}
{% render_charts %}
{% endblock %}
10 changes: 10 additions & 0 deletions cfgov/v1/atomic_elements/organisms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from wagtail.snippets.blocks import SnippetChooserBlock

from taggit.models import Tag
from wagtailcharts.blocks import ChartBlock
from wagtailmedia.blocks import AbstractMediaChooserBlock

from v1 import blocks as v1_blocks
Expand Down Expand Up @@ -567,6 +568,15 @@ class Media:
css = ["simple-chart.css"]


class WagtailChartBlock(blocks.StreamBlock):
content = ChartBlock()

class Meta:
label = "WagtailCharts Chart"
icon = "image"
template = "_includes/organisms/wagtail-charts.html"


class FullWidthText(blocks.StreamBlock):
content = blocks.RichTextBlock(icon="edit")
content_with_anchor = molecules.ContentWithAnchor()
Expand Down
1 change: 1 addition & 0 deletions cfgov/v1/models/browse_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class BrowsePage(CFGOVPage):
),
("raw_html_block", blocks.RawHTMLBlock(label="Raw HTML block")),
("chart_block", organisms.ChartBlock()),
("wagtailchart_block", organisms.WagtailChartBlock()),
("mortgage_chart_block", organisms.MortgageChartBlock()),
("mortgage_map_block", organisms.MortgageMapBlock()),
("mortgage_downloads_block", MortgageDataDownloads()),
Expand Down

0 comments on commit 13ce245

Please sign in to comment.