Skip to content

Commit b9d1de0

Browse files
author
Mark Gibbs
committed
Refactored templates and introduced a common base
1 parent c09ae42 commit b9d1de0

File tree

4 files changed

+66
-93
lines changed

4 files changed

+66
-93
lines changed

demo/demo/templates/base.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
{%load plotly_dash%}
5+
<title>Django Plotly Dash Examples - {%block title%}{%endblock%}</title>
6+
</head>
7+
<body>
8+
<div>
9+
<p>Navigational links :
10+
<a href="{%url "home"%}">Contents</a>
11+
<a href="{%url "demo-one"%}">Demo Page One</a>
12+
<a href="{%url "demo-two"%}">Demo Page Two</a>
13+
</p>
14+
</div>
15+
<div>
16+
{%block content%}{%endblock%}
17+
</div>
18+
</body>
19+
{%block post_body%}{%endblock%}
20+
</html>

demo/demo/templates/demo_one.html

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
1-
<!DOCTYPE HTML>
2-
<html>
3-
<head>
4-
{%load plotly_dash%}
5-
<title>Simple stuff</title>
6-
</head>
7-
<body>
8-
<div>
9-
<p>Navigational links :
10-
<a href="{%url "home"%}">Main Page</a>
11-
</p>
12-
</div>
13-
<div>
14-
Content here
15-
{%plotly_app slug="simpleexample-1" ratio=0.2 %}
16-
</div>
17-
<div>
18-
Content here
19-
{%plotly_app name="SimpleExample"%}
20-
</div>
21-
<div>
22-
Content here
23-
{%plotly_app name="Ex2"%}
24-
</div>
25-
<div>
26-
WS Content here
27-
{%plotly_app name="Connected"%}
28-
</div>
29-
<div>
30-
WS Content here
31-
{%plotly_app slug="connected-2"%}
32-
</div>
33-
</body>
34-
{%plotly_message_pipe%}
35-
</html>
1+
{%extends "base.html"%}
2+
{%load plotly_dash%}
3+
{%block title%}Demo One{%endblock%}
4+
{%block post_body%}{%plotly_message_pipe%}{%endblock%}
5+
{%block content%}
6+
<div>
7+
Content here
8+
{%plotly_app slug="simpleexample-1" ratio=0.2 %}
9+
</div>
10+
<div>
11+
Content here
12+
{%plotly_app name="SimpleExample"%}
13+
</div>
14+
<div>
15+
Content here
16+
{%plotly_app name="Ex2"%}
17+
</div>
18+
<div>
19+
WS Content here
20+
{%plotly_app name="Connected"%}
21+
</div>
22+
<div>
23+
WS Content here
24+
{%plotly_app slug="connected-2"%}
25+
</div>
26+
{%endblock%}
27+

demo/demo/templates/demo_two.html

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
1-
<!DOCTYPE HTML>
2-
<html>
3-
<head>
4-
{%load plotly_dash%}
5-
<title>More Examples</title>
6-
</head>
7-
<body>
8-
<div>
9-
<p>Navigational links :
10-
<a href="{%url "home"%}">Main Page</a>
11-
</p>
12-
</div>
13-
<div>
14-
WS Content here
15-
{%plotly_app slug="connected-2"%}
16-
</div>
17-
<div>
18-
WS Content here
19-
{%plotly_app slug="simpleexample-1"%}
20-
</div>
21-
</body>
22-
{ % plotly_message_pipe % }
23-
</html>
1+
{%extends "base.html"%}
2+
{%load plotly_dash%}
3+
{%block title%}More Examples{%endblock%}
4+
{%block content%}
5+
<div>
6+
WS Content here
7+
{%plotly_app slug="connected-2"%}
8+
</div>
9+
<div>
10+
WS Content here
11+
{%plotly_app slug="simpleexample-1"%}
12+
</div>
13+
{%endblock%}

demo/demo/templates/index.html

Lines changed: 6 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,8 @@
1-
<!DOCTYPE HTML>
2-
<html>
3-
<head>
4-
{%load plotly_dash%}
5-
<title>Simple stuff</title>
6-
</head>
7-
<body>
1+
{%extends "base.html"%}
2+
{%block title%} Index{%endblock%}
3+
{%load plotly_dash%}
4+
{%block content%}
85
<div>
9-
<p>Navigational links :
10-
<a href="{%url "home"%}">Main Page</a>
11-
<a href="{%url "demo-one"%}">Demo One</a>
12-
<a href="{%url "demo-two"%}">Demo Two</a>
13-
</p>
6+
This is the django_plotly_dash demo application.
147
</div>
15-
<div>
16-
Content here
17-
{%plotly_app slug="simpleexample-1" ratio=0.2 %}
18-
</div>
19-
<div>
20-
Content here
21-
{%plotly_app name="SimpleExample"%}
22-
</div>
23-
<div>
24-
Content here
25-
{%plotly_app name="Ex2"%}
26-
</div>
27-
<div>
28-
WS Content here
29-
{%plotly_app name="Connected"%}
30-
</div>
31-
<div>
32-
WS Content here
33-
{%plotly_app slug="connected-2"%}
34-
</div>
35-
</body>
36-
{%plotly_message_pipe%}
37-
</html>
8+
{%endblock%}

0 commit comments

Comments
 (0)