Skip to content

Commit 670daf9

Browse files
author
Mark Gibbs
committed
Added class generating tag to first demo page
1 parent 736d9d5 commit 670daf9

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

demo/demo/templates/demo_one.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,25 @@ <h1>Simple App Embedding</h1>
1010
the plotly_app template tag with the name of a dash application represents the simplest use of
1111
the django_plotly_dash framework.
1212
</p>
13+
<p>
14+
The plotly_class tag is also used to wrap the application in css class names based on the
15+
application (django-plotly-dash), the
16+
type of the embedding (iframe), and the slugified version of the app name (simpleexample).
17+
</p>
1318
<div class="card bg-light border-dark">
1419
<div class="card-body">
1520
<p><span>{</span>% load plotly_dash %}</p>
16-
<p><span>{</span>% plotly_app name="SimpleExample" %}</p>
21+
<p>&lt;div class="<span>{</span>% plotly_class name="SimpleExample"%}">
22+
<p class="ml-3"><span>{</span>% plotly_app name="SimpleExample" %}</p>
23+
<p>&lt;\div>
1724
</div>
1825
</div>
1926
<p></p>
2027
<div class="card border-dark">
2128
<div class="card-body">
22-
{%plotly_app name="SimpleExample"%}
29+
<div class="{%plotly_class name="SimpleExample"%}">
30+
{%plotly_app name="SimpleExample"%}
31+
</div>
2332
</div>
2433
</div>
2534
{%endblock%}

django_plotly_dash/dash_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def slugified_id(self):
419419
pre_slugified_id = self._uid
420420
return slugify(pre_slugified_id)
421421

422-
def extra_html_properties(self, prefix=None, posfix=None, template_type=None):
422+
def extra_html_properties(self, prefix=None, postfix=None, template_type=None):
423423
'''
424424
Return extra html properties to allow individual apps to be styled separately.
425425
@@ -428,7 +428,7 @@ def extra_html_properties(self, prefix=None, posfix=None, template_type=None):
428428

429429
prefix = prefix if prefix else "django-plotly-dash"
430430

431-
post_part = "-%s" % posfix if posfix else ""
431+
post_part = "-%s" % postfix if postfix else ""
432432
template_type = template_type if template_type else "iframe"
433433

434434
slugified_id = self.slugified_id()

0 commit comments

Comments
 (0)