@@ -54,3 +54,63 @@ on the page, and its ordering relative to the ``Dash`` instances using updating
5454the page footer - to avoid delaying the main page load - along
5555with other scripts is generally advisable.
5656
57+ The ``plotly_app_identifier `` template tag
58+ -----------------------------------------
59+
60+ This tag provides an identifier for an app, in a form that is suitable for use as a classname or identifier
61+ in HTML:
62+
63+ .. code-block :: jinja
64+
65+ {%load plotly_dash%}
66+
67+ {%plotly_app_identifier name="SimpleExample"%}
68+
69+ {%plotly_app_identifier slug="liveoutput-2" postfix="A"%}
70+
71+ The identifier, if the tag is not passed a ``slug ``, is the result of passing the identifier of the app through
72+ the ``django.utils.text.slugify `` function.
73+
74+ The tag arguments are:
75+
76+ :name = None: The name of the application, as passed to a ``DjangoDash `` constructor.
77+ :slug = None: The slug of an existing ``DashApp `` instance.
78+ :da = None: An existing ``django_plotly_dash.models.DashApp `` model instance.
79+ :postfix = None: An optional string; if specified it is appended to the identifier with a hyphen.
80+
81+ The validity rules for these arguments are the same as those for the ``plotly_app `` template tag. If
82+ supplied, the ``postfix `` argument
83+ should already be in a slug-friendly form, as no processing is performed on it.
84+
85+ The ``plotly_class `` template tag
86+ -----------------------------------------
87+
88+ Generate a string of class names, suitable for a ``div `` or other element that wraps around ``django-plotly-dash `` template content.
89+
90+ .. code-block :: jinja
91+
92+ {%load plotly_dash%}
93+
94+ <div class="{%plotly_class slug="liveoutput-2" postfix="A"%}">
95+ {%plotly_app slug="liveoutput-2" ratio="0.5" %}
96+ </div>
97+
98+ The identifier, if the tag is not passed a ``slug ``, is the result of passing the identifier of the app through
99+ the ``django.utils.text.slugify `` function.
100+
101+ The tag arguments are:
102+
103+ :name = None: The name of the application, as passed to a ``DjangoDash `` constructor.
104+ :slug = None: The slug of an existing ``DashApp `` instance.
105+ :da = None: An existing ``django_plotly_dash.models.DashApp `` model instance.
106+ :prefix = None: Optional prefix to use in place of the text ``django-plotly-dash `` in each class name
107+ :postfix = None: An optional string; if specified it is appended to the app-specific identifier with a hyphen.
108+ :template_type = None: Optional text to use in place of ``iframe `` in the template-specific class name
109+
110+ The tag inserts a string with three class names in it. One is just the ``prefix `` argument, one
111+ has the ``template_type `` appended, and the final one has the app identifier (as generated
112+ by the ``plotly_app_identifier `` tag) and any ``postfix `` appended.
113+
114+ The validity rules for these arguments are the same as those for the ``plotly_app `` and ``plotly_app_identifier `` template tags. Note
115+ that none of the ``prefix ``, ``postfix `` and ``template_type `` arguments are modified and they should
116+ already be in a slug-friendly form, or otherwise fit for their intended purpose.
0 commit comments