@@ -76,40 +76,54 @@ if {{ not portable }} and not webviz_config.is_reload_process():
76
76
# from the child/restart/reload process.
77
77
app .layout = html .Div ()
78
78
else :
79
- app .layout = dcc .Tabs (
80
- parent_className = "layoutWrapper" ,
81
- content_className = "pageWrapper" ,
82
- className = "sideBar" ,
83
- vertical = True ,
84
- children = [
85
- {% for page in pages % }
86
- dcc .Tab (
87
- {% - if loop .first - % }
88
- id = "logo" ,
89
- className = "styledLogo" ,
90
- {% - else - % }
91
- {% - if loop .last - % }
92
- id = "last_page" ,
93
- {% - else - % }
94
- id = "{{page.id}}" ,
95
- {% - endif - % }
96
- label = "{{page.title}}" ,
97
- selected_className = "selectedButton" ,
98
- className = "styledButton" ,
99
- {% - endif - % }
100
- children = [
101
- {% for content in page .content - % }
102
- {% - if content is string - % }
103
- dcc .Markdown (r"""{{ content }}""" )
104
- {% - else - % }
105
- {{ content ._call_signature [0 ] }}.{{ content ._call_signature [1 ] }}
106
- {% - endif - % }
107
- {{- "" if loop .last else "," }}
108
- {% endfor - % }
109
- ],
110
- ) {{- "" if loop .last else "," - }}
111
- {% endfor % }],
112
- )
79
+ page_content = {}
80
+ {% for page in pages % }
81
+ page_content ["{{page.id}}" ] = [
82
+ {% for content in page .content - % }
83
+ {% - if content is string - % }
84
+ dcc .Markdown (r"""{{ content }}""" )
85
+ {% - else - % }
86
+ {{ content ._call_signature [0 ] }}.{{ content ._call_signature [1 ] }}
87
+ {% - endif - % }
88
+ {{- "" if loop .last else "," }}
89
+ {% endfor - % }
90
+ ]
91
+ {% endfor % }
92
+ app .layout = html .Div (
93
+ className = "layoutWrapper" ,
94
+ children = [html .Div (
95
+ children = [dcc .Location (
96
+ id = 'url' , refresh = True ),
97
+ html .Div (
98
+ className = "sideWrapper" ,
99
+ children = [
100
+ {% for page in pages % }
101
+ dcc .Link (
102
+ {% - if loop .first - % }
103
+ "" ,
104
+ id = "logo" ,
105
+ className = "styledLogo" ,
106
+ href = "/" ,
107
+ {% - else - % }
108
+ "{{page.title}}" ,
109
+ className = "styledButton" ,
110
+ id = "{{page.id}}" ,
111
+ href = "/{{page.id}}" ,
112
+ {% - endif - % }
113
+ )
114
+ {{- "" if loop .last else "," - }}
115
+ {% endfor % }
116
+ ])]),
117
+ html .Div (className = "pageContent" , id = "page-content" )])
118
+
119
+
120
+ @app .callback (dash .dependencies .Output ("page-content" , "children" ),
121
+ dash .dependencies .Input ("url" , "pathname" ))
122
+ def update_page (pathname ):
123
+ pathname = pathname .replace ("/" , "" )
124
+ if not pathname :
125
+ pathname = "front-page"
126
+ return page_content .get (pathname , "Error 404 - Oooppss... Page not found." )
113
127
114
128
{{ "WEBVIZ_ASSETS.directly_host_assets(app)" if not portable else "" }}
115
129
0 commit comments