diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-31 19:41:58 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-31 19:41:58 +0200 |
| commit | 87586f73fc5741070466d189dfab807a190753e5 (patch) | |
| tree | 33fefbcb3478c8eb35896b7c08cde27c2ca0b1c9 /cli | |
| parent | cda9c115283be8e4e224f6036ba07e5eca243289 (diff) | |
add potential to generate custom headers and custom pages
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/app/controllers/graph_controller.py | 6 | ||||
| -rw-r--r-- | cli/app/site/export.py | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/cli/app/controllers/graph_controller.py b/cli/app/controllers/graph_controller.py index fcca50a..9169818 100644 --- a/cli/app/controllers/graph_controller.py +++ b/cli/app/controllers/graph_controller.py @@ -13,6 +13,12 @@ class GraphView(CrudView): model = Graph form = GraphForm + def on_create(self, session, form, item): + item.settings = form['settings'] + + def on_update(self, session, form, item): + item.settings = form['settings'] + def on_destroy(self, session, item): for item in item.pages: session.query(Tile).filter(Tile.page_id == item.id).delete(synchronize_session=False) diff --git a/cli/app/site/export.py b/cli/app/site/export.py index aa74165..4ddd01d 100644 --- a/cli/app/site/export.py +++ b/cli/app/site/export.py @@ -25,6 +25,7 @@ def export_site(opt_graph_path, opt_output_dir=app_cfg.DIR_EXPORTS, opt_build_js # load site index index_html = load_text(join(app_cfg.DIR_STATIC, 'site.html'), split=False) + index_html = index.html.replace('CUSTOM_HEADER', graph.settings.get('custom_header', '')) index_html = index_html.replace('SITE_PATH', '/' + graph.path) # write site JSON data @@ -44,7 +45,8 @@ def export_site(opt_graph_path, opt_output_dir=app_cfg.DIR_EXPORTS, opt_build_js print("Homepage not set! Shift-click a page on the graph to make it the homepage.") session.close() return - write_text(f'<meta http-equiv="refresh" content="0; url={home_page}">', join(graph_dir, 'index.html')) + # write_text(f'<meta http-equiv="refresh" content="0; url={home_page}">', join(graph_dir, 'index.html')) + write_index(graph=graph, page=None, index_html=index_html, fp_out=join(graph_dir, 'index.html')) index_path = "" for page in graph.pages: |
